Commit 9cf65b7d authored by liujisi@google.com's avatar liujisi@google.com

Use fully qualified java.lang.Object in protoc java code.

parent eab9b5d4
......@@ -57,7 +57,11 @@ message Deprecated {
}
message Override {
optional int32 override = 1;
optional int32 override = 1;
}
message Object {
optional int32 object = 1;
}
service TestConflictingMethodNames {
......
......@@ -550,7 +550,8 @@ GenerateMessageSerializationMethods(io::Printer* printer) {
printer->Print(
"@java.lang.Override\n"
"protected Object writeReplace() throws java.io.ObjectStreamException {\n"
"protected java.lang.Object writeReplace()\n"
" throws java.io.ObjectStreamException {\n"
" return super.writeReplace();\n"
"}\n"
"\n");
......@@ -1182,7 +1183,7 @@ void MessageGenerator::GenerateIsInitialized(
void MessageGenerator::GenerateEqualsAndHashCode(io::Printer* printer) {
printer->Print(
"@java.lang.Override\n"
"public boolean equals(final Object obj) {\n");
"public boolean equals(final java.lang.Object obj) {\n");
printer->Indent();
printer->Print(
"if (obj == this) {\n"
......
......@@ -168,14 +168,14 @@ GenerateInterfaceMembers(io::Printer* printer) const {
void StringFieldGenerator::
GenerateMembers(io::Printer* printer) const {
printer->Print(variables_,
"private Object $name$_;\n"
"private java.lang.Object $name$_;\n"
"$deprecation$public boolean has$capitalized_name$() {\n"
" return $get_has_field_bit_message$;\n"
"}\n");
printer->Print(variables_,
"$deprecation$public String get$capitalized_name$() {\n"
" Object ref = $name$_;\n"
" java.lang.Object ref = $name$_;\n"
" if (ref instanceof String) {\n"
" return (String) ref;\n"
" } else {\n"
......@@ -189,7 +189,7 @@ GenerateMembers(io::Printer* printer) const {
" }\n"
"}\n"
"private com.google.protobuf.ByteString get$capitalized_name$Bytes() {\n"
" Object ref = $name$_;\n"
" java.lang.Object ref = $name$_;\n"
" if (ref instanceof String) {\n"
" com.google.protobuf.ByteString b = \n"
" com.google.protobuf.ByteString.copyFromUtf8((String) ref);\n"
......@@ -204,14 +204,14 @@ GenerateMembers(io::Printer* printer) const {
void StringFieldGenerator::
GenerateBuilderMembers(io::Printer* printer) const {
printer->Print(variables_,
"private Object $name$_ $default_init$;\n"
"private java.lang.Object $name$_ $default_init$;\n"
"$deprecation$public boolean has$capitalized_name$() {\n"
" return $get_has_field_bit_builder$;\n"
"}\n");
printer->Print(variables_,
"$deprecation$public String get$capitalized_name$() {\n"
" Object ref = $name$_;\n"
" java.lang.Object ref = $name$_;\n"
" if (!(ref instanceof String)) {\n"
" String s = ((com.google.protobuf.ByteString) ref).toStringUtf8();\n"
" $name$_ = s;\n"
......
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