Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-2065

Not valid constants filename in Java

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments


    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.8, 0.9
    • Fix Version/s: 0.9.1
    • Component/s: Java - Compiler
    • Labels:
    • Patch Info:
      Patch Available


      In my company we use to name our thrift file separating data and services.

      I.e. for two files, one for user management, another for address management, we would have four thrift files : user.data.thrift , user.services.thrift address.data.thrift and address.services.thrift

      We were using thrift 0.2.0 and generating java code, and it worked perfectly. We try now to pass to thrift 0.9.0 and everything works besides constants.

      For contants, in 0.2.0 it generated a Constants.java class in the package declared in the namespace java.

      In 0.9.0, for a file FILENAME.thrift it generates a FILENAMEConstants.java in the package declared in the namespace java. And if the filename includes a dot, it generates a java file with a dot in the name, not valid in java.

      So for my precedent example I get a user.dataConstants.java and address.dataConstants.java, with Java classes called user.dataConstants and address.dataConstant. And the Java compiler doesn't accept classes with a dot in the class name.

      Would it be possible to find a solution (for example scanning for dots before generating the constants file and changing them for a '_') ?


        Issue Links



            • Assignee:
              jensg Jens Geyer
              lostinbrittany Horacio Gonzalez


              • Created:

                Issue deployment