From: Bryan Duxbury Date: Mon, 21 Sep 2009 16:52:48 +0000 (+0000) Subject: THRIFT-572. java: Union compareTo is broken X-Git-Tag: 0.2.0~29 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=db40d26f4a61c1c2ae04997a6cc475bfd585d3e4;p=common%2Fthrift.git THRIFT-572. java: Union compareTo is broken git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@817317 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/compiler/cpp/src/generate/t_java_generator.cc b/compiler/cpp/src/generate/t_java_generator.cc index 427e6546..4166f3c7 100644 --- a/compiler/cpp/src/generate/t_java_generator.cc +++ b/compiler/cpp/src/generate/t_java_generator.cc @@ -960,7 +960,7 @@ void t_java_generator::generate_union_comparisons(ofstream& out, t_struct* tstru indent(out) << "@Override" << endl; indent(out) << "public int compareTo(" << type_name(tstruct) << " other) {" << endl; indent(out) << " int lastComparison = TBaseHelper.compareTo(getSetField(), other.getSetField());" << endl; - indent(out) << " if (lastComparison != 0) {" << endl; + indent(out) << " if (lastComparison == 0) {" << endl; indent(out) << " return TBaseHelper.compareTo((Comparable)getFieldValue(), (Comparable)other.getFieldValue());" << endl; indent(out) << " }" << endl; indent(out) << " return lastComparison;" << endl;