fishy commented on code in PR #2843:
URL: https://github.com/apache/thrift/pull/2843#discussion_r1293687685
##########
lib/java/src/main/java/org/apache/thrift/protocol/TType.java:
##########
@@ -34,6 +34,11 @@ public final class TType {
public static final byte MAP = 13;
public static final byte SET = 14;
public static final byte LIST = 15;
- public static final byte ENUM = 16;
- public static final byte UUID = 17;
+ public static final byte UUID = 16;
+
+ /**
+ * This is not part of the TBinaryProtocol spec but Java specific
+ * implementation detail
+ */
+ public static final byte ENUM = -1;
Review Comment:
this is all the usages of it:
```
$ git grep TType.ENUM
compiler/cpp/src/thrift/generate/t_java_generator.cc: return
"org.apache.thrift.protocol.TType.ENUM";
compiler/cpp/src/thrift/generate/t_java_generator.cc: << "new
org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM,
"
compiler/cpp/src/thrift/generate/t_javame_generator.cc: return
"TType.ENUM";
compiler/cpp/src/thrift/generate/t_javame_generator.cc: indent(out) <<
"new EnumMetaData(TType.ENUM, " << type_name(type) << ".class";
lib/java/src/main/java/org/apache/thrift/TDeserializer.java: case
TType.ENUM:
lib/java/src/main/java/org/apache/thrift/TDeserializer.java: case
TType.ENUM:
lib/java/src/main/java/org/apache/thrift/partial/PartialThriftComparer.java:
case TType.ENUM:
lib/java/src/main/java/org/apache/thrift/partial/ThriftMetadata.java:
case TType.ENUM:
lib/java/src/test/java/org/apache/thrift/partial/ThriftMetadataTest.java:
validateFieldMetadata(testStruct, 7, "enumField", TType.ENUM);
lib/java/src/test/java/org/apache/thrift/partial/ThriftMetadataTest.java:
case TType.ENUM:
lib/java/src/test/java/org/apache/thrift/partial/ThriftMetadataTest.java:
case TType.ENUM:
```
the `partial` subdirectory was added from
https://issues.apache.org/jira/browse/THRIFT-5443, while the 2 usages in
`TDeserializer` are both switching from the metadata object stored in memory:
1.
https://github.com/apache/thrift/blob/0e872c84aaa49fe9ce72123827f666c0064f0c97/lib/java/src/main/java/org/apache/thrift/TDeserializer.java#L516
2.
https://github.com/apache/thrift/blob/0e872c84aaa49fe9ce72123827f666c0064f0c97/lib/java/src/main/java/org/apache/thrift/TDeserializer.java#L596
Here is enum type in the cross test:
https://github.com/apache/thrift/blob/0e872c84aaa49fe9ce72123827f666c0064f0c97/test/ThriftTest.thrift#L257
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]