/[Apache-SVN]
ViewVC logotype

Revision 1236529


Jump to revision: Previous Next
Author: jfarrell
Date: Fri Jan 27 04:48:26 2012 UTC (12 years, 3 months ago)
Changed paths: 3
Log Message:
THRIFT-1394:Treatment of optional fields is not consistent between C++ and Java
Client: cpp
Patch: Diwaker Gupta

In CPP, all optional fields are guarded by the isset helper struct. On Java, however, the generated code takes advantage of nullable types: for containers, structs, exceptions, enums, and, notably, strings, the generator elides explicit use of an "isset" bit vector and instead emits checks of the form "field null". This leads to varying behavior between the two languages: an optional string field with a default value will have {{isset[fieldid]}} false on C, but the equivalent test in Java will be true.



Changed paths

Path Details
Directorythrift/trunk/compiler/cpp/src/generate/t_cpp_generator.cc modified , text changed
Directorythrift/trunk/lib/cpp/test/OptionalRequiredTest.cpp modified , text changed
Directorythrift/trunk/test/OptionalRequiredTest.thrift modified , text changed

infrastructure at apache.org
ViewVC Help
Powered by ViewVC 1.1.26