Breaking Change: Stop generating the "newInstance" method. This is not used anymore.

PiperOrigin-RevId: 600123108
pull/15522/head
Protobuf Team Bot 10 months ago committed by Copybara-Service
parent 1eff9d7451
commit c0d08bdcad
  1. 3
      java/core/src/main/java/com/google/protobuf/NewInstanceSchemaFull.java
  2. 9
      src/google/protobuf/compiler/java/message.cc

@ -10,7 +10,6 @@ package com.google.protobuf;
final class NewInstanceSchemaFull implements NewInstanceSchema {
@Override
public Object newInstance(Object defaultInstance) {
return ((GeneratedMessage) defaultInstance)
.newInstance(GeneratedMessage.UnusedPrivateParameter.INSTANCE);
return ((Message) defaultInstance).toBuilder().buildPartial();
}
}

@ -357,15 +357,6 @@ void ImmutableMessageGenerator::Generate(io::Printer* printer) {
"}\n"
"\n");
printer->Print(variables,
"@java.lang.Override\n"
"@SuppressWarnings({\"unused\"})\n"
"protected java.lang.Object newInstance(\n"
" UnusedPrivateParameter unused) {\n"
" return new $classname$();\n"
"}\n"
"\n");
GenerateDescriptorMethods(printer);
// Nested types

Loading…
Cancel
Save