default value for field with enum type generates Java source with compiler error
--------------------------------------------------------------------------------

                 Key: THRIFT-776
                 URL: https://issues.apache.org/jira/browse/THRIFT-776
             Project: Thrift
          Issue Type: Bug
          Components: Compiler (Java)
    Affects Versions: 0.2
         Environment: Windows 7 64-bit
cygwin-built compiler from thrift-0.2.0 source
            Reporter: Jeff DeCew


When I generate Java source from a thrift file where I assign a default enum 
value, the compiler correctly interprets the thrift file, but the source it 
generates assigns an integer to an enum field, which is a compiler error.
A thrift file like this:
{code:java}
enum MyEnum {
MY_ENUM_VALUE=7
}
struct MyStruct {
1 : MyEnum myEnum = MY_ENUM_VALUE
}
{code}
generates a constructor that looks like this:
{code:java}
public MyStruct() {
   this.myEnum = 7
}
{code}
but it should generate this:
{code:java}
public MyStruct () {
   this.myEnum = MyEnum.MY_ENUM_VALUE
}
{code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to