aboutsummaryrefslogtreecommitdiffstats
path: root/java/pom.xml
diff options
context:
space:
mode:
authorJuan Silveira <jjso@google.com>2014-06-17 15:01:22 +0100
committerJuan Silveira <jjso@google.com>2014-07-14 16:54:28 +0100
commitcf1b416ae1327a26dd53a691fc1b3e30eec8e6a6 (patch)
treeccea2bfb1ab3fbb41e34fb907af20e7544f21c0c /java/pom.xml
parent94f522f907e3f34f70d9e7816b947e62fddbb267 (diff)
downloadexternal_protobuf-cf1b416ae1327a26dd53a691fc1b3e30eec8e6a6.zip
external_protobuf-cf1b416ae1327a26dd53a691fc1b3e30eec8e6a6.tar.gz
external_protobuf-cf1b416ae1327a26dd53a691fc1b3e30eec8e6a6.tar.bz2
Keep pointers to extension values.
The current implementation of getExtension deserialises the field from bytes and returns a new object every time. This means that changes to those objects are reflected when the messages is serialised unless setExtension is called. It also means that every call to getExtension and setExtension is expensive. This change introduces a FieldData class that contains everything that's known about the field at the time. This can be all the tag/byte[] pairs associated with a given field or an Extension and a value object. This is so that two messages with a repeated extension can be compared even if the extension has been deserialised in one of them but not the other. This change also adds FieldArray class based on SparseArray from the Android compatibility library. This is used in ExtendableMessageNano to make lookup of FieldDatas by their field number faster. Implications: * calling getExtension multiple times deserialises the field only once and returns the same object. * calling setExtension doesn't cause the object to be serialised immediately, that only happens when the container message is serialised. * getExtension is no longer a read-only thread-safe operation. README.txt has been updated to relfect that. * comparison using equals and hashCode continues to work. Bug: 10863158 Change-Id: I81c7cb0c73cc0611a1f7c1eabf5eed259738e8bc
Diffstat (limited to 'java/pom.xml')
-rw-r--r--java/pom.xml6
1 files changed, 3 insertions, 3 deletions
diff --git a/java/pom.xml b/java/pom.xml
index 5b49a72..0a29f31 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -152,19 +152,19 @@
<arg value="../src/google/protobuf/unittest_repeated_merge_nano.proto" />
</exec>
<exec executable="../src/protoc">
- <arg value="--javanano_out=store_unknown_fields=true:target/generated-test-sources" />
+ <arg value="--javanano_out=store_unknown_fields=true,generate_equals=true:target/generated-test-sources" />
<arg value="--proto_path=../src" />
<arg value="--proto_path=src/test/java" />
<arg value="../src/google/protobuf/unittest_extension_nano.proto" />
</exec>
<exec executable="../src/protoc">
- <arg value="--javanano_out=store_unknown_fields=true:target/generated-test-sources" />
+ <arg value="--javanano_out=store_unknown_fields=true,generate_equals=true:target/generated-test-sources" />
<arg value="--proto_path=../src" />
<arg value="--proto_path=src/test/java" />
<arg value="../src/google/protobuf/unittest_extension_singular_nano.proto" />
</exec>
<exec executable="../src/protoc">
- <arg value="--javanano_out=store_unknown_fields=true:target/generated-test-sources" />
+ <arg value="--javanano_out=store_unknown_fields=true,generate_equals=true:target/generated-test-sources" />
<arg value="--proto_path=../src" />
<arg value="--proto_path=src/test/java" />
<arg value="../src/google/protobuf/unittest_extension_repeated_nano.proto" />