diff options
author | Max Cai <maxtroy@google.com> | 2013-10-16 16:26:50 +0100 |
---|---|---|
committer | Max Cai <maxtroy@google.com> | 2013-10-16 16:28:03 +0100 |
commit | b15a1b379f896e371ca3375bdf51dd4a9a0268af (patch) | |
tree | 5efc9c514a88a8f0268bafc468c5742e9ec63461 /java/src | |
parent | c50f605c572a425b2fa696fedc5e61ac6f66d2a9 (diff) | |
download | external_protobuf-b15a1b379f896e371ca3375bdf51dd4a9a0268af.zip external_protobuf-b15a1b379f896e371ca3375bdf51dd4a9a0268af.tar.gz external_protobuf-b15a1b379f896e371ca3375bdf51dd4a9a0268af.tar.bz2 |
Feature request: set() and clear() accessors return this
Also pre-inlines set() and has() in serialization code. This could
theoretically help ProGuard: the message class size is usually large,
and because of this only, it may refuse to inline an accessor into
the serialization code, and as a result keeps the accessor intact.
Chances are, after pre-inlining all accessor calls within the message
class, those accessors become unused or single-use, so there are more
reasons for ProGuard to inline and then remove them.
Change-Id: I57decbe0b2533c1be21439de0aad15f49c7024dd
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/test/java/com/google/protobuf/NanoTest.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/java/src/test/java/com/google/protobuf/NanoTest.java b/java/src/test/java/com/google/protobuf/NanoTest.java index d4e9dfc..1149c40 100644 --- a/java/src/test/java/com/google/protobuf/NanoTest.java +++ b/java/src/test/java/com/google/protobuf/NanoTest.java @@ -2322,6 +2322,12 @@ public class NanoTest extends TestCase { assertFalse(msg.hasOptionalString()); assertFalse(msg.hasDefaultString()); assertFalse(msg.hasBitFieldCheck()); + + // Test set() and clear() returns itself (compiles = success) + msg.clear() + .setOptionalInt32(3) + .clearDefaultBytes() + .setOptionalString("4"); } public void testNanoWithAccessorsParseFrom() throws Exception { |