aboutsummaryrefslogtreecommitdiff
path: root/test/transform/resource/after-ecj/EqualsAndHashCodeCache.java
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2020-09-25 00:13:50 +0200
committerRoel Spilker <r.spilker@gmail.com>2020-09-25 00:13:50 +0200
commit2ba65d105ddfce54690a64f93cbc5c55480ef364 (patch)
treec79158768703c8cc77ba9b031f30bc2d7d40db7f /test/transform/resource/after-ecj/EqualsAndHashCodeCache.java
parentee6c0ca7f2274b24571afdc8586eff9052f5eda1 (diff)
downloadlombok-2ba65d105ddfce54690a64f93cbc5c55480ef364.tar.gz
lombok-2ba65d105ddfce54690a64f93cbc5c55480ef364.tar.bz2
lombok-2ba65d105ddfce54690a64f93cbc5c55480ef364.zip
Cache hashCode:
- Fix bug where 0 would be returned once - Fix Eclipse position error - Don't initialize field with default value 0
Diffstat (limited to 'test/transform/resource/after-ecj/EqualsAndHashCodeCache.java')
-rw-r--r--test/transform/resource/after-ecj/EqualsAndHashCodeCache.java36
1 files changed, 23 insertions, 13 deletions
diff --git a/test/transform/resource/after-ecj/EqualsAndHashCodeCache.java b/test/transform/resource/after-ecj/EqualsAndHashCodeCache.java
index b29fd6b3..7094b636 100644
--- a/test/transform/resource/after-ecj/EqualsAndHashCodeCache.java
+++ b/test/transform/resource/after-ecj/EqualsAndHashCodeCache.java
@@ -1,5 +1,5 @@
@lombok.EqualsAndHashCode(cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) class EqualsAndHashCode {
- private transient @java.lang.SuppressWarnings("all") int $hashCodeCache = 0;
+ private transient @java.lang.SuppressWarnings("all") int $hashCodeCache;
int x;
boolean[] y;
Object[] z;
@@ -47,12 +47,14 @@
result = ((result * PRIME) + (($a == null) ? 43 : $a.hashCode()));
final java.lang.Object $b = this.b;
result = ((result * PRIME) + (($b == null) ? 43 : $b.hashCode()));
- this.$hashCodeCache = ((result != 0) ? result : java.lang.Integer.MIN_VALUE);
+ if ((result == 0))
+ result = java.lang.Integer.MIN_VALUE;
+ this.$hashCodeCache = result;
return result;
}
}
final @lombok.EqualsAndHashCode(cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) class EqualsAndHashCode2 {
- private transient @java.lang.SuppressWarnings("all") int $hashCodeCache = 0;
+ private transient @java.lang.SuppressWarnings("all") int $hashCodeCache;
int x;
long y;
float f;
@@ -91,12 +93,14 @@ final @lombok.EqualsAndHashCode(cacheStrategy = lombok.EqualsAndHashCode.CacheSt
final long $d = java.lang.Double.doubleToLongBits(this.d);
result = ((result * PRIME) + (int) ($d ^ ($d >>> 32)));
result = ((result * PRIME) + (this.b ? 79 : 97));
- this.$hashCodeCache = ((result != 0) ? result : java.lang.Integer.MIN_VALUE);
+ if ((result == 0))
+ result = java.lang.Integer.MIN_VALUE;
+ this.$hashCodeCache = result;
return result;
}
}
final @lombok.EqualsAndHashCode(callSuper = false,cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) class EqualsAndHashCode3 extends EqualsAndHashCode {
- private transient @java.lang.SuppressWarnings("all") int $hashCodeCache = 0;
+ private transient @java.lang.SuppressWarnings("all") int $hashCodeCache;
EqualsAndHashCode3() {
super();
}
@@ -116,13 +120,15 @@ final @lombok.EqualsAndHashCode(callSuper = false,cacheStrategy = lombok.EqualsA
public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
if ((this.$hashCodeCache != 0))
return this.$hashCodeCache;
- final int result = 1;
- this.$hashCodeCache = ((result != 0) ? result : java.lang.Integer.MIN_VALUE);
+ int result = 1;
+ if ((result == 0))
+ result = java.lang.Integer.MIN_VALUE;
+ this.$hashCodeCache = result;
return result;
}
}
@lombok.EqualsAndHashCode(callSuper = true,cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) class EqualsAndHashCode4 extends EqualsAndHashCode {
- private transient @java.lang.SuppressWarnings("all") int $hashCodeCache = 0;
+ private transient @java.lang.SuppressWarnings("all") int $hashCodeCache;
EqualsAndHashCode4() {
super();
}
@@ -144,13 +150,15 @@ final @lombok.EqualsAndHashCode(callSuper = false,cacheStrategy = lombok.EqualsA
public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
if ((this.$hashCodeCache != 0))
return this.$hashCodeCache;
- final int result = super.hashCode();
- this.$hashCodeCache = ((result != 0) ? result : java.lang.Integer.MIN_VALUE);
+ int result = super.hashCode();
+ if ((result == 0))
+ result = java.lang.Integer.MIN_VALUE;
+ this.$hashCodeCache = result;
return result;
}
}
final @lombok.EqualsAndHashCode(callSuper = true,cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) class EqualsAndHashCode5 extends EqualsAndHashCode {
- private transient @java.lang.SuppressWarnings("all") int $hashCodeCache = 0;
+ private transient @java.lang.SuppressWarnings("all") int $hashCodeCache;
EqualsAndHashCode5() {
super();
}
@@ -172,8 +180,10 @@ final @lombok.EqualsAndHashCode(callSuper = true,cacheStrategy = lombok.EqualsAn
public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
if ((this.$hashCodeCache != 0))
return this.$hashCodeCache;
- final int result = super.hashCode();
- this.$hashCodeCache = ((result != 0) ? result : java.lang.Integer.MIN_VALUE);
+ int result = super.hashCode();
+ if ((result == 0))
+ result = java.lang.Integer.MIN_VALUE;
+ this.$hashCodeCache = result;
return result;
}
}