Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
0.9
-
None
Description
The following IDL works fine in Python and C# but generates a compiler error in Java:
namespace * test
enum DataType {
Text
}
struct Metadata {
1: string Name,
2: DataType DataType
}
service TestService {
void SendData(1:string Data, 2:Metadata Metadata)
}
The generated test.Metadata.java file has 2 compile errors:
Cannot make a static reference to the non-static field DataType
at line 422:
struct.DataType = DataType.findByValue(iprot.readI32());
and line 495:
struct.DataType = DataType.findByValue(iprot.readI32());
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