Switch the visibility of static field `PARSER` in Java gencode to `private`.
PiperOrigin-RevId: 472529298
diff --git a/src/google/protobuf/compiler/java/message.cc b/src/google/protobuf/compiler/java/message.cc
index 2b249ad..f82e18f 100644
--- a/src/google/protobuf/compiler/java/message.cc
+++ b/src/google/protobuf/compiler/java/message.cc
@@ -1162,7 +1162,7 @@
// ===================================================================
void ImmutableMessageGenerator::GenerateParser(io::Printer* printer) {
printer->Print(
- "$visibility$ static final com.google.protobuf.Parser<$classname$>\n"
+ "private static final com.google.protobuf.Parser<$classname$>\n"
" PARSER = new com.google.protobuf.AbstractParser<$classname$>() {\n"
" @java.lang.Override\n"
" public $classname$ parsePartialFrom(\n"
@@ -1195,9 +1195,6 @@
" return PARSER;\n"
"}\n"
"\n",
- "visibility",
- ExposePublicParser(descriptor_->file()) ? "@java.lang.Deprecated public"
- : "private",
"classname", descriptor_->name());
}
diff --git a/src/google/protobuf/compiler/java/message_field.cc b/src/google/protobuf/compiler/java/message_field.cc
index d7cf214..5c82038 100644
--- a/src/google/protobuf/compiler/java/message_field.cc
+++ b/src/google/protobuf/compiler/java/message_field.cc
@@ -83,11 +83,7 @@
: ""});
(*variables)["on_changed"] = "onChanged();";
(*variables)["ver"] = GeneratedCodeVersionSuffix();
- (*variables)["get_parser"] =
- ExposePublicParser(descriptor->message_type()->file()) &&
- context->options().opensource_runtime
- ? "PARSER"
- : "parser()";
+ (*variables)["get_parser"] = "parser()";
if (HasHasbit(descriptor)) {
// For singular messages and builders, one bit is used for the hasField bit.