diff --git a/examples/README.md b/examples/README.md index 430568e14e..64e6d907ba 100644 --- a/examples/README.md +++ b/examples/README.md @@ -28,7 +28,7 @@ Then you can run the built binary: $ bazel-bin/add_person_cpp addressbook.data To use protobuf in your own bazel project, please follow instructions in the -[BUILD](BUILD) file and [WORKSPACE](WORKSPACE) file. +[BUILD.bazel](BUILD.bazel) file and [WORKSPACE](WORKSPACE) file. ## Build the example using make diff --git a/java/core/src/main/java/com/google/protobuf/ExtensionSchemaLite.java b/java/core/src/main/java/com/google/protobuf/ExtensionSchemaLite.java index 880ee29ffa..ca0095123f 100644 --- a/java/core/src/main/java/com/google/protobuf/ExtensionSchemaLite.java +++ b/java/core/src/main/java/com/google/protobuf/ExtensionSchemaLite.java @@ -255,12 +255,40 @@ final class ExtensionSchemaLite extends ExtensionSchema { value = reader.readString(); break; case GROUP: + if (!extension.isRepeated()) { + Object oldValue = extensions.getField(extension.descriptor); + if (oldValue instanceof GeneratedMessageLite) { + Schema extSchema = Protobuf.getInstance().schemaFor(oldValue); + if (!((GeneratedMessageLite) oldValue).isMutable()) { + Object newValue = extSchema.newInstance(); + extSchema.mergeFrom(newValue, oldValue); + extensions.setField(extension.descriptor, newValue); + oldValue = newValue; + } + reader.mergeGroupField(oldValue, extSchema, extensionRegistry); + return unknownFields; + } + } value = reader.readGroup( extension.getMessageDefaultInstance().getClass(), extensionRegistry); break; case MESSAGE: + if (!extension.isRepeated()) { + Object oldValue = extensions.getField(extension.descriptor); + if (oldValue instanceof GeneratedMessageLite) { + Schema extSchema = Protobuf.getInstance().schemaFor(oldValue); + if (!((GeneratedMessageLite) oldValue).isMutable()) { + Object newValue = extSchema.newInstance(); + extSchema.mergeFrom(newValue, oldValue); + extensions.setField(extension.descriptor, newValue); + oldValue = newValue; + } + reader.mergeMessageField(oldValue, extSchema, extensionRegistry); + return unknownFields; + } + } value = reader.readMessage( extension.getMessageDefaultInstance().getClass(), extensionRegistry); diff --git a/java/core/src/main/java/com/google/protobuf/FieldSet.java b/java/core/src/main/java/com/google/protobuf/FieldSet.java index 21dd8d229f..4f514c224e 100644 --- a/java/core/src/main/java/com/google/protobuf/FieldSet.java +++ b/java/core/src/main/java/com/google/protobuf/FieldSet.java @@ -123,6 +123,11 @@ final class FieldSet> { if (isImmutable) { return; } + for (Object value : fields.values()) { + if (value instanceof GeneratedMessageLite) { + ((GeneratedMessageLite) value).makeImmutable(); + } + } fields.makeImmutable(); isImmutable = true; } diff --git a/third_party/googletest b/third_party/googletest index 4c9a3bb62b..5ec7f0c4a1 160000 --- a/third_party/googletest +++ b/third_party/googletest @@ -1 +1 @@ -Subproject commit 4c9a3bb62bf3ba1f1010bf96f9c8ed767b363774 +Subproject commit 5ec7f0c4a113e2f18ac2c6cc7df51ad6afc24081