[
https://issues.apache.org/jira/browse/THRIFT-409?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12750098#action_12750098
]
David Reiss commented on THRIFT-409:
------------------------------------
Undo changes to t_type.h, and this hunk:
- } else if (type->is_struct() || type->is_xception()) {
+ } else if (type->is_struct() || type->is_xception() || type->is_union()) {
Unions are a subset of structures, so there is no need to have t_type be aware
of their existence, or check for them specially.
Should deepCopyObject be used for TStruct as well?
+ protected TUnion(int setField, Object value) {
should call setFieldValue
It looks like read doesn't verify that the on-the-wire type is the same as the
type that is expected. All of the struct implementations skip the field when
this is the case.
Unless I'm missing something, the biggest problem is that you do not call
writeFieldStop in write. This means that a union-unaware recipient would be
unable to skip over a union that was sent to them, and their deserialization
would desynchronize. I think this is a blocker. See
https://issues.apache.org/jira/browse/THRIFT-409?focusedCommentId=12689715&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_12689715
> Add "union" to Thrift
> ---------------------
>
> Key: THRIFT-409
> URL: https://issues.apache.org/jira/browse/THRIFT-409
> Project: Thrift
> Issue Type: New Feature
> Reporter: Bryan Duxbury
> Assignee: Bryan Duxbury
> Fix For: 0.2
>
> Attachments: one_rule.diff, thrift-409-v2.patch, thrift-409-v3.patch,
> thrift-409-v4.patch, thrift-409-v5.patch, thrift-409-v6.patch,
> thrift-409-v7.patch, thrift-409-v8.patch, thrift-409.patch
>
>
> It would be very helpful to have a "union" construct in Thrift. Let's decide
> on the design and then break up into sub-issues to add this feature.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.