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

Assigning default ENUM values results in non-compilable java code if java namespace is not defined

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Pending Closed
    • Affects Version/s: 0.9.2
    • Fix Version/s: 0.9.3
    • Component/s: Java - Compiler
    • Labels:
      None

      Description

      enumtest.thrift
      enum Color {
        BLACK = 5,
        WHITE = 6
      }
      
      struct Params {
        1: optional Color bColor = Color.BLACK;
      }
      

      Running thrift --gen java enumtest.thrift (thrift 0.9.2 on OSX 10.10.3)
      results in non-compilable java code.

        public Params() {
          this.bColor = .Color.BLACK;
      
        }
      
        @Override
        public void clear() {
          this.bColor = .Color.BLACK;
      
        }
      

      Notice the "." before Color.BLACK. If java namespace is defined in the thrift file, it works as expected.

        Attachments

        Issue Links

          Activity

            People

            • Assignee:
              AnnaDymek Anna Dymek
              Reporter:
              thrift_2015 Pavan Chitumalla

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment