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 | fba329d6d51220f9e70c0c24919a84379772d5c0 (patch) | |
tree | 8c1814b47c7f8838295c60ef894e429bcda8b376 /java/src | |
parent | 10040938289f723102c2e3d4823623c4d6cd016a (diff) | |
download | protobuf-fba329d6d51220f9e70c0c24919a84379772d5c0.tar.gz protobuf-fba329d6d51220f9e70c0c24919a84379772d5c0.tar.bz2 protobuf-fba329d6d51220f9e70c0c24919a84379772d5c0.zip |
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 d4e9dfcb..1149c40b 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 { |