File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
java/core/src/main/java/com/google/protobuf
src/google/protobuf/compiler/java Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -2236,7 +2236,7 @@ private void crossLink() throws DescriptorValidationException {
2236
2236
case ENUM :
2237
2237
// We guarantee elsewhere that an enum type always has at least
2238
2238
// one possible value.
2239
- defaultValue = getEnumType ().getValues (). get (0 );
2239
+ defaultValue = getEnumType ().getValue (0 );
2240
2240
break ;
2241
2241
case MESSAGE :
2242
2242
defaultValue = null ;
@@ -2380,6 +2380,14 @@ public List<EnumValueDescriptor> getValues() {
2380
2380
return Collections .unmodifiableList (Arrays .asList (values ));
2381
2381
}
2382
2382
2383
+ public int getValueCount () {
2384
+ return values .length ;
2385
+ }
2386
+
2387
+ public EnumValueDescriptor getValue (int index ) {
2388
+ return values [index ];
2389
+ }
2390
+
2383
2391
/** Determines if the given field number is reserved. */
2384
2392
public boolean isReservedNumber (final int number ) {
2385
2393
for (final EnumDescriptorProto .EnumReservedRange range : proto .getReservedRangeList ()) {
Original file line number Diff line number Diff line change @@ -306,7 +306,7 @@ void GenerateLarge(
306
306
" }\n " );
307
307
}
308
308
printer->Print (
309
- " return getDescriptor().getValues().get (index());\n "
309
+ " return getDescriptor().getValue (index());\n "
310
310
" }\n "
311
311
" public final com.google.protobuf.Descriptors.EnumDescriptor\n "
312
312
" getDescriptorForType() {\n "
@@ -328,15 +328,15 @@ void GenerateLarge(
328
328
// immutable outer class).
329
329
printer->Print (
330
330
" return "
331
- " $file$.getDescriptor().getEnumTypes().get ($index$);\n " ,
331
+ " $file$.getDescriptor().getEnumType ($index$);\n " ,
332
332
" file" ,
333
333
name_resolver->GetClassName (descriptor->file (),
334
334
immutable_api),
335
335
" index" , absl::StrCat (descriptor->index ()));
336
336
} else {
337
337
printer->Print (
338
338
" return "
339
- " $parent$.$descriptor$.getEnumTypes().get ($index$);\n " ,
339
+ " $parent$.$descriptor$.getEnumType ($index$);\n " ,
340
340
" parent" ,
341
341
name_resolver->GetClassName (descriptor->containing_type (),
342
342
immutable_api),
You can’t perform that action at this time.
0 commit comments