diff options
Diffstat (limited to 'test/transform')
3 files changed, 32 insertions, 23 deletions
diff --git a/test/transform/resource/after-delombok/EqualsAndHashCodeCache.java b/test/transform/resource/after-delombok/EqualsAndHashCodeCache.java index e3e266aa..8fecbdbe 100644 --- a/test/transform/resource/after-delombok/EqualsAndHashCodeCache.java +++ b/test/transform/resource/after-delombok/EqualsAndHashCodeCache.java @@ -42,12 +42,13 @@ class EqualsAndHashCode { } } final class EqualsAndHashCode2 { + @java.lang.SuppressWarnings("all") + private transient int $hashCodeCache = 0; int x; long y; float f; double d; boolean b; - private transient int $hashCodeCache = 0; @java.lang.Override @java.lang.SuppressWarnings("all") public boolean equals(final java.lang.Object o) { @@ -64,7 +65,7 @@ final class EqualsAndHashCode2 { @java.lang.Override @java.lang.SuppressWarnings("all") public int hashCode() { - if ($hashCodeCache != 0) return $hashCodeCache; + if (this.$hashCodeCache != 0) return this.$hashCodeCache; final int PRIME = 59; int result = 1; result = result * PRIME + this.x; @@ -74,11 +75,12 @@ 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); - $hashCodeCache = result; + this.$hashCodeCache = result; return result; } } final class EqualsAndHashCode3 extends EqualsAndHashCode { + @java.lang.SuppressWarnings("all") private transient int $hashCodeCache = 0; @java.lang.Override @java.lang.SuppressWarnings("all") @@ -96,9 +98,9 @@ final class EqualsAndHashCode3 extends EqualsAndHashCode { @java.lang.Override @java.lang.SuppressWarnings("all") public int hashCode() { - if ($hashCodeCache != 0) return $hashCodeCache; + if (this.$hashCodeCache != 0) return this.$hashCodeCache; final int result = 1; - $hashCodeCache = result; + this.$hashCodeCache = result; return result; } } @@ -125,13 +127,14 @@ class EqualsAndHashCode4 extends EqualsAndHashCode { } } class EqualsAndHashCode5 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) { if (o == this) return true; if (!(o instanceof EqualsAndHashCode5)) return false; - final EqualsAndHashCode5 other = (EqualsAndHashCode4) o; + final EqualsAndHashCode5 other = (EqualsAndHashCode5) o; if (!other.canEqual((java.lang.Object) this)) return false; if (!super.equals(o)) return false; return true; @@ -143,9 +146,9 @@ class EqualsAndHashCode5 extends EqualsAndHashCode { @java.lang.Override @java.lang.SuppressWarnings("all") public int hashCode() { - if ($hashCodeCache != 0) return $hashCodeCache; + if (this.$hashCodeCache != 0) return this.$hashCodeCache; final int result = super.hashCode(); - $hashCodeCache = result; + this.$hashCodeCache = result; return result; } } diff --git a/test/transform/resource/after-ecj/EqualsAndHashCodeCache.java b/test/transform/resource/after-ecj/EqualsAndHashCodeCache.java index 4eb4fbb3..3c4d0daa 100644 --- a/test/transform/resource/after-ecj/EqualsAndHashCodeCache.java +++ b/test/transform/resource/after-ecj/EqualsAndHashCodeCache.java @@ -48,12 +48,12 @@ } } final @lombok.EqualsAndHashCode(cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) class EqualsAndHashCode2 { + private transient @java.lang.SuppressWarnings("all") int $hashCodeCache = 0; int x; long y; float f; double d; boolean b; - private transient int $hashCodeCache = 0; EqualsAndHashCode2() { super(); } @@ -76,8 +76,8 @@ final @lombok.EqualsAndHashCode(cacheStrategy = lombok.EqualsAndHashCode.CacheSt return true; } public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { - if ($hashCodeCache != 0) - return $hashCodeCache; + if ((this.$hashCodeCache != 0)) + return this.$hashCodeCache; final int PRIME = 59; int result = 1; result = ((result * PRIME) + this.x); @@ -87,11 +87,12 @@ 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)); - $hashCodeCache = result; + this.$hashCodeCache = result; return result; } } -final @lombok.EqualsAndHashCode(callSuper=false, cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) class EqualsAndHashCode3 extends EqualsAndHashCode { +final @lombok.EqualsAndHashCode(callSuper = false,cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) class EqualsAndHashCode3 extends EqualsAndHashCode { + private transient @java.lang.SuppressWarnings("all") int $hashCodeCache = 0; EqualsAndHashCode3() { super(); } @@ -109,11 +110,14 @@ final @lombok.EqualsAndHashCode(callSuper=false, cacheStrategy = lombok.EqualsAn return (other instanceof EqualsAndHashCode3); } public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + if ((this.$hashCodeCache != 0)) + return this.$hashCodeCache; final int result = 1; + this.$hashCodeCache = result; return result; } } -@lombok.EqualsAndHashCode(callSuper=true, cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) class EqualsAndHashCode4 extends EqualsAndHashCode { +@lombok.EqualsAndHashCode(callSuper = true,cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) class EqualsAndHashCode4 extends EqualsAndHashCode { EqualsAndHashCode4() { super(); } @@ -137,10 +141,10 @@ final @lombok.EqualsAndHashCode(callSuper=false, cacheStrategy = lombok.EqualsAn return result; } } -@lombok.EqualsAndHashCode(callSuper=true, cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) class EqualsAndHashCode5 extends EqualsAndHashCode { - private transient int $hashCodeCache = 0; +final @lombok.EqualsAndHashCode(callSuper = true,cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) class EqualsAndHashCode5 extends EqualsAndHashCode { + private transient @java.lang.SuppressWarnings("all") int $hashCodeCache = 0; EqualsAndHashCode5() { - super(); + super(); } public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { if ((o == this)) @@ -149,19 +153,19 @@ final @lombok.EqualsAndHashCode(callSuper=false, cacheStrategy = lombok.EqualsAn return false; final EqualsAndHashCode5 other = (EqualsAndHashCode5) o; if ((! other.canEqual((java.lang.Object) this))) - return false; + return false; if ((! super.equals(o))) - return false; - return true; + return false; + return true; } protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { return (other instanceof EqualsAndHashCode5); } public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { - if ($hashCodeCache != 0) - return $hashCodeCache; + if ((this.$hashCodeCache != 0)) + return this.$hashCodeCache; final int result = super.hashCode(); - $hashCodeCache = result; + this.$hashCodeCache = result; return result; } } diff --git a/test/transform/resource/messages-ecj/EqualsAndHashCodeCache.java.messages b/test/transform/resource/messages-ecj/EqualsAndHashCodeCache.java.messages new file mode 100644 index 00000000..24d202bd --- /dev/null +++ b/test/transform/resource/messages-ecj/EqualsAndHashCodeCache.java.messages @@ -0,0 +1,2 @@ +1 Not caching the result of hashCode: Annotated type is not final. +23 Not caching the result of hashCode: Annotated type is not final.
\ No newline at end of file |