Index: third_party/protobuf/src/google/protobuf/compiler/java/java_enum_field_lite.cc |
diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/java_enum_field_lite.cc b/third_party/protobuf/src/google/protobuf/compiler/java/java_enum_field_lite.cc |
index 908d6db413144a22e7cd09a833bce5a07a14ef30..aa0eb5e829f046f0897643c0283563ad6ad66144 100644 |
--- a/third_party/protobuf/src/google/protobuf/compiler/java/java_enum_field_lite.cc |
+++ b/third_party/protobuf/src/google/protobuf/compiler/java/java_enum_field_lite.cc |
@@ -258,7 +258,9 @@ GenerateFieldBuilderInitializationCode(io::Printer* printer) const { |
void ImmutableEnumFieldLiteGenerator:: |
GenerateInitializationCode(io::Printer* printer) const { |
- printer->Print(variables_, "$name$_ = $default_number$;\n"); |
+ if (!IsDefaultValueJavaDefault(descriptor_)) { |
+ printer->Print(variables_, "$name$_ = $default_number$;\n"); |
+ } |
} |
void ImmutableEnumFieldLiteGenerator:: |
@@ -885,8 +887,8 @@ GenerateSerializationCode(io::Printer* printer) const { |
if (descriptor_->options().packed()) { |
printer->Print(variables_, |
"if (get$capitalized_name$List().size() > 0) {\n" |
- " output.writeRawVarint32($tag$);\n" |
- " output.writeRawVarint32($name$MemoizedSerializedSize);\n" |
+ " output.writeUInt32NoTag($tag$);\n" |
+ " output.writeUInt32NoTag($name$MemoizedSerializedSize);\n" |
"}\n" |
"for (int i = 0; i < $name$_.size(); i++) {\n" |
" output.writeEnumNoTag($name$_.getInt(i));\n" |
@@ -918,7 +920,7 @@ GenerateSerializedSizeCode(io::Printer* printer) const { |
"if (!get$capitalized_name$List().isEmpty()) {" |
" size += $tag_size$;\n" |
" size += com.google.protobuf.CodedOutputStream\n" |
- " .computeRawVarint32Size(dataSize);\n" |
+ " .computeUInt32SizeNoTag(dataSize);\n" |
"}"); |
} else { |
printer->Print(variables_, |