Lucas Partridge created THRIFT-2435:
---------------------------------------

             Summary: Java compiler 
                 Key: THRIFT-2435
                 URL: https://issues.apache.org/jira/browse/THRIFT-2435
             Project: Thrift
          Issue Type: Bug
          Components: Java - Compiler
    Affects Versions: 0.9
            Reporter: Lucas Partridge
            Priority: Minor


The following IDL works fine in Python and C# but generates a compiler error in 
Java:
{code}
namespace * test

enum DataType {
    Text
}

struct Metadata {
    1: string Name,
    2: DataType DataType
}

service TestService {
    void SendData(1:string Data, 2:Metadata Metadata)
}
{code}

The generated test.Metadata.java file has 2 compile errors:

{{Cannot make a static reference to the non-static field DataType}}

at line 422:
{code}
struct.DataType = DataType.findByValue(iprot.readI32());
{code}
and line 495:
{code}
struct.DataType = DataType.findByValue(iprot.readI32());
{code}

If the IDL is changed to use {{DataType dataType}} instead then the compile 
errors don't occur.

This issue is annoying because the same IDL works fine in Python and C#. To 
make the IDL work for Java we have to change the IDL, which means we have to 
change our Python clients (I haven't checked the C# clients yet). See also 
http://stackoverflow.com/questions/22691634/what-is-the-recommended-naming-convention-for-thrift-identifiers-in-order-to-max





--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to