diff --git a/compiler/cpp/src/generate/t_java_generator.cc b/compiler/cpp/src/generate/t_java_generator.cc index e8eab5c3e..076467673 100644 --- a/compiler/cpp/src/generate/t_java_generator.cc +++ b/compiler/cpp/src/generate/t_java_generator.cc @@ -92,7 +92,9 @@ class t_java_generator : public t_oop_generator { void generate_function_helpers(t_function* tfunction); std::string get_cap_name(std::string name); - + std::string generate_isset_check(t_field* field); + void generate_isset_set(ofstream& out, t_field* field); + void generate_service_interface (t_service* tservice); void generate_service_helpers (t_service* tservice); void generate_service_client (t_service* tservice); @@ -652,8 +654,10 @@ void t_java_generator::generate_java_struct_definition(ofstream &out, indent() << "private static final class Isset implements java.io.Serializable {" << endl; indent_up(); for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) { - indent(out) << - "public boolean " << (*m_iter)->get_name() << " = false;" << endl; + if (!type_can_be_null((*m_iter)->get_type())){ + indent(out) << + "public boolean " << (*m_iter)->get_name() << " = false;" << endl; + } } indent_down(); out << @@ -705,13 +709,7 @@ void t_java_generator::generate_java_struct_definition(ofstream &out, for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) { indent(out) << "this." << (*m_iter)->get_name() << " = " << (*m_iter)->get_name() << ";" << endl; - indent(out) << "this.__isset." << (*m_iter)->get_name() << " = "; - if (type_can_be_null((*m_iter)->get_type())) { - out << "(" << (*m_iter)->get_name() << " != null)"; - } else { - out << "true"; - } - out << ";" << endl; + generate_isset_set(out, (*m_iter)); } indent_down(); indent(out) << "}" << endl << endl; @@ -728,11 +726,14 @@ void t_java_generator::generate_java_struct_definition(ofstream &out, t_field* field = (*m_iter); std::string field_name = field->get_name(); t_type* type = field->get_type(); + bool can_be_null = type_can_be_null(type); - indent(out) << "__isset." << field_name << " = other.__isset." << field_name << ";" << endl; + if (!can_be_null) { + indent(out) << "__isset." << field_name << " = other.__isset." << field_name << ";" << endl; + } - if (type_can_be_null(type)) { - indent(out) << "if (other." << field_name << " != null) {" << endl; + if (can_be_null) { + indent(out) << "if (other." << generate_isset_check(field) << ") {" << endl; indent_up(); } @@ -745,7 +746,7 @@ void t_java_generator::generate_java_struct_definition(ofstream &out, out << ";" << endl; } - if (type_can_be_null(type)) { + if (can_be_null) { indent_down(); indent(out) << "}" << endl; } @@ -820,13 +821,9 @@ void t_java_generator::generate_java_struct_equality(ofstream& out, string that_present = "true"; string unequal; - if (is_optional) { - this_present += " && (this.__isset." + name + ")"; - that_present += " && (that.__isset." + name + ")"; - } - if (can_be_null) { - this_present += " && (this." + name + " != null)"; - that_present += " && (that." + name + " != null)"; + if (is_optional || can_be_null) { + this_present += " && this." + generate_isset_check(*m_iter); + that_present += " && that." + generate_isset_check(*m_iter); } out << @@ -877,11 +874,8 @@ void t_java_generator::generate_java_struct_equality(ofstream& out, string present = "true"; - if (is_optional) { - present += " && (__isset." + name + ")"; - } - if (can_be_null) { - present += " && (" + name + " != null)"; + if (is_optional || can_be_null) { + present += " && (" + generate_isset_check(*m_iter) + ")"; } out << @@ -955,8 +949,7 @@ void t_java_generator::generate_java_struct_reader(ofstream& out, indent_up(); generate_deserialize_field(out, *f_iter, "this."); - out << - indent() << "this.__isset." << (*f_iter)->get_name() << " = true;" << endl; + generate_isset_set(out, *f_iter); indent_down(); out << indent() << "} else { " << endl << @@ -1084,8 +1077,7 @@ void t_java_generator::generate_java_struct_writer(ofstream& out, } bool optional = bean_style_ && (*f_iter)->get_req() == t_field::T_OPTIONAL; if (optional) { - out << - indent() << "if (this.__isset." << (*f_iter)->get_name() << ") {" << endl; + indent(out) << "if (" << generate_isset_check((*f_iter)) << ") {" << endl; indent_up(); } @@ -1146,21 +1138,13 @@ void t_java_generator::generate_java_struct_result_writer(ofstream& out, endl << indent() << "if "; } else { - out << - " else if "; + out << " else if "; } - out << - "(this.__isset." << (*f_iter)->get_name() << ") {" << endl; + out << "(this." << generate_isset_check(*f_iter) << ") {" << endl; + indent_up(); - - bool null_allowed = type_can_be_null((*f_iter)->get_type()); - if (null_allowed) { - out << - indent() << "if (this." << (*f_iter)->get_name() << " != null) {" << endl; - indent_up(); - } - + indent(out) << "oprot.writeFieldBegin(" << constant_name((*f_iter)->get_name()) << "_FIELD_DESC);" << endl; // Write field contents @@ -1170,11 +1154,6 @@ void t_java_generator::generate_java_struct_result_writer(ofstream& out, indent(out) << "oprot.writeFieldEnd();" << endl; - if (null_allowed) { - indent_down(); - indent(out) << "}" << endl; - } - indent_down(); indent(out) << "}"; } @@ -1285,7 +1264,7 @@ void t_java_generator::generate_generic_isset_method(std::ofstream& out, t_struc t_field* field = *f_iter; indent(out) << "case " << upcase_string(field->get_name()) << ":" << endl; indent_up(); - indent(out) << "return this.__isset." << field->get_name() << ";" << endl; + indent(out) << "return " << generate_isset_check(field) << ";" << endl; indent_down(); } @@ -1359,7 +1338,6 @@ void t_java_generator::generate_java_bean_boilerplate(ofstream& out, indent_down(); indent(out) << "}" << endl; indent(out) << "this." << field_name << ".add(elem);" << endl; - indent(out) << "this.__isset." << field_name << " = true;" << endl; indent_down(); indent(out) << "}" << endl << endl; @@ -1381,7 +1359,6 @@ void t_java_generator::generate_java_bean_boilerplate(ofstream& out, indent_down(); indent(out) << "}" << endl; indent(out) << "this." << field_name << ".put(key, val);" << endl; - indent(out) << "this.__isset." << field_name << " = true;" << endl; indent_down(); indent(out) << "}" << endl << endl; } @@ -1408,12 +1385,7 @@ void t_java_generator::generate_java_bean_boilerplate(ofstream& out, indent_up(); indent(out) << "this." << field_name << " = " << field_name << ";" << 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; - } + generate_isset_set(out, field); indent_down(); indent(out) << "}" << endl << endl; @@ -1421,10 +1393,11 @@ void t_java_generator::generate_java_bean_boilerplate(ofstream& out, // Unsetter indent(out) << "public void unset" << cap_name << "() {" << endl; indent_up(); - if (type->is_container() || type->is_struct() || type->is_xception()) { + if (type_can_be_null(type)) { indent(out) << "this." << field_name << " = null;" << endl; + } else { + indent(out) << "this.__isset." << field_name << " = false;" << endl; } - indent(out) << "this.__isset." << field_name << " = false;" << endl; indent_down(); indent(out) << "}" << endl << endl; @@ -1432,14 +1405,24 @@ void t_java_generator::generate_java_bean_boilerplate(ofstream& out, indent(out) << "// Returns true if field " << field_name << " is set (has been asigned a value) and false otherwise" << endl; indent(out) << "public boolean is" << get_cap_name("set") << cap_name << "() {" << endl; indent_up(); - indent(out) << "return this.__isset." << field_name << ";" << endl; + if (type_can_be_null(type)) { + indent(out) << "return this." << field_name << " != null;" << endl; + } else { + indent(out) << "return this.__isset." << field_name << ";" << endl; + } indent_down(); indent(out) << "}" << endl << endl; if(!bean_style_) { indent(out) << "public void set" << cap_name << get_cap_name("isSet") << "(boolean value) {" << endl; indent_up(); - indent(out) << "this.__isset." << field_name << " = value;" << endl; + if (type_can_be_null(type)) { + indent(out) << "if (!value) {" << endl; + indent(out) << " this." << field_name << " = null;" << endl; + indent(out) << "}" << endl; + } else { + indent(out) << "this.__isset." << field_name << " = value;" << endl; + } indent_down(); indent(out) << "}" << endl << endl; } @@ -1463,36 +1446,50 @@ void t_java_generator::generate_java_struct_tostring(ofstream& out, const vector& fields = tstruct->get_members(); vector::const_iterator f_iter; + bool first = true; for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) { - if((*f_iter)->get_req() == t_field::T_OPTIONAL) { - indent(out) << "if (__isset." << (*f_iter)->get_name() << ") {" << endl; + bool could_be_unset = (*f_iter)->get_req() == t_field::T_OPTIONAL; + if(could_be_unset) { + indent(out) << "if (" << generate_isset_check(*f_iter) << ") {" << endl; indent_up(); } t_field* field = (*f_iter); - indent(out) << "if (!first) sb.append(\", \");" << endl; + if (!first) { + indent(out) << "if (!first) sb.append(\", \");" << endl; + } indent(out) << "sb.append(\"" << (*f_iter)->get_name() << ":\");" << endl; - if (field->get_type()->is_base_type() && ((t_base_type*)(field->get_type()))->is_binary()) { - indent(out) << "if (" << field->get_name() << " == null) { " << endl; + bool can_be_null = type_can_be_null(field->get_type()); + if (can_be_null) { + indent(out) << "if (this." << (*f_iter)->get_name() << " == null) {" << endl; indent(out) << " sb.append(\"null\");" << endl; indent(out) << "} else {" << endl; + indent_up(); + } + + if (field->get_type()->is_base_type() && ((t_base_type*)(field->get_type()))->is_binary()) { indent(out) << " int __" << field->get_name() << "_size = Math.min(this." << field->get_name() << ".length, 128);" << endl; indent(out) << " for (int i = 0; i < __" << field->get_name() << "_size; i++) {" << endl; indent(out) << " if (i != 0) sb.append(\" \");" << endl; indent(out) << " sb.append(Integer.toHexString(this." << field->get_name() << "[i]).length() > 1 ? Integer.toHexString(this." << field->get_name() << "[i]).substring(Integer.toHexString(this." << field->get_name() << "[i]).length() - 2).toUpperCase() : \"0\" + Integer.toHexString(this." << field->get_name() << "[i]).toUpperCase());" <get_name() << ".length > 128) sb.append(\" ...\");" << endl; - indent(out) << "}" << endl; } else { indent(out) << "sb.append(this." << (*f_iter)->get_name() << ");" << endl; } - indent(out) << "first = false;" << endl; - - if((*f_iter)->get_req() == t_field::T_OPTIONAL) { + + if (can_be_null) { indent_down(); indent(out) << "}" << endl; } + indent(out) << "first = false;" << endl; + + if(could_be_unset) { + indent_down(); + indent(out) << "}" << endl; + } + first = false; } out << indent() << "sb.append(\")\");" << endl << @@ -1852,7 +1849,7 @@ void t_java_generator::generate_service_client(t_service* tservice) { // Careful, only return _result if not a void function if (!(*f_iter)->get_returntype()->is_void()) { f_service_ << - indent() << "if (result.__isset.success) {" << endl << + indent() << "if (result.isSetSuccess()) {" << endl << indent() << " return result.success;" << endl << indent() << "}" << endl; } @@ -1862,7 +1859,7 @@ void t_java_generator::generate_service_client(t_service* tservice) { vector::const_iterator x_iter; for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) { f_service_ << - indent() << "if (result.__isset." << (*x_iter)->get_name() << ") {" << endl << + indent() << "if (result." << (*x_iter)->get_name() << " != null) {" << endl << indent() << " throw result." << (*x_iter)->get_name() << ";" << endl << indent() << "}" << endl; } @@ -2078,7 +2075,7 @@ void t_java_generator::generate_process_function(t_service* tservice, f_service_ << ");" << endl; // Set isset on success field - if (!tfunction->is_async() && !tfunction->get_returntype()->is_void()) { + if (!tfunction->is_async() && !tfunction->get_returntype()->is_void() && !type_can_be_null(tfunction->get_returntype())) { f_service_ << indent() << "result.__isset.success = true;" << endl; } @@ -2091,8 +2088,7 @@ void t_java_generator::generate_process_function(t_service* tservice, if (!tfunction->is_async()) { indent_up(); f_service_ << - indent() << "result." << (*x_iter)->get_name() << " = " << (*x_iter)->get_name() << ";" << endl << - indent() << "result.__isset." << (*x_iter)->get_name() << " = true;" << endl; + indent() << "result." << (*x_iter)->get_name() << " = " << (*x_iter)->get_name() << ";" << endl; indent_down(); f_service_ << indent() << "}"; } else { @@ -2948,6 +2944,16 @@ void t_java_generator::generate_deep_copy_non_container(ofstream& out, std::stri } } +std::string t_java_generator::generate_isset_check(t_field* field) { + return "is" + get_cap_name("set") + get_cap_name(field->get_name()) + "()"; +} + +void t_java_generator::generate_isset_set(ofstream& out, t_field* field) { + if (!type_can_be_null(field->get_type())) { + indent(out) << "this.__isset." << field->get_name() << " = true;" << endl; + } +} + THRIFT_REGISTER_GENERATOR(java, "Java", " beans: Generate bean-style output files.\n" diff --git a/lib/java/test/org/apache/thrift/test/EqualityTest.java b/lib/java/test/org/apache/thrift/test/EqualityTest.java index 469f73122..5a1eea6a3 100644 --- a/lib/java/test/org/apache/thrift/test/EqualityTest.java +++ b/lib/java/test/org/apache/thrift/test/EqualityTest.java @@ -53,6 +53,10 @@ public class EqualityTest { issets = matrix for is_null in nulls: for is_set in issets: + # isset is implied for non-primitives, so only consider the case + # where isset and non-null match. + if type != 'int' and list(is_set) != [ not null for null in is_null ]: + continue for equal in (True, False): print >> out print >> out, " lhs = new JavaTestHelper();" @@ -60,8 +64,8 @@ public class EqualityTest { print >> out, " lhs." + option + "_" + type, "=", vals[type][0] + ";" print >> out, " rhs." + option + "_" + type, "=", vals[type][0 if equal else 1] + ";" isset_setter = "set" + option[0].upper() + option[1:] + "_" + type + "IsSet" - if (is_set[0]): print >> out, " lhs." + isset_setter + "(true);" - if (is_set[1]): print >> out, " rhs." + isset_setter + "(true);" + if (type == 'int' and is_set[0]): print >> out, " lhs." + isset_setter + "(true);" + if (type == 'int' and is_set[1]): print >> out, " rhs." + isset_setter + "(true);" if (is_null[0]): print >> out, " lhs." + option + "_" + type, "= null;" if (is_null[1]): print >> out, " rhs." + option + "_" + type, "= null;" this_present = not is_null[0] and (option == 'req' or is_set[0]) @@ -298,92 +302,6 @@ public class EqualityTest { if (lhs.hashCode() != rhs.hashCode()) throw new RuntimeException("Failure"); - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_obj = "foo"; - rhs.req_obj = "foo"; - rhs.setReq_objIsSet(true); - lhs.req_obj = null; - rhs.req_obj = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_obj = "foo"; - rhs.req_obj = "bar"; - rhs.setReq_objIsSet(true); - lhs.req_obj = null; - rhs.req_obj = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_obj = "foo"; - rhs.req_obj = "foo"; - lhs.setReq_objIsSet(true); - lhs.req_obj = null; - rhs.req_obj = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_obj = "foo"; - rhs.req_obj = "bar"; - lhs.setReq_objIsSet(true); - lhs.req_obj = null; - rhs.req_obj = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_obj = "foo"; - rhs.req_obj = "foo"; - lhs.setReq_objIsSet(true); - rhs.setReq_objIsSet(true); - lhs.req_obj = null; - rhs.req_obj = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_obj = "foo"; - rhs.req_obj = "bar"; - lhs.setReq_objIsSet(true); - rhs.setReq_objIsSet(true); - lhs.req_obj = null; - rhs.req_obj = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - lhs = new JavaTestHelper(); rhs = new JavaTestHelper(); lhs.req_obj = "foo"; @@ -404,74 +322,6 @@ public class EqualityTest { if (lhs.equals(rhs) != false) throw new RuntimeException("Failure"); - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_obj = "foo"; - rhs.req_obj = "foo"; - rhs.setReq_objIsSet(true); - lhs.req_obj = null; - // this_present = False - // that_present = True - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_obj = "foo"; - rhs.req_obj = "bar"; - rhs.setReq_objIsSet(true); - lhs.req_obj = null; - // this_present = False - // that_present = True - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_obj = "foo"; - rhs.req_obj = "foo"; - lhs.setReq_objIsSet(true); - lhs.req_obj = null; - // this_present = False - // that_present = True - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_obj = "foo"; - rhs.req_obj = "bar"; - lhs.setReq_objIsSet(true); - lhs.req_obj = null; - // this_present = False - // that_present = True - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_obj = "foo"; - rhs.req_obj = "foo"; - lhs.setReq_objIsSet(true); - rhs.setReq_objIsSet(true); - lhs.req_obj = null; - // this_present = False - // that_present = True - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_obj = "foo"; - rhs.req_obj = "bar"; - lhs.setReq_objIsSet(true); - rhs.setReq_objIsSet(true); - lhs.req_obj = null; - // this_present = False - // that_present = True - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - lhs = new JavaTestHelper(); rhs = new JavaTestHelper(); lhs.req_obj = "foo"; @@ -492,74 +342,6 @@ public class EqualityTest { if (lhs.equals(rhs) != false) throw new RuntimeException("Failure"); - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_obj = "foo"; - rhs.req_obj = "foo"; - rhs.setReq_objIsSet(true); - rhs.req_obj = null; - // this_present = True - // that_present = False - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_obj = "foo"; - rhs.req_obj = "bar"; - rhs.setReq_objIsSet(true); - rhs.req_obj = null; - // this_present = True - // that_present = False - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_obj = "foo"; - rhs.req_obj = "foo"; - lhs.setReq_objIsSet(true); - rhs.req_obj = null; - // this_present = True - // that_present = False - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_obj = "foo"; - rhs.req_obj = "bar"; - lhs.setReq_objIsSet(true); - rhs.req_obj = null; - // this_present = True - // that_present = False - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_obj = "foo"; - rhs.req_obj = "foo"; - lhs.setReq_objIsSet(true); - rhs.setReq_objIsSet(true); - rhs.req_obj = null; - // this_present = True - // that_present = False - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_obj = "foo"; - rhs.req_obj = "bar"; - lhs.setReq_objIsSet(true); - rhs.setReq_objIsSet(true); - rhs.req_obj = null; - // this_present = True - // that_present = False - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - lhs = new JavaTestHelper(); rhs = new JavaTestHelper(); lhs.req_obj = "foo"; @@ -580,74 +362,6 @@ public class EqualityTest { if (lhs.equals(rhs) != false) throw new RuntimeException("Failure"); - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_obj = "foo"; - rhs.req_obj = "foo"; - rhs.setReq_objIsSet(true); - // this_present = True - // that_present = True - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_obj = "foo"; - rhs.req_obj = "bar"; - rhs.setReq_objIsSet(true); - // this_present = True - // that_present = True - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_obj = "foo"; - rhs.req_obj = "foo"; - lhs.setReq_objIsSet(true); - // this_present = True - // that_present = True - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_obj = "foo"; - rhs.req_obj = "bar"; - lhs.setReq_objIsSet(true); - // this_present = True - // that_present = True - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_obj = "foo"; - rhs.req_obj = "foo"; - lhs.setReq_objIsSet(true); - rhs.setReq_objIsSet(true); - // this_present = True - // that_present = True - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_obj = "foo"; - rhs.req_obj = "bar"; - lhs.setReq_objIsSet(true); - rhs.setReq_objIsSet(true); - // this_present = True - // that_present = True - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - lhs = new JavaTestHelper(); rhs = new JavaTestHelper(); lhs.opt_obj = "foo"; @@ -678,117 +392,6 @@ public class EqualityTest { rhs = new JavaTestHelper(); lhs.opt_obj = "foo"; rhs.opt_obj = "foo"; - rhs.setOpt_objIsSet(true); - lhs.opt_obj = null; - rhs.opt_obj = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_obj = "foo"; - rhs.opt_obj = "bar"; - rhs.setOpt_objIsSet(true); - lhs.opt_obj = null; - rhs.opt_obj = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_obj = "foo"; - rhs.opt_obj = "foo"; - lhs.setOpt_objIsSet(true); - lhs.opt_obj = null; - rhs.opt_obj = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_obj = "foo"; - rhs.opt_obj = "bar"; - lhs.setOpt_objIsSet(true); - lhs.opt_obj = null; - rhs.opt_obj = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_obj = "foo"; - rhs.opt_obj = "foo"; - lhs.setOpt_objIsSet(true); - rhs.setOpt_objIsSet(true); - lhs.opt_obj = null; - rhs.opt_obj = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_obj = "foo"; - rhs.opt_obj = "bar"; - lhs.setOpt_objIsSet(true); - rhs.setOpt_objIsSet(true); - lhs.opt_obj = null; - rhs.opt_obj = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_obj = "foo"; - rhs.opt_obj = "foo"; - lhs.opt_obj = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_obj = "foo"; - rhs.opt_obj = "bar"; - lhs.opt_obj = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_obj = "foo"; - rhs.opt_obj = "foo"; - rhs.setOpt_objIsSet(true); lhs.opt_obj = null; // this_present = False // that_present = True @@ -799,57 +402,6 @@ public class EqualityTest { rhs = new JavaTestHelper(); lhs.opt_obj = "foo"; rhs.opt_obj = "bar"; - rhs.setOpt_objIsSet(true); - lhs.opt_obj = null; - // this_present = False - // that_present = True - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_obj = "foo"; - rhs.opt_obj = "foo"; - lhs.setOpt_objIsSet(true); - lhs.opt_obj = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_obj = "foo"; - rhs.opt_obj = "bar"; - lhs.setOpt_objIsSet(true); - lhs.opt_obj = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_obj = "foo"; - rhs.opt_obj = "foo"; - lhs.setOpt_objIsSet(true); - rhs.setOpt_objIsSet(true); - lhs.opt_obj = null; - // this_present = False - // that_present = True - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_obj = "foo"; - rhs.opt_obj = "bar"; - lhs.setOpt_objIsSet(true); - rhs.setOpt_objIsSet(true); lhs.opt_obj = null; // this_present = False // that_present = True @@ -861,57 +413,6 @@ public class EqualityTest { lhs.opt_obj = "foo"; rhs.opt_obj = "foo"; rhs.opt_obj = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_obj = "foo"; - rhs.opt_obj = "bar"; - rhs.opt_obj = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_obj = "foo"; - rhs.opt_obj = "foo"; - rhs.setOpt_objIsSet(true); - rhs.opt_obj = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_obj = "foo"; - rhs.opt_obj = "bar"; - rhs.setOpt_objIsSet(true); - rhs.opt_obj = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_obj = "foo"; - rhs.opt_obj = "foo"; - lhs.setOpt_objIsSet(true); - rhs.opt_obj = null; // this_present = True // that_present = False if (lhs.equals(rhs) != false) @@ -921,7 +422,6 @@ public class EqualityTest { rhs = new JavaTestHelper(); lhs.opt_obj = "foo"; rhs.opt_obj = "bar"; - lhs.setOpt_objIsSet(true); rhs.opt_obj = null; // this_present = True // that_present = False @@ -932,94 +432,6 @@ public class EqualityTest { rhs = new JavaTestHelper(); lhs.opt_obj = "foo"; rhs.opt_obj = "foo"; - lhs.setOpt_objIsSet(true); - rhs.setOpt_objIsSet(true); - rhs.opt_obj = null; - // this_present = True - // that_present = False - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_obj = "foo"; - rhs.opt_obj = "bar"; - lhs.setOpt_objIsSet(true); - rhs.setOpt_objIsSet(true); - rhs.opt_obj = null; - // this_present = True - // that_present = False - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_obj = "foo"; - rhs.opt_obj = "foo"; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_obj = "foo"; - rhs.opt_obj = "bar"; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_obj = "foo"; - rhs.opt_obj = "foo"; - rhs.setOpt_objIsSet(true); - // this_present = False - // that_present = True - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_obj = "foo"; - rhs.opt_obj = "bar"; - rhs.setOpt_objIsSet(true); - // this_present = False - // that_present = True - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_obj = "foo"; - rhs.opt_obj = "foo"; - lhs.setOpt_objIsSet(true); - // this_present = True - // that_present = False - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_obj = "foo"; - rhs.opt_obj = "bar"; - lhs.setOpt_objIsSet(true); - // this_present = True - // that_present = False - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_obj = "foo"; - rhs.opt_obj = "foo"; - lhs.setOpt_objIsSet(true); - rhs.setOpt_objIsSet(true); // this_present = True // that_present = True if (lhs.equals(rhs) != true) @@ -1031,8 +443,6 @@ public class EqualityTest { rhs = new JavaTestHelper(); lhs.opt_obj = "foo"; rhs.opt_obj = "bar"; - lhs.setOpt_objIsSet(true); - rhs.setOpt_objIsSet(true); // this_present = True // that_present = True if (lhs.equals(rhs) != false) @@ -1064,92 +474,6 @@ public class EqualityTest { if (lhs.hashCode() != rhs.hashCode()) throw new RuntimeException("Failure"); - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_bin = new byte[]{1,2}; - rhs.req_bin = new byte[]{1,2}; - rhs.setReq_binIsSet(true); - lhs.req_bin = null; - rhs.req_bin = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_bin = new byte[]{1,2}; - rhs.req_bin = new byte[]{3,4}; - rhs.setReq_binIsSet(true); - lhs.req_bin = null; - rhs.req_bin = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_bin = new byte[]{1,2}; - rhs.req_bin = new byte[]{1,2}; - lhs.setReq_binIsSet(true); - lhs.req_bin = null; - rhs.req_bin = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_bin = new byte[]{1,2}; - rhs.req_bin = new byte[]{3,4}; - lhs.setReq_binIsSet(true); - lhs.req_bin = null; - rhs.req_bin = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_bin = new byte[]{1,2}; - rhs.req_bin = new byte[]{1,2}; - lhs.setReq_binIsSet(true); - rhs.setReq_binIsSet(true); - lhs.req_bin = null; - rhs.req_bin = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_bin = new byte[]{1,2}; - rhs.req_bin = new byte[]{3,4}; - lhs.setReq_binIsSet(true); - rhs.setReq_binIsSet(true); - lhs.req_bin = null; - rhs.req_bin = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - lhs = new JavaTestHelper(); rhs = new JavaTestHelper(); lhs.req_bin = new byte[]{1,2}; @@ -1170,74 +494,6 @@ public class EqualityTest { if (lhs.equals(rhs) != false) throw new RuntimeException("Failure"); - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_bin = new byte[]{1,2}; - rhs.req_bin = new byte[]{1,2}; - rhs.setReq_binIsSet(true); - lhs.req_bin = null; - // this_present = False - // that_present = True - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_bin = new byte[]{1,2}; - rhs.req_bin = new byte[]{3,4}; - rhs.setReq_binIsSet(true); - lhs.req_bin = null; - // this_present = False - // that_present = True - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_bin = new byte[]{1,2}; - rhs.req_bin = new byte[]{1,2}; - lhs.setReq_binIsSet(true); - lhs.req_bin = null; - // this_present = False - // that_present = True - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_bin = new byte[]{1,2}; - rhs.req_bin = new byte[]{3,4}; - lhs.setReq_binIsSet(true); - lhs.req_bin = null; - // this_present = False - // that_present = True - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_bin = new byte[]{1,2}; - rhs.req_bin = new byte[]{1,2}; - lhs.setReq_binIsSet(true); - rhs.setReq_binIsSet(true); - lhs.req_bin = null; - // this_present = False - // that_present = True - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_bin = new byte[]{1,2}; - rhs.req_bin = new byte[]{3,4}; - lhs.setReq_binIsSet(true); - rhs.setReq_binIsSet(true); - lhs.req_bin = null; - // this_present = False - // that_present = True - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - lhs = new JavaTestHelper(); rhs = new JavaTestHelper(); lhs.req_bin = new byte[]{1,2}; @@ -1258,74 +514,6 @@ public class EqualityTest { if (lhs.equals(rhs) != false) throw new RuntimeException("Failure"); - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_bin = new byte[]{1,2}; - rhs.req_bin = new byte[]{1,2}; - rhs.setReq_binIsSet(true); - rhs.req_bin = null; - // this_present = True - // that_present = False - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_bin = new byte[]{1,2}; - rhs.req_bin = new byte[]{3,4}; - rhs.setReq_binIsSet(true); - rhs.req_bin = null; - // this_present = True - // that_present = False - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_bin = new byte[]{1,2}; - rhs.req_bin = new byte[]{1,2}; - lhs.setReq_binIsSet(true); - rhs.req_bin = null; - // this_present = True - // that_present = False - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_bin = new byte[]{1,2}; - rhs.req_bin = new byte[]{3,4}; - lhs.setReq_binIsSet(true); - rhs.req_bin = null; - // this_present = True - // that_present = False - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_bin = new byte[]{1,2}; - rhs.req_bin = new byte[]{1,2}; - lhs.setReq_binIsSet(true); - rhs.setReq_binIsSet(true); - rhs.req_bin = null; - // this_present = True - // that_present = False - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_bin = new byte[]{1,2}; - rhs.req_bin = new byte[]{3,4}; - lhs.setReq_binIsSet(true); - rhs.setReq_binIsSet(true); - rhs.req_bin = null; - // this_present = True - // that_present = False - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - lhs = new JavaTestHelper(); rhs = new JavaTestHelper(); lhs.req_bin = new byte[]{1,2}; @@ -1346,74 +534,6 @@ public class EqualityTest { if (lhs.equals(rhs) != false) throw new RuntimeException("Failure"); - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_bin = new byte[]{1,2}; - rhs.req_bin = new byte[]{1,2}; - rhs.setReq_binIsSet(true); - // this_present = True - // that_present = True - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_bin = new byte[]{1,2}; - rhs.req_bin = new byte[]{3,4}; - rhs.setReq_binIsSet(true); - // this_present = True - // that_present = True - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_bin = new byte[]{1,2}; - rhs.req_bin = new byte[]{1,2}; - lhs.setReq_binIsSet(true); - // this_present = True - // that_present = True - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_bin = new byte[]{1,2}; - rhs.req_bin = new byte[]{3,4}; - lhs.setReq_binIsSet(true); - // this_present = True - // that_present = True - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_bin = new byte[]{1,2}; - rhs.req_bin = new byte[]{1,2}; - lhs.setReq_binIsSet(true); - rhs.setReq_binIsSet(true); - // this_present = True - // that_present = True - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.req_bin = new byte[]{1,2}; - rhs.req_bin = new byte[]{3,4}; - lhs.setReq_binIsSet(true); - rhs.setReq_binIsSet(true); - // this_present = True - // that_present = True - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - lhs = new JavaTestHelper(); rhs = new JavaTestHelper(); lhs.opt_bin = new byte[]{1,2}; @@ -1444,117 +564,6 @@ public class EqualityTest { rhs = new JavaTestHelper(); lhs.opt_bin = new byte[]{1,2}; rhs.opt_bin = new byte[]{1,2}; - rhs.setOpt_binIsSet(true); - lhs.opt_bin = null; - rhs.opt_bin = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_bin = new byte[]{1,2}; - rhs.opt_bin = new byte[]{3,4}; - rhs.setOpt_binIsSet(true); - lhs.opt_bin = null; - rhs.opt_bin = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_bin = new byte[]{1,2}; - rhs.opt_bin = new byte[]{1,2}; - lhs.setOpt_binIsSet(true); - lhs.opt_bin = null; - rhs.opt_bin = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_bin = new byte[]{1,2}; - rhs.opt_bin = new byte[]{3,4}; - lhs.setOpt_binIsSet(true); - lhs.opt_bin = null; - rhs.opt_bin = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_bin = new byte[]{1,2}; - rhs.opt_bin = new byte[]{1,2}; - lhs.setOpt_binIsSet(true); - rhs.setOpt_binIsSet(true); - lhs.opt_bin = null; - rhs.opt_bin = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_bin = new byte[]{1,2}; - rhs.opt_bin = new byte[]{3,4}; - lhs.setOpt_binIsSet(true); - rhs.setOpt_binIsSet(true); - lhs.opt_bin = null; - rhs.opt_bin = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_bin = new byte[]{1,2}; - rhs.opt_bin = new byte[]{1,2}; - lhs.opt_bin = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_bin = new byte[]{1,2}; - rhs.opt_bin = new byte[]{3,4}; - lhs.opt_bin = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_bin = new byte[]{1,2}; - rhs.opt_bin = new byte[]{1,2}; - rhs.setOpt_binIsSet(true); lhs.opt_bin = null; // this_present = False // that_present = True @@ -1565,57 +574,6 @@ public class EqualityTest { rhs = new JavaTestHelper(); lhs.opt_bin = new byte[]{1,2}; rhs.opt_bin = new byte[]{3,4}; - rhs.setOpt_binIsSet(true); - lhs.opt_bin = null; - // this_present = False - // that_present = True - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_bin = new byte[]{1,2}; - rhs.opt_bin = new byte[]{1,2}; - lhs.setOpt_binIsSet(true); - lhs.opt_bin = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_bin = new byte[]{1,2}; - rhs.opt_bin = new byte[]{3,4}; - lhs.setOpt_binIsSet(true); - lhs.opt_bin = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_bin = new byte[]{1,2}; - rhs.opt_bin = new byte[]{1,2}; - lhs.setOpt_binIsSet(true); - rhs.setOpt_binIsSet(true); - lhs.opt_bin = null; - // this_present = False - // that_present = True - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_bin = new byte[]{1,2}; - rhs.opt_bin = new byte[]{3,4}; - lhs.setOpt_binIsSet(true); - rhs.setOpt_binIsSet(true); lhs.opt_bin = null; // this_present = False // that_present = True @@ -1627,57 +585,6 @@ public class EqualityTest { lhs.opt_bin = new byte[]{1,2}; rhs.opt_bin = new byte[]{1,2}; rhs.opt_bin = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_bin = new byte[]{1,2}; - rhs.opt_bin = new byte[]{3,4}; - rhs.opt_bin = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_bin = new byte[]{1,2}; - rhs.opt_bin = new byte[]{1,2}; - rhs.setOpt_binIsSet(true); - rhs.opt_bin = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_bin = new byte[]{1,2}; - rhs.opt_bin = new byte[]{3,4}; - rhs.setOpt_binIsSet(true); - rhs.opt_bin = null; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_bin = new byte[]{1,2}; - rhs.opt_bin = new byte[]{1,2}; - lhs.setOpt_binIsSet(true); - rhs.opt_bin = null; // this_present = True // that_present = False if (lhs.equals(rhs) != false) @@ -1687,7 +594,6 @@ public class EqualityTest { rhs = new JavaTestHelper(); lhs.opt_bin = new byte[]{1,2}; rhs.opt_bin = new byte[]{3,4}; - lhs.setOpt_binIsSet(true); rhs.opt_bin = null; // this_present = True // that_present = False @@ -1698,94 +604,6 @@ public class EqualityTest { rhs = new JavaTestHelper(); lhs.opt_bin = new byte[]{1,2}; rhs.opt_bin = new byte[]{1,2}; - lhs.setOpt_binIsSet(true); - rhs.setOpt_binIsSet(true); - rhs.opt_bin = null; - // this_present = True - // that_present = False - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_bin = new byte[]{1,2}; - rhs.opt_bin = new byte[]{3,4}; - lhs.setOpt_binIsSet(true); - rhs.setOpt_binIsSet(true); - rhs.opt_bin = null; - // this_present = True - // that_present = False - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_bin = new byte[]{1,2}; - rhs.opt_bin = new byte[]{1,2}; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_bin = new byte[]{1,2}; - rhs.opt_bin = new byte[]{3,4}; - // this_present = False - // that_present = False - if (lhs.equals(rhs) != true) - throw new RuntimeException("Failure"); - if (lhs.hashCode() != rhs.hashCode()) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_bin = new byte[]{1,2}; - rhs.opt_bin = new byte[]{1,2}; - rhs.setOpt_binIsSet(true); - // this_present = False - // that_present = True - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_bin = new byte[]{1,2}; - rhs.opt_bin = new byte[]{3,4}; - rhs.setOpt_binIsSet(true); - // this_present = False - // that_present = True - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_bin = new byte[]{1,2}; - rhs.opt_bin = new byte[]{1,2}; - lhs.setOpt_binIsSet(true); - // this_present = True - // that_present = False - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_bin = new byte[]{1,2}; - rhs.opt_bin = new byte[]{3,4}; - lhs.setOpt_binIsSet(true); - // this_present = True - // that_present = False - if (lhs.equals(rhs) != false) - throw new RuntimeException("Failure"); - - lhs = new JavaTestHelper(); - rhs = new JavaTestHelper(); - lhs.opt_bin = new byte[]{1,2}; - rhs.opt_bin = new byte[]{1,2}; - lhs.setOpt_binIsSet(true); - rhs.setOpt_binIsSet(true); // this_present = True // that_present = True if (lhs.equals(rhs) != true) @@ -1797,8 +615,6 @@ public class EqualityTest { rhs = new JavaTestHelper(); lhs.opt_bin = new byte[]{1,2}; rhs.opt_bin = new byte[]{3,4}; - lhs.setOpt_binIsSet(true); - rhs.setOpt_binIsSet(true); // this_present = True // that_present = True if (lhs.equals(rhs) != false) diff --git a/lib/java/test/org/apache/thrift/test/ToStringTest.java b/lib/java/test/org/apache/thrift/test/ToStringTest.java index 3345028ae..eb99a3841 100644 --- a/lib/java/test/org/apache/thrift/test/ToStringTest.java +++ b/lib/java/test/org/apache/thrift/test/ToStringTest.java @@ -66,7 +66,7 @@ public class ToStringTest { if (!object.toString().equals( - "JavaTestHelper(req_int:0, req_obj:, req_bin:, opt_bin:null)")) { + "JavaTestHelper(req_int:0, req_obj:, req_bin:)")) { throw new RuntimeException(); } }