[ 
https://issues.apache.org/jira/browse/THRIFT-1833?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alan Choi updated THRIFT-1833:
------------------------------

    Attachment: Thrift-1833.diff

THRIFT-1833 Fix C++ union issue.

Default field in an union should be treated as if it's optional:

1. it should not be written to the wire if it has not been set
2. at most one field should be set.
3. when comparing 2 union struct, the __isset flag should be examined.

Added C++ union test in DebugProtoTest.
Added Java and C++ test in ThriftTest.

                
> Thrift generates incorrect C++ writer for union
> -----------------------------------------------
>
>                 Key: THRIFT-1833
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1833
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Compiler
>    Affects Versions: 0.9
>            Reporter: Alan Choi
>         Attachments: Thrift-1833.diff
>
>
> The generated union struct c++ writer would write all union fields. This is 
> incorrect. It should only write the field that has been set.
> It causes incompatibility between c++ and Java. A union written by C++ side 
> cannot be read by the Java side.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to