| Index: third_party/protobuf/src/google/protobuf/compiler/java/java_service.cc
|
| diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/java_service.cc b/third_party/protobuf/src/google/protobuf/compiler/java/java_service.cc
|
| index 11bfc12d1b306c11c8d88083101f738a53cfcbd4..cfa8295d1363079df891029c8557a5c0c898b0a7 100644
|
| --- a/third_party/protobuf/src/google/protobuf/compiler/java/java_service.cc
|
| +++ b/third_party/protobuf/src/google/protobuf/compiler/java/java_service.cc
|
| @@ -60,9 +60,10 @@ ImmutableServiceGenerator::ImmutableServiceGenerator(
|
| ImmutableServiceGenerator::~ImmutableServiceGenerator() {}
|
|
|
| void ImmutableServiceGenerator::Generate(io::Printer* printer) {
|
| - bool is_own_file =
|
| - MultipleJavaFiles(descriptor_->file(), /* immutable = */ true);
|
| + bool is_own_file = IsOwnFile(descriptor_, /* immutable = */ true);
|
| WriteServiceDocComment(printer, descriptor_);
|
| + MaybePrintGeneratedAnnotation(context_, printer, descriptor_,
|
| + /* immutable = */ true);
|
| printer->Print(
|
| "public $static$ abstract class $classname$\n"
|
| " implements com.google.protobuf.Service {\n",
|
| @@ -183,6 +184,10 @@ void ImmutableServiceGenerator::GenerateAbstractMethods(io::Printer* printer) {
|
| }
|
| }
|
|
|
| +string ImmutableServiceGenerator::GetOutput(const MethodDescriptor* method) {
|
| + return name_resolver_->GetImmutableClassName(method->output_type());
|
| +}
|
| +
|
| void ImmutableServiceGenerator::GenerateCallMethod(io::Printer* printer) {
|
| printer->Print(
|
| "\n"
|
| @@ -208,8 +213,7 @@ void ImmutableServiceGenerator::GenerateCallMethod(io::Printer* printer) {
|
| vars["method"] = UnderscoresToCamelCase(method);
|
| vars["input"] = name_resolver_->GetImmutableClassName(
|
| method->input_type());
|
| - vars["output"] = name_resolver_->GetImmutableClassName(
|
| - method->output_type());
|
| + vars["output"] = GetOutput(method);
|
| printer->Print(vars,
|
| "case $index$:\n"
|
| " this.$method$(controller, ($input$)request,\n"
|
| @@ -256,8 +260,7 @@ void ImmutableServiceGenerator::GenerateCallBlockingMethod(
|
| vars["method"] = UnderscoresToCamelCase(method);
|
| vars["input"] = name_resolver_->GetImmutableClassName(
|
| method->input_type());
|
| - vars["output"] = name_resolver_->GetImmutableClassName(
|
| - method->output_type());
|
| + vars["output"] = GetOutput(method);
|
| printer->Print(vars,
|
| "case $index$:\n"
|
| " return impl.$method$(controller, ($input$)request);\n");
|
| @@ -352,8 +355,7 @@ void ImmutableServiceGenerator::GenerateStub(io::Printer* printer) {
|
|
|
| map<string, string> vars;
|
| vars["index"] = SimpleItoa(i);
|
| - vars["output"] = name_resolver_->GetImmutableClassName(
|
| - method->output_type());
|
| + vars["output"] = GetOutput(method);
|
| printer->Print(vars,
|
| "channel.callMethod(\n"
|
| " getDescriptor().getMethods().get($index$),\n"
|
| @@ -417,8 +419,7 @@ void ImmutableServiceGenerator::GenerateBlockingStub(io::Printer* printer) {
|
|
|
| map<string, string> vars;
|
| vars["index"] = SimpleItoa(i);
|
| - vars["output"] = name_resolver_->GetImmutableClassName(
|
| - method->output_type());
|
| + vars["output"] = GetOutput(method);
|
| printer->Print(vars,
|
| "return ($output$) channel.callBlockingMethod(\n"
|
| " getDescriptor().getMethods().get($index$),\n"
|
| @@ -442,7 +443,7 @@ void ImmutableServiceGenerator::GenerateMethodSignature(io::Printer* printer,
|
| map<string, string> vars;
|
| vars["name"] = UnderscoresToCamelCase(method);
|
| vars["input"] = name_resolver_->GetImmutableClassName(method->input_type());
|
| - vars["output"] = name_resolver_->GetImmutableClassName(method->output_type());
|
| + vars["output"] = GetOutput(method);
|
| vars["abstract"] = (is_abstract == IS_ABSTRACT) ? "abstract" : "";
|
| printer->Print(vars,
|
| "public $abstract$ void $name$(\n"
|
| @@ -457,7 +458,7 @@ void ImmutableServiceGenerator::GenerateBlockingMethodSignature(
|
| map<string, string> vars;
|
| vars["method"] = UnderscoresToCamelCase(method);
|
| vars["input"] = name_resolver_->GetImmutableClassName(method->input_type());
|
| - vars["output"] = name_resolver_->GetImmutableClassName(method->output_type());
|
| + vars["output"] = GetOutput(method);
|
| printer->Print(vars,
|
| "\n"
|
| "public $output$ $method$(\n"
|
|
|