aboutsummaryrefslogtreecommitdiff
path: root/test/transform/resource/after-delombok
diff options
context:
space:
mode:
authorAndre Brait <andrebrait@gmail.com>2020-08-19 17:59:19 +0200
committerRoel Spilker <r.spilker@gmail.com>2020-09-24 22:25:15 +0200
commit8d004c0638e4b865c38527a500c493288328eac8 (patch)
tree33c9db820c79f980ab596d6501a802ceb7b0237a /test/transform/resource/after-delombok
parent0808d4271a495e1b6ea4f9a636e63a1c62567133 (diff)
downloadlombok-8d004c0638e4b865c38527a500c493288328eac8.tar.gz
lombok-8d004c0638e4b865c38527a500c493288328eac8.tar.bz2
lombok-8d004c0638e4b865c38527a500c493288328eac8.zip
Allow non-final types, use Integer.MIN_VALUE
Allow caching hash code for non-final classes (but will warn) Use Integer.MIN_VALUE to differentiate uncached and 0 cached
Diffstat (limited to 'test/transform/resource/after-delombok')
-rw-r--r--test/transform/resource/after-delombok/EqualsAndHashCodeCache.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/test/transform/resource/after-delombok/EqualsAndHashCodeCache.java b/test/transform/resource/after-delombok/EqualsAndHashCodeCache.java
index a028cca7..e76f74d5 100644
--- a/test/transform/resource/after-delombok/EqualsAndHashCodeCache.java
+++ b/test/transform/resource/after-delombok/EqualsAndHashCodeCache.java
@@ -1,4 +1,6 @@
class EqualsAndHashCode {
+ @java.lang.SuppressWarnings("all")
+ private transient int $hashCodeCache = 0;
int x;
boolean[] y;
Object[] z;
@@ -29,6 +31,7 @@ class EqualsAndHashCode {
@java.lang.Override
@java.lang.SuppressWarnings("all")
public int hashCode() {
+ if (this.$hashCodeCache != 0) return this.$hashCodeCache;
final int PRIME = 59;
int result = 1;
result = result * PRIME + this.x;
@@ -38,6 +41,7 @@ class EqualsAndHashCode {
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;
return result;
}
}
@@ -75,7 +79,7 @@ final class EqualsAndHashCode2 {
final long $d = java.lang.Double.doubleToLongBits(this.d);
result = result * PRIME + (int) ($d >>> 32 ^ $d);
result = result * PRIME + (this.b ? 79 : 97);
- this.$hashCodeCache = result;
+ this.$hashCodeCache = result != 0 ? result : java.lang.Integer.MIN_VALUE;
return result;
}
}
@@ -100,11 +104,13 @@ final class EqualsAndHashCode3 extends EqualsAndHashCode {
public int hashCode() {
if (this.$hashCodeCache != 0) return this.$hashCodeCache;
final int result = 1;
- this.$hashCodeCache = result;
+ this.$hashCodeCache = result != 0 ? result : java.lang.Integer.MIN_VALUE;
return result;
}
}
class EqualsAndHashCode4 extends EqualsAndHashCode {
+ @java.lang.SuppressWarnings("all")
+ private transient int $hashCodeCache = 0;
@java.lang.Override
@java.lang.SuppressWarnings("all")
public boolean equals(final java.lang.Object o) {
@@ -122,7 +128,9 @@ class EqualsAndHashCode4 extends EqualsAndHashCode {
@java.lang.Override
@java.lang.SuppressWarnings("all")
public int hashCode() {
+ if (this.$hashCodeCache != 0) return this.$hashCodeCache;
final int result = super.hashCode();
+ this.$hashCodeCache = result != 0 ? result : java.lang.Integer.MIN_VALUE;
return result;
}
}
@@ -148,7 +156,7 @@ final class EqualsAndHashCode5 extends EqualsAndHashCode {
public int hashCode() {
if (this.$hashCodeCache != 0) return this.$hashCodeCache;
final int result = super.hashCode();
- this.$hashCodeCache = result;
+ this.$hashCodeCache = result != 0 ? result : java.lang.Integer.MIN_VALUE;
return result;
}
}