diff options
author | Brian Duff <bduff@google.com> | 2013-10-15 18:35:44 -0700 |
---|---|---|
committer | Max Cai <maxtroy@google.com> | 2013-10-25 16:06:21 +0100 |
commit | ccc48faf20dbf3b3cddcffe78d198876d543529b (patch) | |
tree | 82a2f42e9d464661152539821093b14fbc068189 /java/pom.xml | |
parent | 42be1e79ccd670be36220222936aa7cacc6856f6 (diff) | |
download | external_protobuf-ccc48faf20dbf3b3cddcffe78d198876d543529b.zip external_protobuf-ccc48faf20dbf3b3cddcffe78d198876d543529b.tar.gz external_protobuf-ccc48faf20dbf3b3cddcffe78d198876d543529b.tar.bz2 |
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
Diffstat (limited to 'java/pom.xml')
-rw-r--r-- | java/pom.xml | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/java/pom.xml b/java/pom.xml index dcc1cfa..cfa35a5 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -133,7 +133,7 @@ </exec> <!-- java nano --> <exec executable="../src/protoc"> - <arg value="--javanano_out=java_package=google/protobuf/unittest_import_nano.proto|com.google.protobuf.nano,java_outer_classname=google/protobuf/unittest_import_nano.proto|UnittestImportNano:target/generated-test-sources" /> + <arg value="--javanano_out=java_package=google/protobuf/unittest_import_nano.proto|com.google.protobuf.nano,java_outer_classname=google/protobuf/unittest_import_nano.proto|UnittestImportNano,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_nano.proto" /> @@ -154,13 +154,13 @@ <arg value="../src/google/protobuf/unittest_extension_nano.proto" /> </exec> <exec executable="../src/protoc"> - <arg value="--javanano_out=java_nano_generate_has=true:target/generated-test-sources" /> + <arg value="--javanano_out=java_nano_generate_has=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_has_nano.proto" /> </exec> <exec executable="../src/protoc"> - <arg value="--javanano_out=optional_field_style=accessors:target/generated-test-sources" /> + <arg value="--javanano_out=optional_field_style=accessors,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_accessors_nano.proto" /> @@ -173,7 +173,7 @@ <arg value="../src/google/protobuf/unittest_enum_class_multiple_nano.proto" /> </exec> <exec executable="../src/protoc"> - <arg value="--javanano_out=optional_field_style=reftypes:target/generated-test-sources" /> + <arg value="--javanano_out=optional_field_style=reftypes,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_reference_types_nano.proto" /> |