You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by br...@apache.org on 2009/12/31 19:18:00 UTC

svn commit: r894919 - in /incubator/thrift/trunk: compiler/cpp/src/generate/t_java_generator.cc test/DebugProtoTest.thrift

Author: bryanduxbury
Date: Thu Dec 31 18:18:00 2009
New Revision: 894919

URL: http://svn.apache.org/viewvc?rev=894919&view=rev
Log:
THRIFT-668. java: Using a map in an exception type will generate a class that does not implement Comperable-> that will generate a stub that does not compile

The compiler was incorrectly assuming that exceptions were comparable. Now, exceptions are treated just like structs.

Modified:
    incubator/thrift/trunk/compiler/cpp/src/generate/t_java_generator.cc
    incubator/thrift/trunk/test/DebugProtoTest.thrift

Modified: incubator/thrift/trunk/compiler/cpp/src/generate/t_java_generator.cc
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/generate/t_java_generator.cc?rev=894919&r1=894918&r2=894919&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/generate/t_java_generator.cc (original)
+++ incubator/thrift/trunk/compiler/cpp/src/generate/t_java_generator.cc Thu Dec 31 18:18:00 2009
@@ -3570,7 +3570,7 @@
     } else {
       return false;
     }
-  } else if (type->is_struct()) {
+  } else if (type->is_struct() || type->is_xception()) {
     return is_comparable((t_struct*)type);
   } else {
     return true;

Modified: incubator/thrift/trunk/test/DebugProtoTest.thrift
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/test/DebugProtoTest.thrift?rev=894919&r1=894918&r2=894919&view=diff
==============================================================================
--- incubator/thrift/trunk/test/DebugProtoTest.thrift (original)
+++ incubator/thrift/trunk/test/DebugProtoTest.thrift Thu Dec 31 18:18:00 2009
@@ -216,6 +216,16 @@
 
 const i32 MYCONST = 2
 
+
+exception ExceptionWithAMap {
+  1: string blah;
+  2: map<string, string> map_field;
+}
+
+service ServiceForExceptionWithAMap {
+  void methodThatThrowsAnException() throws (1: ExceptionWithAMap xwamap);
+}
+
 service Srv {
   i32 Janky(1: i32 arg);
   
@@ -308,4 +318,4 @@
 
 struct StructWithASomemap {
   1: required SomeMap somemap_field;
-}
\ No newline at end of file
+}