Add support for .equals() to Java structs.
authorDavid Reiss <dreiss@apache.org>
Sun, 2 Mar 2008 06:29:19 +0000 (06:29 +0000)
committerDavid Reiss <dreiss@apache.org>
Sun, 2 Mar 2008 06:29:19 +0000 (06:29 +0000)
commit3b15ebc251adc63d9c330c50e9a399e8117bdf35
treed86c65190ef84faf4ccdb3d557fba6aadfbda11c
parentd2a3e566b7814cfe176dd988854f6b3dca6a47d7
Add support for .equals() to Java structs.

- Add a new method to t_java_generator that generates a .equals() method.
- Add a correct but useless implementation of hashCode for structs.
  (This is required by conventino when overriding .equals().)
- Add java_package to DebugProtoTest and OptionalRequiredTest.
- Add a new structure to OptionalRequiredTest to assist testing the behavior
  of .equals() with respect to null and unset fields.
- Clean up test/java/build.xml a bit.  (It still has a ways to go.)
- Add EqualityTest.java to test .equals().
- Add IdentityTest.java to test that writing and reading a structure
  preserves equality.

Tested by runnint atn test.
I also looked at the generated code for OptionalRequiredTest.thrift.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665541 13f79535-47bb-0310-9956-ffa450edef68
compiler/cpp/src/generate/t_java_generator.cc
test/DebugProtoTest.thrift
test/OptionalRequiredTest.thrift
test/java/build.xml
test/java/src/EqualityTest.java [new file with mode: 0644]
test/java/src/IdentityTest.java [new file with mode: 0644]