aboutsummaryrefslogtreecommitdiff
path: root/test/transform/resource/after-delombok
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2011-07-18 20:59:52 +0200
committerRoel Spilker <r.spilker@gmail.com>2011-07-18 21:05:00 +0200
commit83e2fb5e00e1868f0b4f0fe38b1ea1383119f8ee (patch)
tree68f44e863293287e989b120a1d15de88de338a2a /test/transform/resource/after-delombok
parentaa1a0e7ac87f5e96a39d0bad670aa8c7b7df85d4 (diff)
downloadlombok-83e2fb5e00e1868f0b4f0fe38b1ea1383119f8ee.tar.gz
lombok-83e2fb5e00e1868f0b4f0fe38b1ea1383119f8ee.tar.bz2
lombok-83e2fb5e00e1868f0b4f0fe38b1ea1383119f8ee.zip
Now either all or none of equals/hashCode/canEqual is generated. Fixes issue 240.
Diffstat (limited to 'test/transform/resource/after-delombok')
-rw-r--r--test/transform/resource/after-delombok/EqualsAndHashCode.java99
-rw-r--r--test/transform/resource/after-delombok/EqualsAndHashCodeWithExistingMethods.java18
2 files changed, 117 insertions, 0 deletions
diff --git a/test/transform/resource/after-delombok/EqualsAndHashCode.java b/test/transform/resource/after-delombok/EqualsAndHashCode.java
new file mode 100644
index 00000000..e7f701e8
--- /dev/null
+++ b/test/transform/resource/after-delombok/EqualsAndHashCode.java
@@ -0,0 +1,99 @@
+class EqualsAndHashCode {
+ int x;
+ boolean[] y;
+ Object[] z;
+ String a;
+ @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;
+ if (this.a == null ? other.a != null : !this.a.equals((java.lang.Object)other.a)) return false;
+ return true;
+ }
+ @java.lang.SuppressWarnings("all")
+ public boolean canEqual(final java.lang.Object other) {
+ return other instanceof EqualsAndHashCode;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public int hashCode() {
+ final int PRIME = 31;
+ 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);
+ result = result * PRIME + (this.a == null ? 0 : this.a.hashCode());
+ return result;
+ }
+}
+final class EqualsAndHashCode2 {
+ int x;
+ @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;
+ return true;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public int hashCode() {
+ final int PRIME = 31;
+ int result = 1;
+ result = result * PRIME + this.x;
+ return result;
+ }
+}
+final class EqualsAndHashCode3 extends EqualsAndHashCode {
+ @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")
+ public boolean canEqual(final java.lang.Object other) {
+ return other instanceof EqualsAndHashCode3;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public int hashCode() {
+ int result = 1;
+ return result;
+ }
+}
+class EqualsAndHashCode4 extends EqualsAndHashCode {
+ @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")
+ public boolean canEqual(final java.lang.Object other) {
+ return other instanceof EqualsAndHashCode4;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public int hashCode() {
+ final int PRIME = 31;
+ int result = 1;
+ result = result * PRIME + super.hashCode();
+ return result;
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-delombok/EqualsAndHashCodeWithExistingMethods.java b/test/transform/resource/after-delombok/EqualsAndHashCodeWithExistingMethods.java
new file mode 100644
index 00000000..93b20e25
--- /dev/null
+++ b/test/transform/resource/after-delombok/EqualsAndHashCodeWithExistingMethods.java
@@ -0,0 +1,18 @@
+class EqualsAndHashCodeWithExistingMethods {
+ int x;
+ public int hashCode() {
+ return 42;
+ }
+}
+final class EqualsAndHashCodeWithExistingMethods2 {
+ int x;
+ public boolean equals(Object other) {
+ return false;
+ }
+}
+final class EqualsAndHashCodeWithExistingMethods3 extends EqualsAndHashCodeWithExistingMethods {
+ int x;
+ public boolean canEqual(Object other) {
+ return true;
+ }
+} \ No newline at end of file