facebookarchive / swift

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

Boolean and other wrappers not properly being set to `null` #340

Closed filpano closed 6 years ago

filpano commented 7 years ago

I have a Swift Thrift interface which has several String and some Boolean parameters (not a @ThriftStruct).

I read in the @ThriftField Javadocs lines 77-83 that you should be able to use wrappers for primitives.

Together with setting the parameters as @ThriftField(requiredness = Requiredness.OPTIONAL), this should have actually enabled me to also get a null value on the receiving side. It works with String - but not with Boolean, which always has a default value of false even though I do not set it.

Is this a known issue? Is there a workaround?

saoxuequ commented 7 years ago

I have this problem, too.And I solved the problem by modifying the source code. In my understanding that the source code said the base type which is the parameter of method will set a default value by swift.

lijiwen commented 6 years ago

how to fix it???

saoxuequ commented 6 years ago

see https://github.com/facebook/swift/pull/345

lijiwen commented 6 years ago

thanks @SystemHan