[ 
https://issues.apache.org/jira/browse/THRIFT-1866?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13591719#comment-13591719
 ] 

Jens Geyer commented on THRIFT-1866:
------------------------------------

So it turns out we have two Basic Options how to deal with it.

First, we could set up some mechanism that allows the different 
languages/platforms to a) specify their particular rules for valid 
identifiers/filenames and b) some kind of replacement rules to create valid 
identifiers from invalid ones, including c) name collision resolving.

Second, we could just implement the rules for valid identifiers/filenames and 
check the identifiers and file names against these rules. 

The second approach is without a doubt much easier to implement, but one might 
run into the strange situation that a particular IDL successfully generates 
code for one language on one platform but spits out just an error for another 
language and/or platform. With the implementation that we have right now there 
would be at least generated something that could be corrected manually if 
really necessary.


                
> java compiler generates non-compiling code with const's defined in a thrift 
> file whose name includes non-identifier chars
> -------------------------------------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1866
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1866
>             Project: Thrift
>          Issue Type: Bug
>          Components: Java - Compiler
>    Affects Versions: 0.9
>         Environment: Mac OS X 10.7.5
>            Reporter: Bekir Oguz
>         Attachments: test-thrift.thrift
>
>
> Thrift-0.9 Java compiler generates non-compiling code when both the following 
> conditions happen:
> * thrift file name includes a character which is not a valid java identifier 
> (i.e. '-')
> * thrift file includes 'const' fields
> Thrift generates the Java file named <thriftFileName>Constants.java which is 
> not compiling because of the non-identifier in the thriftFileName.
> Earlier thrift versions are fine because they generate only Constants.java 
> file without prefixing thrift file name to it.
> Please find attached an example thrift file.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to