When setX(null) is called on a structure, set __isset.x to false.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@700667
13f79535-47bb-0310-9956-
ffa450edef68
indent_up();
indent(out) << "this." << field_name << " = " << field_name << ";" <<
endl;
- indent(out) << "this.__isset." << field_name << " = true;" << endl;
+ // if the type isn't nullable, then the setter can't have been an unset in disguise.
+ if ((type->is_base_type() && !type->is_string()) || type->is_enum() ) {
+ indent(out) << "this.__isset." << field_name << " = true;" << endl;
+ } else {
+ indent(out) << "this.__isset." << field_name << " = (" << field_name << " != null);" << endl;
+ }
+
indent_down();
indent(out) << "}" << endl << endl;