From 6f24fceb36101f49279f108aca52fb52eca29a49 Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Thu, 1 Jun 2023 10:02:02 -0700 Subject: [PATCH] Internal changes PiperOrigin-RevId: 537054791 --- src/google/protobuf/descriptor.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/google/protobuf/descriptor.cc b/src/google/protobuf/descriptor.cc index d49601e501..8cb0b1d34e 100644 --- a/src/google/protobuf/descriptor.cc +++ b/src/google/protobuf/descriptor.cc @@ -4023,6 +4023,7 @@ class DescriptorBuilder { const Descriptor* result); void CheckFieldJsonNameUniqueness(const std::string& message_name, const DescriptorProto& message, + const Descriptor* descriptor, FileDescriptorLegacy::Syntax syntax, bool use_custom_names); void CheckEnumValueUniqueness(const EnumDescriptorProto& proto, @@ -5744,13 +5745,13 @@ void DescriptorBuilder::CheckFieldJsonNameUniqueness( if (syntax == FileDescriptorLegacy::Syntax::SYNTAX_PROTO3) { // Only check default JSON names for conflicts in proto3. This is legacy // behavior that will be removed in a later version. - CheckFieldJsonNameUniqueness(message_name, proto, syntax, false); + CheckFieldJsonNameUniqueness(message_name, proto, result, syntax, false); } } else { // Check both with and without taking json_name into consideration. This is // needed for field masks, which don't use json_name. - CheckFieldJsonNameUniqueness(message_name, proto, syntax, false); - CheckFieldJsonNameUniqueness(message_name, proto, syntax, true); + CheckFieldJsonNameUniqueness(message_name, proto, result, syntax, false); + CheckFieldJsonNameUniqueness(message_name, proto, result, syntax, true); } } @@ -5781,7 +5782,8 @@ bool JsonNameLooksLikeExtension(std::string name) { void DescriptorBuilder::CheckFieldJsonNameUniqueness( const std::string& message_name, const DescriptorProto& message, - FileDescriptorLegacy::Syntax syntax, bool use_custom_names) { + const Descriptor* descriptor, FileDescriptorLegacy::Syntax syntax, + bool use_custom_names) { absl::flat_hash_map name_to_field; for (const FieldDescriptorProto& field : message.field()) { JsonNameDetails details = GetJsonNameDetails(&field, use_custom_names);