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
diff --git a/test/java/build.xml b/test/java/build.xml
index 9d7fb06..68d7b98 100644
--- a/test/java/build.xml
+++ b/test/java/build.xml
@@ -16,20 +16,26 @@
     <exec executable="../../compiler/cpp/thrift">
       <arg line="--gen java ../ThriftTest.thrift" />
     </exec>
-  </target>
-
-  <target name="compile" depends="init,generate">
-    <javac srcdir="${gen}" destdir="${build}" classpath="${cpath}" />
-    <javac srcdir="${src}" destdir="${build}" classpath="${cpath}:${gen}" />
+    <exec executable="../../compiler/cpp/thrift">
+      <arg line="--gen java ../DebugProtoTest.thrift" />
+    </exec>
+    <exec executable="../../compiler/cpp/thrift">
+      <arg line="--gen java ../OptionalRequiredTest.thrift" />
+    </exec>
   </target>
 
   <target name="compileonly">
-    <javac srcdir="${gen}" destdir="${build}" classpath="${cpath}" />
-    <javac srcdir="${src}" destdir="${build}" classpath="${cpath}:${gen}" />
+    <javac debug="true" srcdir="${gen}" destdir="${build}" classpath="${cpath}" />
+    <javac debug="true" srcdir="${src}" destdir="${build}" classpath="${cpath}:${gen}" />
+  </target>
+
+  <target name="compile" depends="init,generate,compileonly">
+    <jar jarfile="thrifttest.jar" basedir="${build}"/>
   </target>
 
   <target name="test" depends="compile">
-    <jar jarfile="thrifttest.jar" basedir="${build}"/>
+    <java classname="com.facebook.thrift.test.IdentityTest" classpath="${cpath}:./thrifttest.jar"/>
+    <java classname="com.facebook.thrift.test.EqualityTest" classpath="${cpath}:./thrifttest.jar"/>
   </target>
 
   <target name="clean">