Skip to content

Commit a995803

Browse files
Fix large java enums not being honored on lite runtime.
PiperOrigin-RevId: 814265545
1 parent 1e14bff commit a995803

File tree

1 file changed

+14
-0
lines changed
  • src/google/protobuf/compiler/java/lite

1 file changed

+14
-0
lines changed

src/google/protobuf/compiler/java/lite/enum.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,20 @@ void EnumLiteGenerator::Generate(io::Printer* printer) {
6161
WriteEnumDocComment(printer, descriptor_, context_->options());
6262
MaybePrintGeneratedAnnotation(context_, printer, descriptor_, immutable_api_);
6363

64+
if (CheckLargeEnum(descriptor_)) {
65+
std::vector<
66+
std::pair<const EnumValueDescriptor*, const EnumValueDescriptor*>>
67+
alias_pairs;
68+
alias_pairs.reserve(aliases_.size());
69+
for (const Alias& alias : aliases_) {
70+
alias_pairs.emplace_back(alias.value, alias.canonical_value);
71+
}
72+
73+
GenerateLarge(printer, descriptor_, canonical_values_, alias_pairs,
74+
immutable_api_, context_, name_resolver_);
75+
return;
76+
}
77+
6478

6579
printer->Print(
6680
"$deprecation$public enum $classname$\n"

0 commit comments

Comments
 (0)