From b556b8871cd07971b09df7b73ff6a461d78560fb Mon Sep 17 00:00:00 2001 From: Mike Kruskal Date: Thu, 25 May 2023 10:42:37 -0700 Subject: [PATCH] Automated rollback of commit 4d76f12a82bc53cc2d846e65dd8c4bce6c1d4645. PiperOrigin-RevId: 535306235 --- objectivec/GPBAny.pbobjc.m | 4 +- objectivec/GPBApi.pbobjc.m | 12 +-- objectivec/GPBDuration.pbobjc.m | 4 +- objectivec/GPBEmpty.pbobjc.m | 4 +- objectivec/GPBFieldMask.pbobjc.m | 4 +- objectivec/GPBSourceContext.pbobjc.m | 4 +- objectivec/GPBStruct.pbobjc.m | 12 +-- objectivec/GPBTimestamp.pbobjc.m | 4 +- objectivec/GPBType.pbobjc.m | 20 ++--- objectivec/GPBWrappers.pbobjc.m | 36 ++++----- .../protobuf/compiler/java/message_builder.cc | 73 +++++++++++++++++++ 11 files changed, 125 insertions(+), 52 deletions(-) diff --git a/objectivec/GPBAny.pbobjc.m b/objectivec/GPBAny.pbobjc.m index ada41e569d3d..9b7939d52b34 100644 --- a/objectivec/GPBAny.pbobjc.m +++ b/objectivec/GPBAny.pbobjc.m @@ -91,9 +91,9 @@ + (GPBDescriptor *)descriptor { "\001\001\004\241!!\000"; [localDescriptor setupExtraTextInfo:extraTextFormatInfo]; #endif // !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS - #if defined(DEBUG) && DEBUG +#if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG +#endif // DEBUG descriptor = localDescriptor; } return descriptor; diff --git a/objectivec/GPBApi.pbobjc.m b/objectivec/GPBApi.pbobjc.m index a6283a84f176..b416445c0f04 100644 --- a/objectivec/GPBApi.pbobjc.m +++ b/objectivec/GPBApi.pbobjc.m @@ -145,9 +145,9 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(GPBApi__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)]; - #if defined(DEBUG) && DEBUG +#if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG +#endif // DEBUG descriptor = localDescriptor; } return descriptor; @@ -272,9 +272,9 @@ + (GPBDescriptor *)descriptor { "\002\002\007\244\241!!\000\004\010\244\241!!\000"; [localDescriptor setupExtraTextInfo:extraTextFormatInfo]; #endif // !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS - #if defined(DEBUG) && DEBUG +#if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG +#endif // DEBUG descriptor = localDescriptor; } return descriptor; @@ -341,9 +341,9 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(GPBMixin__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)]; - #if defined(DEBUG) && DEBUG +#if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG +#endif // DEBUG descriptor = localDescriptor; } return descriptor; diff --git a/objectivec/GPBDuration.pbobjc.m b/objectivec/GPBDuration.pbobjc.m index 1a54a76b306c..a618e9cd57b5 100644 --- a/objectivec/GPBDuration.pbobjc.m +++ b/objectivec/GPBDuration.pbobjc.m @@ -86,9 +86,9 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(GPBDuration__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)]; - #if defined(DEBUG) && DEBUG +#if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG +#endif // DEBUG descriptor = localDescriptor; } return descriptor; diff --git a/objectivec/GPBEmpty.pbobjc.m b/objectivec/GPBEmpty.pbobjc.m index b69738c5934f..c33be8bb963a 100644 --- a/objectivec/GPBEmpty.pbobjc.m +++ b/objectivec/GPBEmpty.pbobjc.m @@ -62,9 +62,9 @@ + (GPBDescriptor *)descriptor { fieldCount:0 storageSize:sizeof(GPBEmpty__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)]; - #if defined(DEBUG) && DEBUG +#if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG +#endif // DEBUG descriptor = localDescriptor; } return descriptor; diff --git a/objectivec/GPBFieldMask.pbobjc.m b/objectivec/GPBFieldMask.pbobjc.m index 8de5ad42ffb0..347bcbef0e92 100644 --- a/objectivec/GPBFieldMask.pbobjc.m +++ b/objectivec/GPBFieldMask.pbobjc.m @@ -75,9 +75,9 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(GPBFieldMask__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)]; - #if defined(DEBUG) && DEBUG +#if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG +#endif // DEBUG descriptor = localDescriptor; } return descriptor; diff --git a/objectivec/GPBSourceContext.pbobjc.m b/objectivec/GPBSourceContext.pbobjc.m index 7ae605b32a81..cea417de1be8 100644 --- a/objectivec/GPBSourceContext.pbobjc.m +++ b/objectivec/GPBSourceContext.pbobjc.m @@ -75,9 +75,9 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(GPBSourceContext__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)]; - #if defined(DEBUG) && DEBUG +#if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG +#endif // DEBUG descriptor = localDescriptor; } return descriptor; diff --git a/objectivec/GPBStruct.pbobjc.m b/objectivec/GPBStruct.pbobjc.m index eabd761866e0..600b49574f51 100644 --- a/objectivec/GPBStruct.pbobjc.m +++ b/objectivec/GPBStruct.pbobjc.m @@ -115,9 +115,9 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(GPBStruct__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)]; - #if defined(DEBUG) && DEBUG +#if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG +#endif // DEBUG descriptor = localDescriptor; } return descriptor; @@ -222,9 +222,9 @@ + (GPBDescriptor *)descriptor { [localDescriptor setupOneofs:oneofs count:(uint32_t)(sizeof(oneofs) / sizeof(char*)) firstHasIndex:-1]; - #if defined(DEBUG) && DEBUG +#if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG +#endif // DEBUG descriptor = localDescriptor; } return descriptor; @@ -285,9 +285,9 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(GPBListValue__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)]; - #if defined(DEBUG) && DEBUG +#if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG +#endif // DEBUG descriptor = localDescriptor; } return descriptor; diff --git a/objectivec/GPBTimestamp.pbobjc.m b/objectivec/GPBTimestamp.pbobjc.m index edd73498a21f..dc6baebf2c95 100644 --- a/objectivec/GPBTimestamp.pbobjc.m +++ b/objectivec/GPBTimestamp.pbobjc.m @@ -86,9 +86,9 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(GPBTimestamp__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)]; - #if defined(DEBUG) && DEBUG +#if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG +#endif // DEBUG descriptor = localDescriptor; } return descriptor; diff --git a/objectivec/GPBType.pbobjc.m b/objectivec/GPBType.pbobjc.m index db7a41f7e515..7b44e3995170 100644 --- a/objectivec/GPBType.pbobjc.m +++ b/objectivec/GPBType.pbobjc.m @@ -307,9 +307,9 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(GPBType__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)]; - #if defined(DEBUG) && DEBUG +#if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG +#endif // DEBUG descriptor = localDescriptor; } return descriptor; @@ -468,9 +468,9 @@ + (GPBDescriptor *)descriptor { "\001\006\004\241!!\000"; [localDescriptor setupExtraTextInfo:extraTextFormatInfo]; #endif // !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS - #if defined(DEBUG) && DEBUG +#if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG +#endif // DEBUG descriptor = localDescriptor; } return descriptor; @@ -593,9 +593,9 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(GPBEnum__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)]; - #if defined(DEBUG) && DEBUG +#if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG +#endif // DEBUG descriptor = localDescriptor; } return descriptor; @@ -673,9 +673,9 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(GPBEnumValue__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)]; - #if defined(DEBUG) && DEBUG +#if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG +#endif // DEBUG descriptor = localDescriptor; } return descriptor; @@ -730,9 +730,9 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(GPBOption__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)]; - #if defined(DEBUG) && DEBUG +#if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG +#endif // DEBUG descriptor = localDescriptor; } return descriptor; diff --git a/objectivec/GPBWrappers.pbobjc.m b/objectivec/GPBWrappers.pbobjc.m index 07be68bacee4..30461e3f6fe9 100644 --- a/objectivec/GPBWrappers.pbobjc.m +++ b/objectivec/GPBWrappers.pbobjc.m @@ -83,9 +83,9 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(GPBDoubleValue__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)]; - #if defined(DEBUG) && DEBUG +#if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG +#endif // DEBUG descriptor = localDescriptor; } return descriptor; @@ -129,9 +129,9 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(GPBFloatValue__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)]; - #if defined(DEBUG) && DEBUG +#if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG +#endif // DEBUG descriptor = localDescriptor; } return descriptor; @@ -175,9 +175,9 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(GPBInt64Value__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)]; - #if defined(DEBUG) && DEBUG +#if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG +#endif // DEBUG descriptor = localDescriptor; } return descriptor; @@ -221,9 +221,9 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(GPBUInt64Value__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)]; - #if defined(DEBUG) && DEBUG +#if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG +#endif // DEBUG descriptor = localDescriptor; } return descriptor; @@ -267,9 +267,9 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(GPBInt32Value__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)]; - #if defined(DEBUG) && DEBUG +#if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG +#endif // DEBUG descriptor = localDescriptor; } return descriptor; @@ -313,9 +313,9 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(GPBUInt32Value__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)]; - #if defined(DEBUG) && DEBUG +#if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG +#endif // DEBUG descriptor = localDescriptor; } return descriptor; @@ -358,9 +358,9 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(GPBBoolValue__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)]; - #if defined(DEBUG) && DEBUG +#if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG +#endif // DEBUG descriptor = localDescriptor; } return descriptor; @@ -404,9 +404,9 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(GPBStringValue__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)]; - #if defined(DEBUG) && DEBUG +#if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG +#endif // DEBUG descriptor = localDescriptor; } return descriptor; @@ -450,9 +450,9 @@ + (GPBDescriptor *)descriptor { fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) storageSize:sizeof(GPBBytesValue__storage_) flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)]; - #if defined(DEBUG) && DEBUG +#if defined(DEBUG) && DEBUG NSAssert(descriptor == nil, @"Startup recursed!"); - #endif // DEBUG +#endif // DEBUG descriptor = localDescriptor; } return descriptor; diff --git a/src/google/protobuf/compiler/java/message_builder.cc b/src/google/protobuf/compiler/java/message_builder.cc index 3a0f03d0969d..15a720e35577 100644 --- a/src/google/protobuf/compiler/java/message_builder.cc +++ b/src/google/protobuf/compiler/java/message_builder.cc @@ -435,6 +435,79 @@ void MessageBuilderGenerator::GenerateCommonBuilderMethods( GenerateBuildPartial(printer); + if (context_->options().opensource_runtime) { + // Override methods declared in GeneratedMessage to return the concrete + // generated type so callsites won't depend on GeneratedMessage. This + // is needed to keep binary compatibility when we change generated code + // to subclass a different GeneratedMessage class (e.g., in v3.0.0 release + // we changed all generated code to subclass GeneratedMessageV3). + printer->Print( + "@java.lang.Override\n" + "public Builder clone() {\n" + " return super.clone();\n" + "}\n" + "@java.lang.Override\n" + "public Builder setField(\n" + " com.google.protobuf.Descriptors.FieldDescriptor field,\n" + " java.lang.Object value) {\n" + " return super.setField(field, value);\n" + "}\n" + "@java.lang.Override\n" + "public Builder clearField(\n" + " com.google.protobuf.Descriptors.FieldDescriptor field) {\n" + " return super.clearField(field);\n" + "}\n" + "@java.lang.Override\n" + "public Builder clearOneof(\n" + " com.google.protobuf.Descriptors.OneofDescriptor oneof) {\n" + " return super.clearOneof(oneof);\n" + "}\n" + "@java.lang.Override\n" + "public Builder setRepeatedField(\n" + " com.google.protobuf.Descriptors.FieldDescriptor field,\n" + " int index, java.lang.Object value) {\n" + " return super.setRepeatedField(field, index, value);\n" + "}\n" + "@java.lang.Override\n" + "public Builder addRepeatedField(\n" + " com.google.protobuf.Descriptors.FieldDescriptor field,\n" + " java.lang.Object value) {\n" + " return super.addRepeatedField(field, value);\n" + "}\n"); + + if (descriptor_->extension_range_count() > 0) { + printer->Print( + "@java.lang.Override\n" + "public Builder setExtension(\n" + " com.google.protobuf.GeneratedMessage.GeneratedExtension<\n" + " $classname$, Type> extension,\n" + " Type value) {\n" + " return super.setExtension(extension, value);\n" + "}\n" + "@java.lang.Override\n" + "public Builder setExtension(\n" + " com.google.protobuf.GeneratedMessage.GeneratedExtension<\n" + " $classname$, java.util.List> extension,\n" + " int index, Type value) {\n" + " return super.setExtension(extension, index, value);\n" + "}\n" + "@java.lang.Override\n" + "public Builder addExtension(\n" + " com.google.protobuf.GeneratedMessage.GeneratedExtension<\n" + " $classname$, java.util.List> extension,\n" + " Type value) {\n" + " return super.addExtension(extension, value);\n" + "}\n" + "@java.lang.Override\n" + "public Builder clearExtension(\n" + " com.google.protobuf.GeneratedMessage.GeneratedExtension<\n" + " $classname$, T> extension) {\n" + " return super.clearExtension(extension);\n" + "}\n", + "classname", name_resolver_->GetImmutableClassName(descriptor_)); + } + } + // ----------------------------------------------------------------- if (context_->HasGeneratedMethods(descriptor_)) {