diff options
author | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2020-10-03 23:56:41 +0200 |
---|---|---|
committer | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2020-10-03 23:56:41 +0200 |
commit | 58545cec67ada261d13c454fce460ed55798cd72 (patch) | |
tree | 8c140dd3d788da876998c10b2d1f2bf9f3e1c91b /test/transform/resource | |
parent | 14cce76805324dce66fcdfde333a63c677694d64 (diff) | |
parent | 4f763367f1092546350324f3040fa84cb0380409 (diff) | |
download | lombok-58545cec67ada261d13c454fce460ed55798cd72.tar.gz lombok-58545cec67ada261d13c454fce460ed55798cd72.tar.bz2 lombok-58545cec67ada261d13c454fce460ed55798cd72.zip |
Merge remote-tracking branch 'origin/master'
# Conflicts:
# src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java
Diffstat (limited to 'test/transform/resource')
3 files changed, 385 insertions, 0 deletions
diff --git a/test/transform/resource/after-delombok/EqualsAndHashCodeCache.java b/test/transform/resource/after-delombok/EqualsAndHashCodeCache.java new file mode 100644 index 00000000..4f3574b6 --- /dev/null +++ b/test/transform/resource/after-delombok/EqualsAndHashCodeCache.java @@ -0,0 +1,167 @@ +class EqualsAndHashCode { + @java.lang.SuppressWarnings("all") + private transient int $hashCodeCache; + int x; + boolean[] y; + Object[] z; + String a; + String b; + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof EqualsAndHashCode)) return false; + final EqualsAndHashCode other = (EqualsAndHashCode) o; + if (!other.canEqual((java.lang.Object) this)) return false; + if (this.x != other.x) return false; + if (!java.util.Arrays.equals(this.y, other.y)) return false; + if (!java.util.Arrays.deepEquals(this.z, other.z)) return false; + final java.lang.Object this$a = this.a; + final java.lang.Object other$a = other.a; + if (this$a == null ? other$a != null : !this$a.equals(other$a)) return false; + final java.lang.Object this$b = this.b; + final java.lang.Object other$b = other.b; + if (this$b == null ? other$b != null : !this$b.equals(other$b)) return false; + return true; + } + @java.lang.SuppressWarnings("all") + protected boolean canEqual(final java.lang.Object other) { + return other instanceof 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; + 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 ? 43 : $a.hashCode()); + final java.lang.Object $b = this.b; + result = result * PRIME + ($b == null ? 43 : $b.hashCode()); + if (result == 0) result = java.lang.Integer.MIN_VALUE; + this.$hashCodeCache = result; + return result; + } +} +final class EqualsAndHashCode2 { + @java.lang.SuppressWarnings("all") + private transient int $hashCodeCache; + int x; + long y; + float f; + double d; + boolean b; + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof EqualsAndHashCode2)) return false; + final EqualsAndHashCode2 other = (EqualsAndHashCode2) o; + if (this.x != other.x) return false; + if (this.y != other.y) return false; + if (java.lang.Float.compare(this.f, other.f) != 0) return false; + if (java.lang.Double.compare(this.d, other.d) != 0) return false; + if (this.b != other.b) return false; + return true; + } + @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; + final long $y = this.y; + result = result * PRIME + (int) ($y >>> 32 ^ $y); + result = result * PRIME + java.lang.Float.floatToIntBits(this.f); + final long $d = java.lang.Double.doubleToLongBits(this.d); + result = result * PRIME + (int) ($d >>> 32 ^ $d); + result = result * PRIME + (this.b ? 79 : 97); + if (result == 0) result = java.lang.Integer.MIN_VALUE; + this.$hashCodeCache = result; + return result; + } +} +final class EqualsAndHashCode3 extends EqualsAndHashCode { + @java.lang.SuppressWarnings("all") + private transient int $hashCodeCache; + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof EqualsAndHashCode3)) return false; + final EqualsAndHashCode3 other = (EqualsAndHashCode3) o; + if (!other.canEqual((java.lang.Object) this)) return false; + return true; + } + @java.lang.SuppressWarnings("all") + protected boolean canEqual(final java.lang.Object other) { + return other instanceof EqualsAndHashCode3; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + if (this.$hashCodeCache != 0) return this.$hashCodeCache; + int result = 1; + if (result == 0) result = java.lang.Integer.MIN_VALUE; + this.$hashCodeCache = result; + return result; + } +} +class EqualsAndHashCode4 extends EqualsAndHashCode { + @java.lang.SuppressWarnings("all") + private transient int $hashCodeCache; + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof EqualsAndHashCode4)) return false; + final EqualsAndHashCode4 other = (EqualsAndHashCode4) o; + if (!other.canEqual((java.lang.Object) this)) return false; + if (!super.equals(o)) return false; + return true; + } + @java.lang.SuppressWarnings("all") + protected boolean canEqual(final java.lang.Object other) { + return other instanceof EqualsAndHashCode4; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + if (this.$hashCodeCache != 0) return this.$hashCodeCache; + int result = super.hashCode(); + if (result == 0) result = java.lang.Integer.MIN_VALUE; + this.$hashCodeCache = result; + return result; + } +} +final class EqualsAndHashCode5 extends EqualsAndHashCode { + @java.lang.SuppressWarnings("all") + private transient int $hashCodeCache; + @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 = (EqualsAndHashCode5) o; + if (!other.canEqual((java.lang.Object) this)) return false; + if (!super.equals(o)) return false; + return true; + } + @java.lang.SuppressWarnings("all") + protected boolean canEqual(final java.lang.Object other) { + return other instanceof EqualsAndHashCode5; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + if (this.$hashCodeCache != 0) return this.$hashCodeCache; + int result = super.hashCode(); + if (result == 0) result = java.lang.Integer.MIN_VALUE; + this.$hashCodeCache = result; + return result; + } +} diff --git a/test/transform/resource/after-ecj/EqualsAndHashCodeCache.java b/test/transform/resource/after-ecj/EqualsAndHashCodeCache.java new file mode 100644 index 00000000..7094b636 --- /dev/null +++ b/test/transform/resource/after-ecj/EqualsAndHashCodeCache.java @@ -0,0 +1,189 @@ +@lombok.EqualsAndHashCode(cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) class EqualsAndHashCode { + private transient @java.lang.SuppressWarnings("all") int $hashCodeCache; + int x; + boolean[] y; + Object[] z; + String a; + String b; + EqualsAndHashCode() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof EqualsAndHashCode))) + return false; + final EqualsAndHashCode other = (EqualsAndHashCode) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + if ((this.x != other.x)) + return false; + if ((! java.util.Arrays.equals(this.y, other.y))) + return false; + if ((! java.util.Arrays.deepEquals(this.z, other.z))) + return false; + final java.lang.Object this$a = this.a; + final java.lang.Object other$a = other.a; + if (((this$a == null) ? (other$a != null) : (! this$a.equals(other$a)))) + return false; + final java.lang.Object this$b = this.b; + final java.lang.Object other$b = other.b; + if (((this$b == null) ? (other$b != null) : (! this$b.equals(other$b)))) + return false; + return true; + } + protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof EqualsAndHashCode); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + if ((this.$hashCodeCache != 0)) + return this.$hashCodeCache; + final int PRIME = 59; + int result = 1; + result = ((result * PRIME) + this.x); + 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) ? 43 : $a.hashCode())); + final java.lang.Object $b = this.b; + result = ((result * PRIME) + (($b == null) ? 43 : $b.hashCode())); + 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; + int x; + long y; + float f; + double d; + boolean b; + EqualsAndHashCode2() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof EqualsAndHashCode2))) + return false; + final EqualsAndHashCode2 other = (EqualsAndHashCode2) o; + if ((this.x != other.x)) + return false; + if ((this.y != other.y)) + return false; + if ((java.lang.Float.compare(this.f, other.f) != 0)) + return false; + if ((java.lang.Double.compare(this.d, other.d) != 0)) + return false; + if ((this.b != other.b)) + return false; + return true; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + if ((this.$hashCodeCache != 0)) + return this.$hashCodeCache; + final int PRIME = 59; + int result = 1; + result = ((result * PRIME) + this.x); + final long $y = this.y; + result = ((result * PRIME) + (int) ($y ^ ($y >>> 32))); + result = ((result * PRIME) + java.lang.Float.floatToIntBits(this.f)); + final long $d = java.lang.Double.doubleToLongBits(this.d); + result = ((result * PRIME) + (int) ($d ^ ($d >>> 32))); + result = ((result * PRIME) + (this.b ? 79 : 97)); + 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; + EqualsAndHashCode3() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof EqualsAndHashCode3))) + return false; + final EqualsAndHashCode3 other = (EqualsAndHashCode3) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + return true; + } + protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof EqualsAndHashCode3); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + if ((this.$hashCodeCache != 0)) + return this.$hashCodeCache; + 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; + EqualsAndHashCode4() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof EqualsAndHashCode4))) + return false; + final EqualsAndHashCode4 other = (EqualsAndHashCode4) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + if ((! super.equals(o))) + return false; + return true; + } + protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof EqualsAndHashCode4); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + if ((this.$hashCodeCache != 0)) + return this.$hashCodeCache; + 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; + EqualsAndHashCode5() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof EqualsAndHashCode5))) + return false; + final EqualsAndHashCode5 other = (EqualsAndHashCode5) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + if ((! super.equals(o))) + 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 ((this.$hashCodeCache != 0)) + return this.$hashCodeCache; + int result = super.hashCode(); + if ((result == 0)) + result = java.lang.Integer.MIN_VALUE; + this.$hashCodeCache = result; + return result; + } +} diff --git a/test/transform/resource/before/EqualsAndHashCodeCache.java b/test/transform/resource/before/EqualsAndHashCodeCache.java new file mode 100644 index 00000000..3c84ee59 --- /dev/null +++ b/test/transform/resource/before/EqualsAndHashCodeCache.java @@ -0,0 +1,29 @@ +@lombok.EqualsAndHashCode(cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) +class EqualsAndHashCode { + int x; + boolean[] y; + Object[] z; + String a; + String b; +} + +@lombok.EqualsAndHashCode(cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) +final class EqualsAndHashCode2 { + int x; + long y; + float f; + double d; + boolean b; +} + +@lombok.EqualsAndHashCode(callSuper=false, cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) +final class EqualsAndHashCode3 extends EqualsAndHashCode { +} + +@lombok.EqualsAndHashCode(callSuper=true, cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) +class EqualsAndHashCode4 extends EqualsAndHashCode { +} + +@lombok.EqualsAndHashCode(callSuper=true, cacheStrategy = lombok.EqualsAndHashCode.CacheStrategy.LAZY) +final class EqualsAndHashCode5 extends EqualsAndHashCode { +}
\ No newline at end of file |