From f93478e7b56494ce86e9ea7d4585f288489073e0 Mon Sep 17 00:00:00 2001 From: Christian Sterzl Date: Thu, 3 Apr 2014 14:10:31 +0200 Subject: Fixed tests, added test for ecj. --- .../EqualsAndHashCodeWithOnParam.java | 8 ++-- .../after-ecj/EqualsAndHashCodeWithOnParam.java | 52 ++++++++++++++++++++++ .../before/EqualsAndHashCodeWithOnParam.java | 2 +- 3 files changed, 57 insertions(+), 5 deletions(-) create mode 100644 test/transform/resource/after-ecj/EqualsAndHashCodeWithOnParam.java (limited to 'test/transform') diff --git a/test/transform/resource/after-delombok/EqualsAndHashCodeWithOnParam.java b/test/transform/resource/after-delombok/EqualsAndHashCodeWithOnParam.java index 2052b0b0..d8d8b025 100644 --- a/test/transform/resource/after-delombok/EqualsAndHashCodeWithOnParam.java +++ b/test/transform/resource/after-delombok/EqualsAndHashCodeWithOnParam.java @@ -1,7 +1,7 @@ @interface Nullable { } -class EqualsAndHashCode { +class EqualsAndHashCodeWithOnParam { int x; boolean[] y; Object[] z; @@ -11,8 +11,8 @@ class EqualsAndHashCode { @java.lang.SuppressWarnings("all") public boolean equals(@Nullable final java.lang.Object o) { if (o == this) return true; - if (!(o instanceof EqualsAndHashCode)) return false; - final EqualsAndHashCode other = (EqualsAndHashCode)o; + if (!(o instanceof EqualsAndHashCodeWithOnParam)) return false; + final EqualsAndHashCodeWithOnParam other = (EqualsAndHashCodeWithOnParam)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; @@ -27,7 +27,7 @@ class EqualsAndHashCode { } @java.lang.SuppressWarnings("all") protected boolean canEqual(@Nullable final java.lang.Object other) { - return other instanceof EqualsAndHashCode; + return other instanceof EqualsAndHashCodeWithOnParam; } @java.lang.Override @java.lang.SuppressWarnings("all") diff --git a/test/transform/resource/after-ecj/EqualsAndHashCodeWithOnParam.java b/test/transform/resource/after-ecj/EqualsAndHashCodeWithOnParam.java new file mode 100644 index 00000000..fc226f06 --- /dev/null +++ b/test/transform/resource/after-ecj/EqualsAndHashCodeWithOnParam.java @@ -0,0 +1,52 @@ +@interface Nullable { +} + +@lombok.EqualsAndHashCode() class EqualsAndHashCodeWithOnParam { + int x; + boolean[] y; + Object[] z; + String a; + String b; + EqualsAndHashCodeWithOnParam() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final @Nullable java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof EqualsAndHashCodeWithOnParam))) + return false; + final @java.lang.SuppressWarnings("all") EqualsAndHashCodeWithOnParam other = (EqualsAndHashCodeWithOnParam) 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 @Nullable java.lang.Object other) { + return (other instanceof EqualsAndHashCodeWithOnParam); + } + 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) ? 0 : $a.hashCode())); + final java.lang.Object $b = this.b; + result = ((result * PRIME) + (($b == null) ? 0 : $b.hashCode())); + return result; + } +} \ No newline at end of file diff --git a/test/transform/resource/before/EqualsAndHashCodeWithOnParam.java b/test/transform/resource/before/EqualsAndHashCodeWithOnParam.java index 160dfdc6..e164de87 100644 --- a/test/transform/resource/before/EqualsAndHashCodeWithOnParam.java +++ b/test/transform/resource/before/EqualsAndHashCodeWithOnParam.java @@ -1,7 +1,7 @@ @interface Nullable { } -@lombok.EqualsAndHashCode(onParam=@_{@Nullable}) +@lombok.EqualsAndHashCode(onParam=@__({@Nullable})) class EqualsAndHashCodeWithOnParam { int x; boolean[] y; -- cgit