History log of /external/protobuf/java/src/main/java/com/google/protobuf/nano/UnknownFieldData.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
cf1b416ae1327a26dd53a691fc1b3e30eec8e6a6 17-Jun-2014 Juan Silveira <jjso@google.com> 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
/external/protobuf/java/src/main/java/com/google/protobuf/nano/UnknownFieldData.java
ccc48faf20dbf3b3cddcffe78d198876d543529b 16-Oct-2013 Brian Duff <bduff@google.com> Implement hashCode() and equals() behind a generator option.

The option is only called 'generate_equals' because:
- equals() is the main thing; hashCode() is there only to
complement equals();
- it's shorter;
- toString() should not be included in this option because
it's more for debugging and it's more likely to stop
ProGuard from working well.

Also shortened the "has bit" expression; was
((bitField & mask) == mask), now ((bitField & mask) != 0).
Both the Java code and the bytecode are slightly shorter.

Change-Id: Ic309a08a60883bf454eb6612679aa99611620e76
/external/protobuf/java/src/main/java/com/google/protobuf/nano/UnknownFieldData.java
0e055f079f53b07de3705838a7b4742ce56839f8 19-Jun-2013 Brian Duff <bduff@google.com> Nano support for extensions and unknown fields.

You can use the processor option store_unknown_fields to switch
this support on:

aprotoc --javanano_out=store_unknown_fields=true:/tmp/out

A separate option for extensions isn't required. Support
for unknown fields must be turned on to allow storing and
retrieving extensions, because they are just stored as
unknown fields. If unknown fields are switched on, extension
related code will be generated when a proto message includes
an extension range, or an extension is encountered.

By default, store_unknown_fields is false. No additional
code is generated, and the generator will error out if protos
contain extension ranges or extensions.

Change-Id: I1e034c9e8f3305612953f72438189a7da6ed2167
/external/protobuf/java/src/main/java/com/google/protobuf/nano/UnknownFieldData.java