diff options
author | Max Cai <maxtroy@google.com> | 2013-10-16 15:11:26 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2013-10-16 15:11:27 +0000 |
commit | c50f605c572a425b2fa696fedc5e61ac6f66d2a9 (patch) | |
tree | ee56a3bbe964262907ea8304307ba163baf589a5 /src/google/protobuf/compiler/javanano/javanano_message_field.cc | |
parent | afaf74ce55f4aff63dc30e7045a7cd6c1cf232dc (diff) | |
parent | 286271f75aa6ff1f3746379b77d6dc55415baa16 (diff) | |
download | external_protobuf-c50f605c572a425b2fa696fedc5e61ac6f66d2a9.zip external_protobuf-c50f605c572a425b2fa696fedc5e61ac6f66d2a9.tar.gz external_protobuf-c50f605c572a425b2fa696fedc5e61ac6f66d2a9.tar.bz2 |
Merge "Make generated code more aligned with Google Java style."
Diffstat (limited to 'src/google/protobuf/compiler/javanano/javanano_message_field.cc')
-rw-r--r-- | src/google/protobuf/compiler/javanano/javanano_message_field.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/google/protobuf/compiler/javanano/javanano_message_field.cc b/src/google/protobuf/compiler/javanano/javanano_message_field.cc index 027428f..225cf42 100644 --- a/src/google/protobuf/compiler/javanano/javanano_message_field.cc +++ b/src/google/protobuf/compiler/javanano/javanano_message_field.cc @@ -98,7 +98,7 @@ GenerateMergingCode(io::Printer* printer) const { printer->Print(variables_, "if (this.$name$ == null) {\n" " this.$name$ = new $type$();\n" - "}"); + "}\n"); if (descriptor_->type() == FieldDescriptor::TYPE_GROUP) { printer->Print(variables_, @@ -173,7 +173,7 @@ GenerateMergingCode(io::Printer* printer) const { printer->Print(variables_, "if (!has$capitalized_name$()) {\n" " set$capitalized_name$(new $type$());\n" - "}"); + "}\n"); if (descriptor_->type() == FieldDescriptor::TYPE_GROUP) { printer->Print(variables_, @@ -231,10 +231,11 @@ void RepeatedMessageFieldGenerator:: GenerateMergingCode(io::Printer* printer) const { // First, figure out the length of the array, then parse. printer->Print(variables_, - "int arrayLength = com.google.protobuf.nano.WireFormatNano" + "int arrayLength = com.google.protobuf.nano.WireFormatNano\n" " .getRepeatedFieldArrayLength(input, $tag$);\n" "int i = this.$name$ == null ? 0 : this.$name$.length;\n" - "$type$[] newArray = new $type$[i + arrayLength];\n" + "$type$[] newArray =\n" + " new $type$[i + arrayLength];\n" "if (i != 0) {\n" " java.lang.System.arraycopy(this.$name$, 0, newArray, 0, i);\n" "}\n" |