THRIFT-628. java: Hash code method for _Fields objects does not behave as expected
authorBryan Duxbury <bryanduxbury@apache.org>
Tue, 17 Nov 2009 21:56:43 +0000 (21:56 +0000)
committerBryan Duxbury <bryanduxbury@apache.org>
Tue, 17 Nov 2009 21:56:43 +0000 (21:56 +0000)
This patch switches to using the hashcode of the actual field id, instead of the field id enumeration.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@881559 13f79535-47bb-0310-9956-ffa450edef68

compiler/cpp/src/generate/t_java_generator.cc

index e3f5449..8381f8e 100644 (file)
@@ -985,7 +985,7 @@ void t_java_generator::generate_union_hashcode(ofstream& out, t_struct* tstruct)
   if (gen_hash_code_) {
     indent(out) << "@Override" << endl;
     indent(out) << "public int hashCode() {" << endl;
-    indent(out) << "  return new HashCodeBuilder().append(getSetField()).append(getFieldValue()).toHashCode();" << endl;
+    indent(out) << "  return new HashCodeBuilder().append(getSetField().getThriftFieldId()).append(getFieldValue()).toHashCode();" << endl;
     indent(out) << "}";
   } else {
     indent(out) << "/**" << endl;