Constants break when a namespace/prefix is set.
-----------------------------------------------
Key: THRIFT-520
URL: https://issues.apache.org/jira/browse/THRIFT-520
Project: Thrift
Issue Type: Bug
Components: Compiler (Cocoa)
Reporter: Fred Potter
Priority: Minor
Given the following thrift file:
{code}
namespace cocoa XX
const list<string> MY_THINGS = [ "a", "b", "c" ]
const string MY_CONSTANT = "Hello!"
{code}
The generated class looks like:
{code}
static NSArray * XXMY_THINGS;
static NSString * XXMY_CONSTANT = @"Hello!";
@implementation XXfooConstants
+ (void) initialize {
MY_THINGS = [[NSArray alloc] initWithObjects: @"a", @"b", @"c", nil];
}
+ (NSArray *) MY_THINGS{
return MY_THINGS;
}
+ (NSString *) MY_CONSTANT{
return MY_CONSTANT;
}
@end
{code}
... but, it needs to look as it does below with the correct prefixing in the
initialize and getter methods:
{code}
static NSArray * XXMY_THINGS;
static NSString * XXMY_CONSTANT = @"Hello!";
@implementation XXfooConstants
+ (void) initialize {
XXMY_THINGS = [[NSArray alloc] initWithObjects: @"a", @"b", @"c", nil];
}
+ (NSArray *) MY_THINGS{
return XXMY_THINGS;
}
+ (NSString *) MY_CONSTANT{
return XXMY_CONSTANT;
}
@end
{code}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.