diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2015-06-25 00:13:12 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2015-06-25 00:13:12 +0200 |
commit | 251fd03cd78ef6996d4252450bda596a5e8b11b9 (patch) | |
tree | 6cd9f4a8510ffabed01cd5eae60c0e1b6f2d2b35 /test/transform/resource/after-ecj | |
parent | 23dcc9f5a5f3c24ccfb2f98ab556daed0dee3c89 (diff) | |
download | lombok-251fd03cd78ef6996d4252450bda596a5e8b11b9.tar.gz lombok-251fd03cd78ef6996d4252450bda596a5e8b11b9.tar.bz2 lombok-251fd03cd78ef6996d4252450bda596a5e8b11b9.zip |
The hashCode() method now generates a magic prime instead of 0 for the hash of null values; this reduces collisions.
Diffstat (limited to 'test/transform/resource/after-ecj')
9 files changed, 16 insertions, 16 deletions
diff --git a/test/transform/resource/after-ecj/Accessors.java b/test/transform/resource/after-ecj/Accessors.java index 1b50c97e..450c35fa 100644 --- a/test/transform/resource/after-ecj/Accessors.java +++ b/test/transform/resource/after-ecj/Accessors.java @@ -93,7 +93,7 @@ class AccessorsChain { final int PRIME = 59; int result = 1; final java.lang.Object $fName = this.getName(); - result = ((result * PRIME) + (($fName == null) ? 0 : $fName.hashCode())); + result = ((result * PRIME) + (($fName == null) ? 43 : $fName.hashCode())); return result; } } diff --git a/test/transform/resource/after-ecj/DataOnLocalClass.java b/test/transform/resource/after-ecj/DataOnLocalClass.java index 856160de..9d6bced1 100644 --- a/test/transform/resource/after-ecj/DataOnLocalClass.java +++ b/test/transform/resource/after-ecj/DataOnLocalClass.java @@ -40,7 +40,7 @@ class DataOnLocalClass1 { int result = 1; result = ((result * PRIME) + this.getX()); final java.lang.Object $name = this.getName(); - result = ((result * PRIME) + (($name == null) ? 0 : $name.hashCode())); + result = ((result * PRIME) + (($name == null) ? 43 : $name.hashCode())); return result; } public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") java.lang.String toString() { @@ -89,7 +89,7 @@ class DataOnLocalClass2 { final int PRIME = 59; int result = 1; final java.lang.Object $name = this.getName(); - result = ((result * PRIME) + (($name == null) ? 0 : $name.hashCode())); + result = ((result * PRIME) + (($name == null) ? 43 : $name.hashCode())); return result; } public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") java.lang.String toString() { diff --git a/test/transform/resource/after-ecj/DataPlain.java b/test/transform/resource/after-ecj/DataPlain.java index 8b243766..ba6c75c8 100644 --- a/test/transform/resource/after-ecj/DataPlain.java +++ b/test/transform/resource/after-ecj/DataPlain.java @@ -35,7 +35,7 @@ import lombok.Data; int result = 1; result = ((result * PRIME) + this.getX()); final java.lang.Object $name = this.getName(); - result = ((result * PRIME) + (($name == null) ? 0 : $name.hashCode())); + result = ((result * PRIME) + (($name == null) ? 43 : $name.hashCode())); return result; } public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") java.lang.String toString() { @@ -82,7 +82,7 @@ import lombok.Data; int result = 1; result = ((result * PRIME) + this.getX()); final java.lang.Object $name = this.getName(); - result = ((result * PRIME) + (($name == null) ? 0 : $name.hashCode())); + result = ((result * PRIME) + (($name == null) ? 43 : $name.hashCode())); return result; } public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") java.lang.String toString() { @@ -124,7 +124,7 @@ final @Data class Data3 { int result = 1; result = ((result * PRIME) + this.getX()); final java.lang.Object $name = this.getName(); - result = ((result * PRIME) + (($name == null) ? 0 : $name.hashCode())); + result = ((result * PRIME) + (($name == null) ? 43 : $name.hashCode())); return result; } public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") java.lang.String toString() { diff --git a/test/transform/resource/after-ecj/DataWithGetter.java b/test/transform/resource/after-ecj/DataWithGetter.java index b37aa137..5a358c89 100644 --- a/test/transform/resource/after-ecj/DataWithGetter.java +++ b/test/transform/resource/after-ecj/DataWithGetter.java @@ -35,7 +35,7 @@ result = ((result * PRIME) + this.getX()); result = ((result * PRIME) + this.getY()); final java.lang.Object $z = this.getZ(); - result = ((result * PRIME) + (($z == null) ? 0 : $z.hashCode())); + result = ((result * PRIME) + (($z == null) ? 43 : $z.hashCode())); return result; } public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") java.lang.String toString() { diff --git a/test/transform/resource/after-ecj/DataWithGetterNone.java b/test/transform/resource/after-ecj/DataWithGetterNone.java index 66a26277..b03ce146 100644 --- a/test/transform/resource/after-ecj/DataWithGetterNone.java +++ b/test/transform/resource/after-ecj/DataWithGetterNone.java @@ -35,7 +35,7 @@ result = ((result * PRIME) + this.x); result = ((result * PRIME) + this.y); final java.lang.Object $z = this.z; - result = ((result * PRIME) + (($z == null) ? 0 : $z.hashCode())); + result = ((result * PRIME) + (($z == null) ? 43 : $z.hashCode())); return result; } public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") java.lang.String toString() { diff --git a/test/transform/resource/after-ecj/EqualsAndHashCode.java b/test/transform/resource/after-ecj/EqualsAndHashCode.java index 7db65c82..c0bb5bbb 100644 --- a/test/transform/resource/after-ecj/EqualsAndHashCode.java +++ b/test/transform/resource/after-ecj/EqualsAndHashCode.java @@ -41,9 +41,9 @@ result = ((result * PRIME) + java.util.Arrays.hashCode(this.y)); result = ((result * PRIME) + java.util.Arrays.deepHashCode(this.z)); final java.lang.Object $a = this.a; - result = ((result * PRIME) + (($a == null) ? 0 : $a.hashCode())); + result = ((result * PRIME) + (($a == null) ? 43 : $a.hashCode())); final java.lang.Object $b = this.b; - result = ((result * PRIME) + (($b == null) ? 0 : $b.hashCode())); + result = ((result * PRIME) + (($b == null) ? 43 : $b.hashCode())); return result; } } diff --git a/test/transform/resource/after-ecj/EqualsAndHashCodeWithOnParam.java b/test/transform/resource/after-ecj/EqualsAndHashCodeWithOnParam.java index 77bba8e0..a59d2835 100644 --- a/test/transform/resource/after-ecj/EqualsAndHashCodeWithOnParam.java +++ b/test/transform/resource/after-ecj/EqualsAndHashCodeWithOnParam.java @@ -44,9 +44,9 @@ result = ((result * PRIME) + java.util.Arrays.hashCode(this.y)); result = ((result * PRIME) + java.util.Arrays.deepHashCode(this.z)); final java.lang.Object $a = this.a; - result = ((result * PRIME) + (($a == null) ? 0 : $a.hashCode())); + result = ((result * PRIME) + (($a == null) ? 43 : $a.hashCode())); final java.lang.Object $b = this.b; - result = ((result * PRIME) + (($b == null) ? 0 : $b.hashCode())); + result = ((result * PRIME) + (($b == null) ? 43 : $b.hashCode())); return result; } }
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/GetterLazyEahcToString.java b/test/transform/resource/after-ecj/GetterLazyEahcToString.java index f0cb2ec2..40716f8b 100644 --- a/test/transform/resource/after-ecj/GetterLazyEahcToString.java +++ b/test/transform/resource/after-ecj/GetterLazyEahcToString.java @@ -49,9 +49,9 @@ final int PRIME = 59; int result = 1; final java.lang.Object $value = this.getValue(); - result = ((result * PRIME) + (($value == null) ? 0 : $value.hashCode())); + result = ((result * PRIME) + (($value == null) ? 43 : $value.hashCode())); final java.lang.Object $value2 = this.value2; - result = ((result * PRIME) + (($value2 == null) ? 0 : $value2.hashCode())); + result = ((result * PRIME) + (($value2 == null) ? 43 : $value2.hashCode())); return result; } public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") java.lang.String toString() { diff --git a/test/transform/resource/after-ecj/ValuePlain.java b/test/transform/resource/after-ecj/ValuePlain.java index 1fd05da8..6a3265c9 100644 --- a/test/transform/resource/after-ecj/ValuePlain.java +++ b/test/transform/resource/after-ecj/ValuePlain.java @@ -27,7 +27,7 @@ final @lombok.Value class Value1 { int result = 1; result = ((result * PRIME) + this.getX()); final java.lang.Object $name = this.getName(); - result = ((result * PRIME) + (($name == null) ? 0 : $name.hashCode())); + result = ((result * PRIME) + (($name == null) ? 43 : $name.hashCode())); return result; } public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") java.lang.String toString() { @@ -72,7 +72,7 @@ final @lombok.Value class Value1 { int result = 1; result = ((result * PRIME) + this.getX()); final java.lang.Object $name = this.getName(); - result = ((result * PRIME) + (($name == null) ? 0 : $name.hashCode())); + result = ((result * PRIME) + (($name == null) ? 43 : $name.hashCode())); return result; } public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") java.lang.String toString() { |