Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: third_party/protobuf/src/google/protobuf/compiler/java/java_service.cc

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Update to new HEAD (b7632464b4) + restore GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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"

Powered by Google App Engine
This is Rietveld 408576698