facebookarchive / swift

An annotation-based Java library for creating Thrift serializable types and services.
Apache License 2.0
900 stars 297 forks source link

Fix generated Java code for Thrift unions with multiple fields of same type #320

Closed ryantimwilson closed 8 years ago

ryantimwilson commented 8 years ago

Currently, when generating Java code for Thrift unions with multiple fields of the same type, the code won't compile. This is because Swift generates a constructor per field, so multiple constructors will have the same arguments even though they initialize fields differently.

This patch changes the union template to use a builder paradigm in order to allow for this case.

siyengar commented 8 years ago

@alandau could you take a look?

alandau commented 8 years ago

cc @SergeyMakarenko

lgtm, except AFAIU this is a breaking change for code that used the constructor directly. Can you grep the relevant repos to make sure no such code exists and talk to the relevant people if it does?

ryantimwilson commented 8 years ago

This was merged