You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "James E. King III (JIRA)" <ji...@apache.org> on 2019/01/03 13:55:00 UTC
[jira] [Commented] (THRIFT-1923) Java: Inconsistency in
serialization of optional fields
[ https://issues.apache.org/jira/browse/THRIFT-1923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16733053#comment-16733053 ]
James E. King III commented on THRIFT-1923:
-------------------------------------------
Is there a specification for the behavior of optional fields? There are a lot of open issues on it like this one. In this case it looks like the author set the optional (isset) bit for a field if the client defines it due to a default value. This seems reasonable to me.
The netcore generator does this:
https://github.com/apache/thrift/blob/master/compiler/cpp/src/thrift/generate/t_netcore_generator.cc#L857
The cpp generator always sets isset even if there is no value:
https://github.com/apache/thrift/blob/master/compiler/cpp/src/thrift/generate/t_cpp_generator.cc#L1255
The lua generator doesn't even check for OPTIONAL and has no isset code generation!
The perl generator doesn't even check for OPTIONAL and has no isset code generation!
I didn't realize what a mess this feature really is...
> Java: Inconsistency in serialization of optional fields
> --------------------------------------------------------
>
> Key: THRIFT-1923
> URL: https://issues.apache.org/jira/browse/THRIFT-1923
> Project: Thrift
> Issue Type: Sub-task
> Components: Java - Compiler
> Reporter: Jens Geyer
> Priority: Major
> Labels: fields, isset, optional
> Fix For: 1.0
>
> Attachments: 0001-Mark-defaulted-optionals-set-in-Java.patch
>
>
> Sub-Task of THRIFT-1528 for Java
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)