Skip to content

Commit

Permalink
Breaking Change: Stop generating the "newInstance" method. This is no…
Browse files Browse the repository at this point in the history
…t used anymore.

PiperOrigin-RevId: 600123108
  • Loading branch information
protobuf-github-bot authored and copybara-github committed Jan 20, 2024
1 parent 1eff9d7 commit c0d08bd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
final class NewInstanceSchemaFull implements NewInstanceSchema {
@Override
public Object newInstance(Object defaultInstance) {
return ((GeneratedMessage) defaultInstance)
.newInstance(GeneratedMessage.UnusedPrivateParameter.INSTANCE);
return ((Message) defaultInstance).toBuilder().buildPartial();
}
}
9 changes: 0 additions & 9 deletions src/google/protobuf/compiler/java/message.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c0d08bd

Please sign in to comment.