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
4014b9f8
Commit
4014b9f8
authored
Sep 17, 2008
by
temporal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add @Override annotation to generated Java code where appropriate.
Patch from Brian Atkinson <nairb774@gmail.com>.
parent
bf86b546
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
CONTRIBUTORS.txt
CONTRIBUTORS.txt
+2
-0
java_message.cc
src/google/protobuf/compiler/java/java_message.cc
+11
-0
No files found.
CONTRIBUTORS.txt
View file @
4014b9f8
...
...
@@ -47,3 +47,5 @@ Non-Google patch contributors:
Dilip Joseph <dilip.antony.joseph@gmail.com>
* Heuristic detection of sub-messages when printing unknown fields in
text format.
Brian Atkinson <nairb774@gmail.com>
* Added @Override annotation to generated Java code where appropriate.
src/google/protobuf/compiler/java/java_message.cc
View file @
4014b9f8
...
...
@@ -241,6 +241,7 @@ void MessageGenerator::Generate(io::Printer* printer) {
" return $fileclass$.internal_$identifier$_descriptor;
\n
"
"}
\n
"
"
\n
"
"@Override
\n
"
"protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
\n
"
" internalGetFieldAccessorTable() {
\n
"
" return $fileclass$.internal_$identifier$_fieldAccessorTable;
\n
"
...
...
@@ -293,6 +294,7 @@ GenerateMessageSerializationMethods(io::Printer* printer) {
ExtensionRangeOrdering
());
printer
->
Print
(
"@Override
\n
"
"public void writeTo(com.google.protobuf.CodedOutputStream output)
\n
"
" throws java.io.IOException {
\n
"
);
printer
->
Indent
();
...
...
@@ -331,6 +333,7 @@ GenerateMessageSerializationMethods(io::Printer* printer) {
"}
\n
"
"
\n
"
"private int memoizedSerializedSize = -1;
\n
"
"@Override
\n
"
"public int getSerializedSize() {
\n
"
" int size = memoizedSerializedSize;
\n
"
" if (size != -1) return size;
\n
"
...
...
@@ -485,19 +488,23 @@ void MessageGenerator::GenerateCommonBuilderMethods(io::Printer* printer) {
"
\n
"
"$classname$ result = new $classname$();
\n
"
"
\n
"
"@Override
\n
"
"protected $classname$ internalGetResult() {
\n
"
" return result;
\n
"
"}
\n
"
"
\n
"
"@Override
\n
"
"public Builder clear() {
\n
"
" result = new $classname$();
\n
"
" return this;
\n
"
"}
\n
"
"
\n
"
"@Override
\n
"
"public Builder clone() {
\n
"
" return new Builder().mergeFrom(result);
\n
"
"}
\n
"
"
\n
"
"@Override
\n
"
"public com.google.protobuf.Descriptors.Descriptor
\n
"
" getDescriptorForType() {
\n
"
" return $classname$.getDescriptor();
\n
"
...
...
@@ -550,6 +557,7 @@ void MessageGenerator::GenerateCommonBuilderMethods(io::Printer* printer) {
if
(
descriptor_
->
file
()
->
options
().
optimize_for
()
==
FileOptions
::
SPEED
)
{
printer
->
Print
(
"@Override
\n
"
"public Builder mergeFrom(com.google.protobuf.Message other) {
\n
"
" if (other instanceof $classname$) {
\n
"
" return mergeFrom(($classname$)other);
\n
"
...
...
@@ -586,6 +594,7 @@ void MessageGenerator::GenerateBuilderParsingMethods(io::Printer* printer) {
SortFieldsByNumber
(
descriptor_
));
printer
->
Print
(
"@Override
\n
"
"public Builder mergeFrom(
\n
"
" com.google.protobuf.CodedInputStream input)
\n
"
" throws java.io.IOException {
\n
"
...
...
@@ -593,6 +602,7 @@ void MessageGenerator::GenerateBuilderParsingMethods(io::Printer* printer) {
" com.google.protobuf.ExtensionRegistry.getEmptyRegistry());
\n
"
"}
\n
"
"
\n
"
"@Override
\n
"
"public Builder mergeFrom(
\n
"
" com.google.protobuf.CodedInputStream input,
\n
"
" com.google.protobuf.ExtensionRegistry extensionRegistry)
\n
"
...
...
@@ -656,6 +666,7 @@ void MessageGenerator::GenerateBuilderParsingMethods(io::Printer* printer) {
void
MessageGenerator
::
GenerateIsInitialized
(
io
::
Printer
*
printer
)
{
printer
->
Print
(
"@Override
\n
"
"public final boolean isInitialized() {
\n
"
);
printer
->
Indent
();
...
...
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