From 3b4605e0461df36d495a8ed95c899dcf9907e3cc Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Fri, 16 Aug 2024 10:52:46 -0700 Subject: [PATCH] internal change PiperOrigin-RevId: 663783805 --- src/google/protobuf/compiler/java/BUILD.bazel | 2 ++ src/google/protobuf/compiler/java/full/BUILD.bazel | 1 - src/google/protobuf/compiler/java/full/enum.cc | 9 ++------- src/google/protobuf/compiler/java/full/enum.h | 1 - .../protobuf/compiler/java/internal_helpers.cc | 14 ++++++++++++++ .../protobuf/compiler/java/internal_helpers.h | 2 ++ src/google/protobuf/compiler/java/lite/enum.cc | 5 +++++ 7 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/google/protobuf/compiler/java/BUILD.bazel b/src/google/protobuf/compiler/java/BUILD.bazel index d4ccf5324018..d1ac684ed424 100644 --- a/src/google/protobuf/compiler/java/BUILD.bazel +++ b/src/google/protobuf/compiler/java/BUILD.bazel @@ -79,6 +79,8 @@ cc_library( "//src/google/protobuf:port", "//src/google/protobuf/compiler:code_generator", "@com_google_absl//absl/log:absl_log", + "@com_google_absl//absl/strings", + "@com_google_absl//absl/strings:str_format", ], ) diff --git a/src/google/protobuf/compiler/java/full/BUILD.bazel b/src/google/protobuf/compiler/java/full/BUILD.bazel index 1a7f874326bd..c708696321c1 100644 --- a/src/google/protobuf/compiler/java/full/BUILD.bazel +++ b/src/google/protobuf/compiler/java/full/BUILD.bazel @@ -89,7 +89,6 @@ cc_library( "//src/google/protobuf/io:printer", "@com_google_absl//absl/container:flat_hash_map", "@com_google_absl//absl/strings", - "@com_google_absl//absl/strings:str_format", ], ) diff --git a/src/google/protobuf/compiler/java/full/enum.cc b/src/google/protobuf/compiler/java/full/enum.cc index c321c08f3114..30db3b4130cf 100644 --- a/src/google/protobuf/compiler/java/full/enum.cc +++ b/src/google/protobuf/compiler/java/full/enum.cc @@ -11,21 +11,18 @@ #include "google/protobuf/compiler/java/full/enum.h" -#include -#include #include +#include #include #include "absl/container/flat_hash_map.h" #include "absl/strings/str_cat.h" -#include "absl/strings/str_format.h" -#include "absl/strings/str_join.h" -#include "absl/strings/string_view.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/internal_helpers.h" #include "google/protobuf/compiler/java/name_resolver.h" +#include "google/protobuf/descriptor.h" #include "google/protobuf/descriptor.pb.h" #include "google/protobuf/io/printer.h" @@ -37,7 +34,6 @@ namespace protobuf { namespace compiler { namespace java { - EnumNonLiteGenerator::EnumNonLiteGenerator(const EnumDescriptor* descriptor, bool immutable_api, Context* context) : descriptor_(descriptor), @@ -383,7 +379,6 @@ void EnumNonLiteGenerator::Generate(io::Printer* printer) { printer->Print("}\n\n"); } - bool EnumNonLiteGenerator::CanUseEnumValues() { if (canonical_values_.size() != descriptor_->value_count()) { return false; diff --git a/src/google/protobuf/compiler/java/full/enum.h b/src/google/protobuf/compiler/java/full/enum.h index 8528d7f81f92..18ccc01e953a 100644 --- a/src/google/protobuf/compiler/java/full/enum.h +++ b/src/google/protobuf/compiler/java/full/enum.h @@ -71,7 +71,6 @@ class EnumNonLiteGenerator : public EnumGenerator { ClassNameResolver* name_resolver_; bool CanUseEnumValues(); - }; } // namespace java diff --git a/src/google/protobuf/compiler/java/internal_helpers.cc b/src/google/protobuf/compiler/java/internal_helpers.cc index 06dae866c46b..bb1da0888e44 100644 --- a/src/google/protobuf/compiler/java/internal_helpers.cc +++ b/src/google/protobuf/compiler/java/internal_helpers.cc @@ -11,9 +11,22 @@ #include "google/protobuf/compiler/java/internal_helpers.h" +#include +#include +#include +#include +#include + #include "absl/log/absl_log.h" +#include "absl/strings/str_cat.h" +#include "absl/strings/str_format.h" +#include "absl/strings/str_join.h" +#include "absl/strings/string_view.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/descriptor.h" #include "google/protobuf/descriptor.pb.h" // Must be last. @@ -106,6 +119,7 @@ int GetExperimentalJavaFieldType(const FieldDescriptor* field) { } } + } // namespace java } // namespace compiler } // namespace protobuf diff --git a/src/google/protobuf/compiler/java/internal_helpers.h b/src/google/protobuf/compiler/java/internal_helpers.h index c70804f9d66a..3f027abfbfef 100644 --- a/src/google/protobuf/compiler/java/internal_helpers.h +++ b/src/google/protobuf/compiler/java/internal_helpers.h @@ -13,7 +13,9 @@ #define GOOGLE_PROTOBUF_COMPILER_JAVA_INTERNAL_HELPERS_H__ #include "google/protobuf/compiler/java/java_features.pb.h" +#include "google/protobuf/compiler/java/context.h" #include "google/protobuf/compiler/java/generator.h" +#include "google/protobuf/compiler/java/name_resolver.h" #include "google/protobuf/compiler/java/names.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/descriptor.pb.h" diff --git a/src/google/protobuf/compiler/java/lite/enum.cc b/src/google/protobuf/compiler/java/lite/enum.cc index 3b42a12d6e86..8e3c57cf9c1b 100644 --- a/src/google/protobuf/compiler/java/lite/enum.cc +++ b/src/google/protobuf/compiler/java/lite/enum.cc @@ -12,12 +12,15 @@ #include "google/protobuf/compiler/java/lite/enum.h" #include +#include +#include #include "absl/container/flat_hash_map.h" #include "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/internal_helpers.h" #include "google/protobuf/compiler/java/name_resolver.h" #include "google/protobuf/descriptor.pb.h" #include "google/protobuf/io/printer.h" @@ -54,6 +57,8 @@ EnumLiteGenerator::~EnumLiteGenerator() {} void EnumLiteGenerator::Generate(io::Printer* printer) { WriteEnumDocComment(printer, descriptor_, context_->options()); MaybePrintGeneratedAnnotation(context_, printer, descriptor_, immutable_api_); + + printer->Print( "$deprecation$public enum $classname$\n" " implements com.google.protobuf.Internal.EnumLite {\n",