diff options
author | Christian Sterzl <christian.sterzl@gmail.com> | 2014-04-03 08:11:16 +0200 |
---|---|---|
committer | Christian Sterzl <christian.sterzl@gmail.com> | 2014-04-03 08:11:16 +0200 |
commit | 3d32cd85f174bbeb54ea0c102e029c42daf51931 (patch) | |
tree | 6d9144ca2fbd9167a85f68b6f761c6904e4d19ef /test/transform | |
parent | 6afa3d2ec9ec18ed8ae5f6c5217b9fb1710c69c7 (diff) | |
download | lombok-3d32cd85f174bbeb54ea0c102e029c42daf51931.tar.gz lombok-3d32cd85f174bbeb54ea0c102e029c42daf51931.tar.bz2 lombok-3d32cd85f174bbeb54ea0c102e029c42daf51931.zip |
Adding onParam to annotation @EqualsAndHashCode to add individual annotations to the parameters of equals and canEqual.
Diffstat (limited to 'test/transform')
-rw-r--r-- | test/transform/resource/after-delombok/EqualsAndHashCodeWithOnParam.java | 46 | ||||
-rw-r--r-- | test/transform/resource/before/EqualsAndHashCodeWithOnParam.java | 11 |
2 files changed, 57 insertions, 0 deletions
diff --git a/test/transform/resource/after-delombok/EqualsAndHashCodeWithOnParam.java b/test/transform/resource/after-delombok/EqualsAndHashCodeWithOnParam.java new file mode 100644 index 00000000..2052b0b0 --- /dev/null +++ b/test/transform/resource/after-delombok/EqualsAndHashCodeWithOnParam.java @@ -0,0 +1,46 @@ +@interface Nullable { +} + +class EqualsAndHashCode { + int x; + boolean[] y; + Object[] z; + String a; + String b; + @java.lang.Override + @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 (!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(@Nullable final java.lang.Object other) { + return other instanceof EqualsAndHashCode; + } + @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 ? 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 new file mode 100644 index 00000000..160dfdc6 --- /dev/null +++ b/test/transform/resource/before/EqualsAndHashCodeWithOnParam.java @@ -0,0 +1,11 @@ +@interface Nullable { +} + +@lombok.EqualsAndHashCode(onParam=@_{@Nullable}) +class EqualsAndHashCodeWithOnParam { + int x; + boolean[] y; + Object[] z; + String a; + String b; +}
\ No newline at end of file |