Skip to content

Commit

Permalink
internal change
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 625554775
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Apr 19, 2024
1 parent 0cda26d commit 7888c24
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/google/protobuf/compiler/java/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ inline bool CheckUtf8(const FieldDescriptor* descriptor) {
descriptor->file()->options().java_string_check_utf8();
}


void WriteUInt32ToUtf16CharSequence(uint32_t number,
std::vector<uint16_t>* output);

Expand Down
4 changes: 4 additions & 0 deletions src/google/protobuf/compiler/java/immutable/enum.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

#include "google/protobuf/compiler/java/immutable/enum.h"

#include <algorithm>
#include <cmath>
#include <string>

#include "absl/container/flat_hash_map.h"
Expand All @@ -30,6 +32,7 @@ namespace protobuf {
namespace compiler {
namespace java {


EnumNonLiteGenerator::EnumNonLiteGenerator(const EnumDescriptor* descriptor,
bool immutable_api, Context* context)
: descriptor_(descriptor),
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/google/protobuf/compiler/java/immutable/enum.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class EnumNonLiteGenerator : public EnumGenerator {
ClassNameResolver* name_resolver_;

bool CanUseEnumValues();

};

} // namespace java
Expand Down
12 changes: 12 additions & 0 deletions src/google/protobuf/sample_messages_edition.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}

0 comments on commit 7888c24

Please sign in to comment.