You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Fred Potter (JIRA)" <ji...@apache.org> on 2009/06/05 09:48:07 UTC

[jira] Updated: (THRIFT-520) Constants break when a namespace/prefix is set.

     [ https://issues.apache.org/jira/browse/THRIFT-520?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Fred Potter updated THRIFT-520:
-------------------------------

    Attachment: thrift-520.patch

> 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
>         Attachments: thrift-520.patch
>
>
> 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.