THRIFT-565. java: Structs containing typedefs for incomparable objects will be considered comparable
This patch causes the compiler to fully unwrap typedefs when determining comparability.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@834119 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 14d4878..e330099 100644
--- a/compiler/cpp/src/generate/t_java_generator.cc
+++ b/compiler/cpp/src/generate/t_java_generator.cc
@@ -3523,7 +3523,7 @@
   vector<t_field*>::const_iterator m_iter;
 
   for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
-    if (!is_comparable((*m_iter)->get_type())) {
+    if (!is_comparable(get_true_type((*m_iter)->get_type()))) {
       return false;
     }
   }
@@ -3533,7 +3533,7 @@
 bool t_java_generator::is_comparable(t_type* type) {
   if (type->is_container()) {
     if (type->is_list()) {
-      return is_comparable(((t_list*)type)->get_elem_type());
+      return is_comparable(get_true_type(((t_list*)type)->get_elem_type()));
     } else {
       return false;
     }
@@ -3549,11 +3549,11 @@
   vector<t_field*>::const_iterator m_iter;
 
   for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
-    if (!type_can_be_null((*m_iter)->get_type())) {
+    if (!type_can_be_null(get_true_type((*m_iter)->get_type()))) {
       return true;
     }
   }
-  return false;  
+  return false;
 }
 
 THRIFT_REGISTER_GENERATOR(java, "Java",
diff --git a/lib/java/build.xml b/lib/java/build.xml
index c626948..1694414 100644
--- a/lib/java/build.xml
+++ b/lib/java/build.xml
@@ -187,16 +187,16 @@
   </target>
 
   <target name="generate">
-    <exec executable="../../compiler/cpp/thrift">
+    <exec executable="../../compiler/cpp/thrift" failonerror="true">
       <arg line="--gen java:hashcode ${test.thrift.home}/ThriftTest.thrift" />
     </exec>
-    <exec executable="../../compiler/cpp/thrift">
+    <exec executable="../../compiler/cpp/thrift" failonerror="true">
       <arg line="--gen java:hashcode ${test.thrift.home}/DebugProtoTest.thrift" />
     </exec>
-    <exec executable="../../compiler/cpp/thrift">
+    <exec executable="../../compiler/cpp/thrift" failonerror="true">
       <arg line="--gen java:hashcode ${test.thrift.home}/OptionalRequiredTest.thrift" />
     </exec>
-    <exec executable="../../compiler/cpp/thrift">
+    <exec executable="../../compiler/cpp/thrift" failonerror="true">
       <arg line="--gen java:beans,nocamel ${test.thrift.home}/JavaBeansTest.thrift" />
     </exec>
   </target>
diff --git a/test/DebugProtoTest.thrift b/test/DebugProtoTest.thrift
index 9b3952e..48df1fc 100644
--- a/test/DebugProtoTest.thrift
+++ b/test/DebugProtoTest.thrift
@@ -271,4 +271,10 @@
   1: i32 blah;
   2: i32 blah2;
   3: Backwards bw;
+}
+
+typedef map<i32,i32> SomeMap
+
+struct StructWithASomemap {
+  1: required SomeMap somemap_field;
 }
\ No newline at end of file