From 986d50fc718f06b234cf59effd9d374678801557 Mon Sep 17 00:00:00 2001 From: Bryan Duxbury Date: Thu, 31 Dec 2009 18:18:00 +0000 Subject: [PATCH] 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. git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@894919 13f79535-47bb-0310-9956-ffa450edef68 --- compiler/cpp/src/generate/t_java_generator.cc | 2 +- test/DebugProtoTest.thrift | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/compiler/cpp/src/generate/t_java_generator.cc b/compiler/cpp/src/generate/t_java_generator.cc index 09d2fd1e..da1e1c69 100644 --- a/compiler/cpp/src/generate/t_java_generator.cc +++ b/compiler/cpp/src/generate/t_java_generator.cc @@ -3570,7 +3570,7 @@ bool t_java_generator::is_comparable(t_type* type) { } 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; diff --git a/test/DebugProtoTest.thrift b/test/DebugProtoTest.thrift index 6a9c7855..6731e5e4 100644 --- a/test/DebugProtoTest.thrift +++ b/test/DebugProtoTest.thrift @@ -216,6 +216,16 @@ const CompactProtoTestStruct COMPACT_TEST = { const i32 MYCONST = 2 + +exception ExceptionWithAMap { + 1: string blah; + 2: map map_field; +} + +service ServiceForExceptionWithAMap { + void methodThatThrowsAnException() throws (1: ExceptionWithAMap xwamap); +} + service Srv { i32 Janky(1: i32 arg); @@ -308,4 +318,4 @@ typedef map SomeMap struct StructWithASomemap { 1: required SomeMap somemap_field; -} \ No newline at end of file +} -- 2.17.1