diff options
| author | nechda <[email protected]> | 2024-08-29 23:50:27 +0300 | 
|---|---|---|
| committer | nechda <[email protected]> | 2024-08-30 00:05:25 +0300 | 
| commit | e10d6638f07a82edae3ea8197b9f5c0affcc07ea (patch) | |
| tree | 571c38cec05813766a1ad290c9d51ce7ace52919 /contrib/libs/protoc/src/google/protobuf/compiler/java/service.cc | |
| parent | e79b38f2bbbf78d295d1901d2a79f898022d5224 (diff) | |
Update cpp-protobuf to 22.5
Привет!\
Этот PR переключат cpp & python библиотеки protobuf на версию 22.5
Если у вас возникли проблемы после влития этого PR:
1. Если начали падать канон тесты, то проведите их переканонизацию
2. Прочитайте <https://wiki.yandex-team.ru/users/nechda/obnovlenie-cpp-protobuf-22.5/> страничку с основными изменениями
3. Если страничка в вики не помогла, то пишите в [DEVTOOLSSUPPORT](https://st.yandex-team.ru/DEVTOOLSSUPPORT)
7fecade616c20a841b9e9af7b7998bdfc8d2807d
Diffstat (limited to 'contrib/libs/protoc/src/google/protobuf/compiler/java/service.cc')
| -rw-r--r-- | contrib/libs/protoc/src/google/protobuf/compiler/java/service.cc | 49 | 
1 files changed, 27 insertions, 22 deletions
| diff --git a/contrib/libs/protoc/src/google/protobuf/compiler/java/service.cc b/contrib/libs/protoc/src/google/protobuf/compiler/java/service.cc index 602ab4c7b93..3f6d896c6d0 100644 --- a/contrib/libs/protoc/src/google/protobuf/compiler/java/service.cc +++ b/contrib/libs/protoc/src/google/protobuf/compiler/java/service.cc @@ -32,17 +32,18 @@  //  Based on original Protocol Buffers design by  //  Sanjay Ghemawat, Jeff Dean, and others. -#include <google/protobuf/compiler/java/service.h> +#include "google/protobuf/compiler/java/service.h" -#include <google/protobuf/io/printer.h> -#include <google/protobuf/stubs/strutil.h> -#include <google/protobuf/compiler/java/context.h> -#include <google/protobuf/compiler/java/doc_comment.h> -#include <google/protobuf/compiler/java/helpers.h> -#include <google/protobuf/compiler/java/name_resolver.h> +#include "y_absl/log/absl_log.h" +#include "y_absl/strings/str_cat.h" +#include "google/protobuf/compiler/java/context.h" +#include "google/protobuf/compiler/java/doc_comment.h" +#include "google/protobuf/compiler/java/helpers.h" +#include "google/protobuf/compiler/java/name_resolver.h" +#include "google/protobuf/io/printer.h"  // Must be last. -#include <google/protobuf/port_def.inc> +#include "google/protobuf/port_def.inc"  namespace google {  namespace protobuf { @@ -68,6 +69,10 @@ void ImmutableServiceGenerator::Generate(io::Printer* printer) {    WriteServiceDocComment(printer, descriptor_);    MaybePrintGeneratedAnnotation(context_, printer, descriptor_,                                  /* immutable = */ true); +  if (!context_->options().opensource_runtime) { +    printer->Print("@com.google.protobuf.Internal.ProtoNonnullApi\n"); +  } +    printer->Print(        "public $static$ abstract class $classname$\n"        "    implements com.google.protobuf.Service {\n", @@ -92,7 +97,7 @@ void ImmutableServiceGenerator::Generate(io::Printer* printer) {        "  return $file$.getDescriptor().getServices().get($index$);\n"        "}\n",        "file", name_resolver_->GetImmutableClassName(descriptor_->file()), -      "index", StrCat(descriptor_->index())); +      "index", y_absl::StrCat(descriptor_->index()));    GenerateGetDescriptorForType(printer);    // Generate more stuff. @@ -211,8 +216,8 @@ void ImmutableServiceGenerator::GenerateCallMethod(io::Printer* printer) {    for (int i = 0; i < descriptor_->method_count(); i++) {      const MethodDescriptor* method = descriptor_->method(i); -    std::map<TProtoStringType, TProtoStringType> vars; -    vars["index"] = StrCat(i); +    y_absl::flat_hash_map<y_absl::string_view, TProtoStringType> vars; +    vars["index"] = y_absl::StrCat(i);      vars["method"] = UnderscoresToCamelCase(method);      vars["input"] = name_resolver_->GetImmutableClassName(method->input_type());      vars["output"] = GetOutput(method); @@ -258,8 +263,8 @@ void ImmutableServiceGenerator::GenerateCallBlockingMethod(    for (int i = 0; i < descriptor_->method_count(); i++) {      const MethodDescriptor* method = descriptor_->method(i); -    std::map<TProtoStringType, TProtoStringType> vars; -    vars["index"] = StrCat(i); +    y_absl::flat_hash_map<y_absl::string_view, TProtoStringType> vars; +    vars["index"] = y_absl::StrCat(i);      vars["method"] = UnderscoresToCamelCase(method);      vars["input"] = name_resolver_->GetImmutableClassName(method->input_type());      vars["output"] = GetOutput(method); @@ -303,8 +308,8 @@ void ImmutableServiceGenerator::GenerateGetPrototype(RequestOrResponse which,    for (int i = 0; i < descriptor_->method_count(); i++) {      const MethodDescriptor* method = descriptor_->method(i); -    std::map<TProtoStringType, TProtoStringType> vars; -    vars["index"] = StrCat(i); +    y_absl::flat_hash_map<y_absl::string_view, TProtoStringType> vars; +    vars["index"] = y_absl::StrCat(i);      vars["type"] =          (which == REQUEST)              ? name_resolver_->GetImmutableClassName(method->input_type()) @@ -358,8 +363,8 @@ void ImmutableServiceGenerator::GenerateStub(io::Printer* printer) {      printer->Print(" {\n");      printer->Indent(); -    std::map<TProtoStringType, TProtoStringType> vars; -    vars["index"] = StrCat(i); +    y_absl::flat_hash_map<y_absl::string_view, TProtoStringType> vars; +    vars["index"] = y_absl::StrCat(i);      vars["output"] = GetOutput(method);      printer->Print(vars,                     "channel.callMethod(\n" @@ -422,8 +427,8 @@ void ImmutableServiceGenerator::GenerateBlockingStub(io::Printer* printer) {      printer->Print(" {\n");      printer->Indent(); -    std::map<TProtoStringType, TProtoStringType> vars; -    vars["index"] = StrCat(i); +    y_absl::flat_hash_map<y_absl::string_view, TProtoStringType> vars; +    vars["index"] = y_absl::StrCat(i);      vars["output"] = GetOutput(method);      printer->Print(vars,                     "return ($output$) channel.callBlockingMethod(\n" @@ -445,7 +450,7 @@ void ImmutableServiceGenerator::GenerateBlockingStub(io::Printer* printer) {  void ImmutableServiceGenerator::GenerateMethodSignature(      io::Printer* printer, const MethodDescriptor* method,      IsAbstract is_abstract) { -  std::map<TProtoStringType, TProtoStringType> vars; +  y_absl::flat_hash_map<y_absl::string_view, TProtoStringType> vars;    vars["name"] = UnderscoresToCamelCase(method);    vars["input"] = name_resolver_->GetImmutableClassName(method->input_type());    vars["output"] = GetOutput(method); @@ -459,7 +464,7 @@ void ImmutableServiceGenerator::GenerateMethodSignature(  void ImmutableServiceGenerator::GenerateBlockingMethodSignature(      io::Printer* printer, const MethodDescriptor* method) { -  std::map<TProtoStringType, TProtoStringType> vars; +  y_absl::flat_hash_map<y_absl::string_view, TProtoStringType> vars;    vars["method"] = UnderscoresToCamelCase(method);    vars["input"] = name_resolver_->GetImmutableClassName(method->input_type());    vars["output"] = GetOutput(method); @@ -476,4 +481,4 @@ void ImmutableServiceGenerator::GenerateBlockingMethodSignature(  }  // namespace protobuf  }  // namespace google -#include <google/protobuf/port_undef.inc> +#include "google/protobuf/port_undef.inc" | 
