THRIFT-5711: Fix FutureClient implementation when service extends another service (#2810)
* Fix FutureClient implementation when service extends another service
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
diff --git a/compiler/cpp/src/thrift/generate/t_java_generator.cc b/compiler/cpp/src/thrift/generate/t_java_generator.cc
index 6a2211f..2cfce5b 100644
--- a/compiler/cpp/src/thrift/generate/t_java_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_java_generator.cc
@@ -3366,8 +3366,14 @@
}
void t_java_generator::generate_service_future_client(t_service* tservice) {
+ string extends_client = "";
+ if (tservice->get_extends() != nullptr) {
+ extends_client = "extends " + type_name(tservice->get_extends()) + ".FutureClient ";
+ }
+
static string adapter_class = "org.apache.thrift.async.AsyncMethodFutureAdapter";
- indent(f_service_) << "public static class FutureClient implements FutureIface {" << endl;
+ indent(f_service_) << "public static class FutureClient " << extends_client
+ << "implements FutureIface {" << endl;
indent_up();
indent(f_service_) << "public FutureClient(AsyncIface delegate) {" << endl;
indent_up();