diff --git a/src/google/protobuf/compiler/java/helpers.h b/src/google/protobuf/compiler/java/helpers.h index ed27eae1d5559..dd0782401f273 100644 --- a/src/google/protobuf/compiler/java/helpers.h +++ b/src/google/protobuf/compiler/java/helpers.h @@ -387,6 +387,7 @@ inline bool CheckUtf8(const FieldDescriptor* descriptor) { descriptor->file()->options().java_string_check_utf8(); } + void WriteUInt32ToUtf16CharSequence(uint32_t number, std::vector* output); diff --git a/src/google/protobuf/compiler/java/immutable/enum.cc b/src/google/protobuf/compiler/java/immutable/enum.cc index 61b307914cbfa..3dc2fd63082e3 100644 --- a/src/google/protobuf/compiler/java/immutable/enum.cc +++ b/src/google/protobuf/compiler/java/immutable/enum.cc @@ -11,6 +11,8 @@ #include "google/protobuf/compiler/java/immutable/enum.h" +#include +#include #include #include "absl/container/flat_hash_map.h" @@ -30,6 +32,7 @@ namespace protobuf { namespace compiler { namespace java { + EnumNonLiteGenerator::EnumNonLiteGenerator(const EnumDescriptor* descriptor, bool immutable_api, Context* context) : descriptor_(descriptor), @@ -374,6 +377,7 @@ 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/immutable/enum.h b/src/google/protobuf/compiler/java/immutable/enum.h index 18ccc01e953ab..8528d7f81f92d 100644 --- a/src/google/protobuf/compiler/java/immutable/enum.h +++ b/src/google/protobuf/compiler/java/immutable/enum.h @@ -71,6 +71,7 @@ class EnumNonLiteGenerator : public EnumGenerator { ClassNameResolver* name_resolver_; bool CanUseEnumValues(); + }; } // namespace java diff --git a/src/google/protobuf/sample_messages_edition.proto b/src/google/protobuf/sample_messages_edition.proto index 464a816d9edc8..413342a1769ed 100644 --- a/src/google/protobuf/sample_messages_edition.proto +++ b/src/google/protobuf/sample_messages_edition.proto @@ -11,8 +11,10 @@ edition = "2023"; package protobuf_test_messages.edition; +import "third_party/java/protobuf/java_features.proto"; import "google/protobuf/cpp_features.proto"; +option java_package = "com.google.protobuf_sample_messages.edition"; option optimize_for = SPEED; option features.(pb.cpp).string_type = VIEW; @@ -425,3 +427,13 @@ message TestAllRequiredTypesEdition { int32 i = 9 [features.field_presence = LEGACY_REQUIRED]; } } + +enum LargeEnum { + option features.(pb.java).large_enum = true; + + UNSPECIFIED_LARGE_ENUM = 0; + LARGE_ENUM_1 = 1; + LARGE_ENUM_2 = 2; + LARGE_ENUM_3 = 3; + LARGE_ENUM_4 = 4; +}