Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
9cf65b7d
Commit
9cf65b7d
authored
Apr 08, 2011
by
liujisi@google.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use fully qualified java.lang.Object in protoc java code.
parent
eab9b5d4
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
7 deletions
+12
-7
test_bad_identifiers.proto
.../test/java/com/google/protobuf/test_bad_identifiers.proto
+4
-0
java_message.cc
src/google/protobuf/compiler/java/java_message.cc
+3
-2
java_string_field.cc
src/google/protobuf/compiler/java/java_string_field.cc
+5
-5
No files found.
java/src/test/java/com/google/protobuf/test_bad_identifiers.proto
View file @
9cf65b7d
...
...
@@ -60,6 +60,10 @@ message Override {
optional
int32
override
=
1
;
}
message
Object
{
optional
int32
object
=
1
;
}
service
TestConflictingMethodNames
{
rpc
Override
(
TestMessage
)
returns
(
TestMessage
);
}
...
...
src/google/protobuf/compiler/java/java_message.cc
View file @
9cf65b7d
...
...
@@ -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
"
...
...
src/google/protobuf/compiler/java/java_string_field.cc
View file @
9cf65b7d
...
...
@@ -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
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment