Commit 927ef3f2 authored by Jisi Liu's avatar Jisi Liu

Add static MyMessage.parser().

In preparation of deprecating the PARSER public instance.

Change-Id: I3e332d83bc4b4f8467769f8e45c758978ace8f21
parent 3e2c8a5d
......@@ -1250,6 +1250,10 @@ void ImmutableMessageGenerator::GenerateParser(io::Printer* printer) {
"\n");
printer->Print(
"public static com.google.protobuf.Parser<$classname$> parser() {\n"
" return PARSER;\n"
"}\n"
"\n"
"@java.lang.Override\n"
"public com.google.protobuf.Parser<$classname$> getParserForType() {\n"
" return PARSER;\n"
......
......@@ -1153,7 +1153,10 @@ void ImmutableMessageLiteGenerator::GenerateParser(io::Printer* printer) {
printer->Print(
"public static final com.google.protobuf.Parser<$classname$> PARSER =\n"
" new DefaultInstanceBasedParser(DEFAULT_INSTANCE);\n"
"\n",
"\n"
"public static com.google.protobuf.Parser<$classname$> parser() {\n"
" return PARSER;\n"
"}\n",
"classname", descriptor_->name());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment