| Index: third_party/protobuf/src/google/protobuf/compiler/java/java_string_field.cc
|
| diff --git a/third_party/protobuf/src/google/protobuf/compiler/java/java_string_field.cc b/third_party/protobuf/src/google/protobuf/compiler/java/java_string_field.cc
|
| index 7f757e4764c5cc9b007d4472f75b72b422bf5f53..b67eeb5326c8f255df4c84198eb13277d734e543 100644
|
| --- a/third_party/protobuf/src/google/protobuf/compiler/java/java_string_field.cc
|
| +++ b/third_party/protobuf/src/google/protobuf/compiler/java/java_string_field.cc
|
| @@ -87,8 +87,7 @@ void SetPrimitiveVariables(const FieldDescriptor* descriptor,
|
| // by the proto compiler
|
| (*variables)["deprecation"] = descriptor->options().deprecated()
|
| ? "@java.lang.Deprecated " : "";
|
| - (*variables)["on_changed"] =
|
| - HasDescriptorMethods(descriptor->containing_type()) ? "onChanged();" : "";
|
| + (*variables)["on_changed"] = "onChanged();";
|
|
|
| if (SupportFieldPresence(descriptor->file())) {
|
| // For singular messages and builders, one bit is used for the hasField bit.
|
| @@ -408,15 +407,6 @@ GenerateParsingCode(io::Printer* printer) const {
|
| "java.lang.String s = input.readStringRequireUtf8();\n"
|
| "$set_has_field_bit_message$\n"
|
| "$name$_ = s;\n");
|
| - } else if (!HasDescriptorMethods(descriptor_->file())) {
|
| - // Lite runtime should attempt to reduce allocations by attempting to
|
| - // construct the string directly from the input stream buffer. This avoids
|
| - // spurious intermediary ByteString allocations, cutting overall allocations
|
| - // in half.
|
| - printer->Print(variables_,
|
| - "java.lang.String s = input.readString();\n"
|
| - "$set_has_field_bit_message$\n"
|
| - "$name$_ = s;\n");
|
| } else {
|
| printer->Print(variables_,
|
| "com.google.protobuf.ByteString bs = input.readBytes();\n"
|
| @@ -668,15 +658,6 @@ GenerateParsingCode(io::Printer* printer) const {
|
| "java.lang.String s = input.readStringRequireUtf8();\n"
|
| "$set_oneof_case_message$;\n"
|
| "$oneof_name$_ = s;\n");
|
| - } else if (!HasDescriptorMethods(descriptor_->file())) {
|
| - // Lite runtime should attempt to reduce allocations by attempting to
|
| - // construct the string directly from the input stream buffer. This avoids
|
| - // spurious intermediary ByteString allocations, cutting overall allocations
|
| - // in half.
|
| - printer->Print(variables_,
|
| - "java.lang.String s = input.readString();\n"
|
| - "$set_oneof_case_message$;\n"
|
| - "$oneof_name$_ = s;\n");
|
| } else {
|
| printer->Print(variables_,
|
| "com.google.protobuf.ByteString bs = input.readBytes();\n"
|
| @@ -934,13 +915,6 @@ GenerateParsingCode(io::Printer* printer) const {
|
| if (CheckUtf8(descriptor_)) {
|
| printer->Print(variables_,
|
| "java.lang.String s = input.readStringRequireUtf8();\n");
|
| - } else if (!HasDescriptorMethods(descriptor_->file())) {
|
| - // Lite runtime should attempt to reduce allocations by attempting to
|
| - // construct the string directly from the input stream buffer. This avoids
|
| - // spurious intermediary ByteString allocations, cutting overall allocations
|
| - // in half.
|
| - printer->Print(variables_,
|
| - "java.lang.String s = input.readString();\n");
|
| } else {
|
| printer->Print(variables_,
|
| "com.google.protobuf.ByteString bs = input.readBytes();\n");
|
| @@ -950,7 +924,7 @@ GenerateParsingCode(io::Printer* printer) const {
|
| " $name$_ = new com.google.protobuf.LazyStringArrayList();\n"
|
| " $set_mutable_bit_parser$;\n"
|
| "}\n");
|
| - if (CheckUtf8(descriptor_) || !HasDescriptorMethods(descriptor_->file())) {
|
| + if (CheckUtf8(descriptor_)) {
|
| printer->Print(variables_,
|
| "$name$_.add(s);\n");
|
| } else {
|
|
|