From 22444b78e2b12680929acf1576b15a0717f267e2 Mon Sep 17 00:00:00 2001 From: JohnPaulTaylorII Date: Wed, 23 Feb 2022 13:29:58 -0500 Subject: Fixes #3120 --- .../EqualsAndHashCodeWithNonNullByDefault.java | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 test/transform/resource/after-ecj/EqualsAndHashCodeWithNonNullByDefault.java (limited to 'test/transform/resource/after-ecj') diff --git a/test/transform/resource/after-ecj/EqualsAndHashCodeWithNonNullByDefault.java b/test/transform/resource/after-ecj/EqualsAndHashCodeWithNonNullByDefault.java new file mode 100644 index 00000000..5a679e50 --- /dev/null +++ b/test/transform/resource/after-ecj/EqualsAndHashCodeWithNonNullByDefault.java @@ -0,0 +1,50 @@ +import javax.annotation.ParametersAreNonnullByDefault; +@lombok.EqualsAndHashCode @ParametersAreNonnullByDefault class EqualsAndHashCodeWithNonNullByDefault { + int x; + boolean[] y; + Object[] z; + String a; + String b; + EqualsAndHashCodeWithNonNullByDefault() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final @javax.annotation.Nullable java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof EqualsAndHashCodeWithNonNullByDefault))) + return false; + final EqualsAndHashCodeWithNonNullByDefault other = (EqualsAndHashCodeWithNonNullByDefault) 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 @javax.annotation.Nullable java.lang.Object other) { + return (other instanceof EqualsAndHashCodeWithNonNullByDefault); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + 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())); + return result; + } +} \ No newline at end of file -- cgit From c67909e2039cdac449808464ff28a8e71a56b7a1 Mon Sep 17 00:00:00 2001 From: JohnPaulTaylorII Date: Fri, 25 Feb 2022 16:48:35 -0500 Subject: Fixes #3120 Update AUTHORS file. Remove extraneous code from EqualsAndHashCodeWithNonNullByDefault test case. --- AUTHORS | 1 + .../EqualsAndHashCodeWithNonNullByDefault.java | 24 +----------------- .../EqualsAndHashCodeWithNonNullByDefault.java | 29 +--------------------- .../EqualsAndHashCodeWithNonNullByDefault.java | 5 ---- 4 files changed, 3 insertions(+), 56 deletions(-) (limited to 'test/transform/resource/after-ecj') diff --git a/AUTHORS b/AUTHORS index 810efce9..f2e13ec6 100755 --- a/AUTHORS +++ b/AUTHORS @@ -19,6 +19,7 @@ Jacob Middag Jan Matèrne Jan Rieke Jappe van der Hel +John Paul Taylor II Kevin Chirls Liu DongMiao Luan Nico diff --git a/test/transform/resource/after-delombok/EqualsAndHashCodeWithNonNullByDefault.java b/test/transform/resource/after-delombok/EqualsAndHashCodeWithNonNullByDefault.java index f83cbc32..37711004 100644 --- a/test/transform/resource/after-delombok/EqualsAndHashCodeWithNonNullByDefault.java +++ b/test/transform/resource/after-delombok/EqualsAndHashCodeWithNonNullByDefault.java @@ -1,11 +1,6 @@ import javax.annotation.ParametersAreNonnullByDefault; @ParametersAreNonnullByDefault class EqualsAndHashCodeWithNonNullByDefault { - int x; - boolean[] y; - Object[] z; - String a; - String b; @java.lang.Override @java.lang.SuppressWarnings("all") public boolean equals(@javax.annotation.Nullable final java.lang.Object o) { @@ -13,15 +8,6 @@ class EqualsAndHashCodeWithNonNullByDefault { if (!(o instanceof EqualsAndHashCodeWithNonNullByDefault)) return false; final EqualsAndHashCodeWithNonNullByDefault other = (EqualsAndHashCodeWithNonNullByDefault) 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") @@ -31,15 +17,7 @@ class EqualsAndHashCodeWithNonNullByDefault { @java.lang.Override @java.lang.SuppressWarnings("all") public int hashCode() { - 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()); + final int result = 1; return result; } } diff --git a/test/transform/resource/after-ecj/EqualsAndHashCodeWithNonNullByDefault.java b/test/transform/resource/after-ecj/EqualsAndHashCodeWithNonNullByDefault.java index 5a679e50..0cd170b4 100644 --- a/test/transform/resource/after-ecj/EqualsAndHashCodeWithNonNullByDefault.java +++ b/test/transform/resource/after-ecj/EqualsAndHashCodeWithNonNullByDefault.java @@ -1,10 +1,5 @@ import javax.annotation.ParametersAreNonnullByDefault; @lombok.EqualsAndHashCode @ParametersAreNonnullByDefault class EqualsAndHashCodeWithNonNullByDefault { - int x; - boolean[] y; - Object[] z; - String a; - String b; EqualsAndHashCodeWithNonNullByDefault() { super(); } @@ -16,35 +11,13 @@ import javax.annotation.ParametersAreNonnullByDefault; final EqualsAndHashCodeWithNonNullByDefault other = (EqualsAndHashCodeWithNonNullByDefault) 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 @javax.annotation.Nullable java.lang.Object other) { return (other instanceof EqualsAndHashCodeWithNonNullByDefault); } public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { - 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())); + final int result = 1; return result; } } \ No newline at end of file diff --git a/test/transform/resource/before/EqualsAndHashCodeWithNonNullByDefault.java b/test/transform/resource/before/EqualsAndHashCodeWithNonNullByDefault.java index ee8e0086..f91bce3c 100644 --- a/test/transform/resource/before/EqualsAndHashCodeWithNonNullByDefault.java +++ b/test/transform/resource/before/EqualsAndHashCodeWithNonNullByDefault.java @@ -3,9 +3,4 @@ import javax.annotation.ParametersAreNonnullByDefault; @lombok.EqualsAndHashCode @ParametersAreNonnullByDefault class EqualsAndHashCodeWithNonNullByDefault { - int x; - boolean[] y; - Object[] z; - String a; - String b; } \ No newline at end of file -- cgit