Skip to content

Commit 8b1987a

Browse files
stefanhausteincopybara-github
authored andcommitted
In kotlin/native compatibility methods, include the name of the first parameter in the method name to match k/n @ObjCName mapping.
PiperOrigin-RevId: 745934253
1 parent a804c3b commit 8b1987a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

protobuf/compiler/src/google/protobuf/compiler/j2objc/j2objc_field.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ void RepeatedFieldGenerator::GenerateFieldBuilderHeader(io::Printer* printer)
417417
if (IsGenerateProperties(descriptor_->file())) {
418418
printer->Print(
419419
variables_,
420-
"- (nonnull $classname$_Builder *)add$capitalized_name$:\n"
420+
"- (nonnull $classname$_Builder *)add$capitalized_name$Value:\n"
421421
" ($nonnull_type$)value;\n");
422422
}
423423
if (GetJavaType(descriptor_) == JAVATYPE_MESSAGE) {
@@ -527,7 +527,7 @@ void MapFieldGenerator::GenerateFieldBuilderHeader(io::Printer* printer) const {
527527
if (IsGenerateProperties(descriptor_->file())) {
528528
printer->Print(
529529
variables_,
530-
"- (nonnull $classname$_Builder *)put$capitalized_name$:"
530+
"- (nonnull $classname$_Builder *)put$capitalized_name$Key:"
531531
"($key_nonnull_type$)key value:($value_nonnull_type$)value;\n");
532532
}
533533
}

protobuf/runtime/src/com/google/protobuf/GeneratedMessage.mm

+2-2
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,7 @@ static BOOL ResolveAddAccessor(Class cls, CGPDescriptor *descriptor, SEL sel, co
11791179
ComGoogleProtobufDescriptors_FieldDescriptor *field = fieldsBuf[i];
11801180
const char *tail = selName;
11811181
if (MatchesName(&tail, field) &&
1182-
(Matches(&tail, "With", 4) ? MatchesKeyword(&tail, field) : true)) {
1182+
(Matches(&tail, "With", 4) ? MatchesKeyword(&tail, field) : Matches(&tail, "Value", 5))) {
11831183
if (MatchesEnd(tail, ":")) {
11841184
return AddAdderMethod(cls, sel, field);
11851185
} else if (MatchesEnd(tail, "_Builder:")) {
@@ -1234,7 +1234,7 @@ static BOOL ResolvePutAccessor(Class cls, CGPDescriptor *descriptor, SEL sel, co
12341234
MatchesEnd(tail, ":")) {
12351235
return AddPutMethod(cls, sel, field);
12361236
}
1237-
if (Matches(&tail, ":value", 6) && MatchesEnd(tail, ":")) {
1237+
if (Matches(&tail, "Key", 3) && Matches(&tail, ":value", 6) && MatchesEnd(tail, ":")) {
12381238
return AddPutMethod(cls, sel, field);
12391239
}
12401240
}

0 commit comments

Comments
 (0)