diff --git a/src/google/protobuf/compiler/java/message.cc b/src/google/protobuf/compiler/java/message.cc index 6654feb12f1a..d170cfa38f17 100644 --- a/src/google/protobuf/compiler/java/message.cc +++ b/src/google/protobuf/compiler/java/message.cc @@ -224,10 +224,9 @@ int ImmutableMessageGenerator::GenerateFieldAccessorTableInitializer( bytecode_estimate += 6; printer->Print("\"$field_name$\", ", "field_name", info->capitalized_name); } - // TODO: Once cl/534906231 propagates, only consider real oneofs - // since proto reflection does not use this for synthetic oneofs. - for (int i = 0; i < descriptor_->oneof_decl_count(); i++) { - const OneofDescriptor* oneof = descriptor_->oneof_decl(i); + + for (int i = 0; i < descriptor_->real_oneof_decl_count(); i++) { + const OneofDescriptor* oneof = descriptor_->real_oneof_decl(i); const OneofGeneratorInfo* info = context_->GetOneofGeneratorInfo(oneof); bytecode_estimate += 6; printer->Print("\"$oneof_name$\", ", "oneof_name", info->capitalized_name);