Remove unnecessary cast in generated Java code

pull/5247/head
Sebastian Lövdahl 6 years ago
parent 2009d45344
commit 06bb8e7647
  1. 20
      src/google/protobuf/compiler/java/java_message_builder.cc

@ -461,35 +461,35 @@ GenerateCommonBuilderMethods(io::Printer* printer) {
printer->Print(
"@java.lang.Override\n"
"public Builder clone() {\n"
" return (Builder) super.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 (Builder) super.setField(field, 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 (Builder) super.clearField(field);\n"
" return super.clearField(field);\n"
"}\n"
"@java.lang.Override\n"
"public Builder clearOneof(\n"
" com.google.protobuf.Descriptors.OneofDescriptor oneof) {\n"
" return (Builder) super.clearOneof(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 (Builder) super.setRepeatedField(field, index, 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 (Builder) super.addRepeatedField(field, value);\n"
" return super.addRepeatedField(field, value);\n"
"}\n");
if (descriptor_->extension_range_count() > 0) {
@ -499,27 +499,27 @@ GenerateCommonBuilderMethods(io::Printer* printer) {
" com.google.protobuf.GeneratedMessage.GeneratedExtension<\n"
" $classname$, Type> extension,\n"
" Type value) {\n"
" return (Builder) super.setExtension(extension, value);\n"
" return super.setExtension(extension, value);\n"
"}\n"
"@java.lang.Override\n"
"public <Type> Builder setExtension(\n"
" com.google.protobuf.GeneratedMessage.GeneratedExtension<\n"
" $classname$, java.util.List<Type>> extension,\n"
" int index, Type value) {\n"
" return (Builder) super.setExtension(extension, index, value);\n"
" return super.setExtension(extension, index, value);\n"
"}\n"
"@java.lang.Override\n"
"public <Type> Builder addExtension(\n"
" com.google.protobuf.GeneratedMessage.GeneratedExtension<\n"
" $classname$, java.util.List<Type>> extension,\n"
" Type value) {\n"
" return (Builder) super.addExtension(extension, value);\n"
" return super.addExtension(extension, value);\n"
"}\n"
"@java.lang.Override\n"
"public <Type> Builder clearExtension(\n"
" com.google.protobuf.GeneratedMessage.GeneratedExtension<\n"
" $classname$, ?> extension) {\n"
" return (Builder) super.clearExtension(extension);\n"
" return super.clearExtension(extension);\n"
"}\n",
"classname", name_resolver_->GetImmutableClassName(descriptor_));
}

Loading…
Cancel
Save