Closed vicmosin closed 9 years ago
I think the problem is messageId
and provider
are both tagged as being field 5
What happens when you try to run the program? (What error do you get?)
I am sorry regarding the numbers mistake, but it wasn't an issue... I talking about the following exception:
com.facebook.swift.codec.metadata.MetadataErrorException: Error: Inject method com. Sms. setMessageId is not allowed on struct class, since struct has a builder
at com.facebook.swift.codec.metadata.MetadataErrors.addError(MetadataErrors.java:95)
at com.facebook.swift.codec.metadata.AbstractThriftMetadataBuilder.addMethod(AbstractThriftMetadataBuilder.java:430)
I solved the issue by removing the builder
annotation and moving the builder itself to external class, but the solution is not so nice to me...
I think the idea is that when deserializing an object, swift has to choose one of the two ways to set the field, and we don't have any guarantee both have the same behavior.
If you want swift to use the builder, but you still want to have the setter, you can I think, you just have to de-annotate it.
Why it is forbidden two use both patterns within the same object?