diff options
author | Nickolay Mazurkin <mazurkin@gmail.com> | 2016-09-18 10:38:18 +0300 |
---|---|---|
committer | Nickolay Mazurkin <mazurkin@gmail.com> | 2016-09-18 15:48:08 +0300 |
commit | aba6f7ef6703d72eda3d063dc2e6566d84f080a5 (patch) | |
tree | 7f49320e07120b3931b8ee59470495001b6e1a61 /src/google/protobuf/compiler/java/java_enum_field.cc | |
parent | c44ca26fe89ed8a81d3ee475a2ccc1797141dbce (diff) |
[issue-2108] [protoc/java] Excessive copying on buildPartial()
Diffstat (limited to 'src/google/protobuf/compiler/java/java_enum_field.cc')
-rw-r--r-- | src/google/protobuf/compiler/java/java_enum_field.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/google/protobuf/compiler/java/java_enum_field.cc b/src/google/protobuf/compiler/java/java_enum_field.cc index 2e916c56..8883eb14 100644 --- a/src/google/protobuf/compiler/java/java_enum_field.cc +++ b/src/google/protobuf/compiler/java/java_enum_field.cc @@ -292,11 +292,15 @@ GenerateBuildingCode(io::Printer* printer) const { if (SupportFieldPresence(descriptor_->file())) { printer->Print(variables_, "if ($get_has_field_bit_from_local$) {\n" + " result.$name$_ = $name$_;\n" " $set_has_field_bit_to_local$;\n" + "} else {\n" + " result.$name$_ = $default_number$;\n" "}\n"); + } else { + printer->Print(variables_, + "result.$name$_ = $name$_;\n"); } - printer->Print(variables_, - "result.$name$_ = $name$_;\n"); } void ImmutableEnumFieldGenerator:: |