aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2015-06-25 00:13:12 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2015-06-25 00:13:12 +0200
commit251fd03cd78ef6996d4252450bda596a5e8b11b9 (patch)
tree6cd9f4a8510ffabed01cd5eae60c0e1b6f2d2b35 /test
parent23dcc9f5a5f3c24ccfb2f98ab556daed0dee3c89 (diff)
downloadlombok-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')
-rw-r--r--test/transform/resource/after-delombok/Accessors.java2
-rw-r--r--test/transform/resource/after-delombok/DataOnLocalClass.java4
-rw-r--r--test/transform/resource/after-delombok/DataPlain.java6
-rw-r--r--test/transform/resource/after-delombok/DataWithGetter.java2
-rw-r--r--test/transform/resource/after-delombok/DataWithGetterNone.java2
-rw-r--r--test/transform/resource/after-delombok/EqualsAndHashCode.java4
-rw-r--r--test/transform/resource/after-delombok/EqualsAndHashCodeWithOnParam.java4
-rw-r--r--test/transform/resource/after-delombok/GetterLazyEahcToString.java4
-rw-r--r--test/transform/resource/after-delombok/ValuePlain.java4
-rw-r--r--test/transform/resource/after-ecj/Accessors.java2
-rw-r--r--test/transform/resource/after-ecj/DataOnLocalClass.java4
-rw-r--r--test/transform/resource/after-ecj/DataPlain.java6
-rw-r--r--test/transform/resource/after-ecj/DataWithGetter.java2
-rw-r--r--test/transform/resource/after-ecj/DataWithGetterNone.java2
-rw-r--r--test/transform/resource/after-ecj/EqualsAndHashCode.java4
-rw-r--r--test/transform/resource/after-ecj/EqualsAndHashCodeWithOnParam.java4
-rw-r--r--test/transform/resource/after-ecj/GetterLazyEahcToString.java4
-rw-r--r--test/transform/resource/after-ecj/ValuePlain.java4
18 files changed, 32 insertions, 32 deletions
diff --git a/test/transform/resource/after-delombok/Accessors.java b/test/transform/resource/after-delombok/Accessors.java
index 3346bacb..3f4698e0 100644
--- a/test/transform/resource/after-delombok/Accessors.java
+++ b/test/transform/resource/after-delombok/Accessors.java
@@ -100,7 +100,7 @@ class AccessorsPrefix3 {
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-delombok/DataOnLocalClass.java b/test/transform/resource/after-delombok/DataOnLocalClass.java
index 57f04bf3..44b069fd 100644
--- a/test/transform/resource/after-delombok/DataOnLocalClass.java
+++ b/test/transform/resource/after-delombok/DataOnLocalClass.java
@@ -50,7 +50,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;
}
@java.lang.Override
@@ -116,7 +116,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;
}
@java.lang.Override
diff --git a/test/transform/resource/after-delombok/DataPlain.java b/test/transform/resource/after-delombok/DataPlain.java
index 4ddb9414..cfb72656 100644
--- a/test/transform/resource/after-delombok/DataPlain.java
+++ b/test/transform/resource/after-delombok/DataPlain.java
@@ -49,7 +49,7 @@ class Data1 {
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;
}
@java.lang.Override
@@ -110,7 +110,7 @@ class Data2 {
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;
}
@java.lang.Override
@@ -165,7 +165,7 @@ final 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;
}
@java.lang.Override
diff --git a/test/transform/resource/after-delombok/DataWithGetter.java b/test/transform/resource/after-delombok/DataWithGetter.java
index 232f783b..f849e0f8 100644
--- a/test/transform/resource/after-delombok/DataWithGetter.java
+++ b/test/transform/resource/after-delombok/DataWithGetter.java
@@ -47,7 +47,7 @@ class DataWithGetter {
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;
}
@java.lang.Override
diff --git a/test/transform/resource/after-delombok/DataWithGetterNone.java b/test/transform/resource/after-delombok/DataWithGetterNone.java
index 9e1fb60a..c46be723 100644
--- a/test/transform/resource/after-delombok/DataWithGetterNone.java
+++ b/test/transform/resource/after-delombok/DataWithGetterNone.java
@@ -47,7 +47,7 @@ class DataWithGetterNone {
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;
}
@java.lang.Override
diff --git a/test/transform/resource/after-delombok/EqualsAndHashCode.java b/test/transform/resource/after-delombok/EqualsAndHashCode.java
index a15b71b0..d0ed4067 100644
--- a/test/transform/resource/after-delombok/EqualsAndHashCode.java
+++ b/test/transform/resource/after-delombok/EqualsAndHashCode.java
@@ -38,9 +38,9 @@ class EqualsAndHashCode {
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-delombok/EqualsAndHashCodeWithOnParam.java b/test/transform/resource/after-delombok/EqualsAndHashCodeWithOnParam.java
index 733959b0..69b69d29 100644
--- a/test/transform/resource/after-delombok/EqualsAndHashCodeWithOnParam.java
+++ b/test/transform/resource/after-delombok/EqualsAndHashCodeWithOnParam.java
@@ -41,9 +41,9 @@ class EqualsAndHashCodeWithOnParam {
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-delombok/GetterLazyEahcToString.java b/test/transform/resource/after-delombok/GetterLazyEahcToString.java
index c89b2980..db075cde 100644
--- a/test/transform/resource/after-delombok/GetterLazyEahcToString.java
+++ b/test/transform/resource/after-delombok/GetterLazyEahcToString.java
@@ -34,9 +34,9 @@ class GetterLazyEahcToString {
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;
}
diff --git a/test/transform/resource/after-delombok/ValuePlain.java b/test/transform/resource/after-delombok/ValuePlain.java
index 09c301d2..8cc19c1e 100644
--- a/test/transform/resource/after-delombok/ValuePlain.java
+++ b/test/transform/resource/after-delombok/ValuePlain.java
@@ -39,7 +39,7 @@ final 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;
}
@java.lang.Override
@@ -96,7 +96,7 @@ class Value2 {
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;
}
@java.lang.Override
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() {