aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2010-11-08 02:57:01 +0100
committerRoel Spilker <r.spilker@gmail.com>2010-11-08 02:57:01 +0100
commit6e5acaca49bff5af2b174078fb18b9015ae1bb71 (patch)
tree755650448a1de518ee6274f46beca00fa6a10d1c /test
parentd4ae32fd798dcb45c439869e990ff296f3f96036 (diff)
downloadlombok-6e5acaca49bff5af2b174078fb18b9015ae1bb71.tar.gz
lombok-6e5acaca49bff5af2b174078fb18b9015ae1bb71.tar.bz2
lombok-6e5acaca49bff5af2b174078fb18b9015ae1bb71.zip
Added support for canEquals in javac
Diffstat (limited to 'test')
-rw-r--r--test/transform/resource/after-delombok/DataExtended.java8
-rw-r--r--test/transform/resource/after-delombok/DataIgnore.java10
-rw-r--r--test/transform/resource/after-delombok/DataOnLocalClass.java24
-rw-r--r--test/transform/resource/after-delombok/DataPlain.java100
-rw-r--r--test/transform/resource/after-delombok/DataWithGetter.java8
-rw-r--r--test/transform/resource/after-delombok/DataWithGetterNone.java8
-rw-r--r--test/transform/resource/after-ecj/DataPlain.java74
-rw-r--r--test/transform/resource/before/DataPlain.java14
8 files changed, 226 insertions, 20 deletions
diff --git a/test/transform/resource/after-delombok/DataExtended.java b/test/transform/resource/after-delombok/DataExtended.java
index 6f55bc2c..be1c3b74 100644
--- a/test/transform/resource/after-delombok/DataExtended.java
+++ b/test/transform/resource/after-delombok/DataExtended.java
@@ -15,12 +15,16 @@ class DataExtended {
@java.lang.SuppressWarnings("all")
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
- if (o == null) return false;
- if (o.getClass() != this.getClass()) return false;
+ if (!(o instanceof DataExtended)) return false;
final DataExtended other = (DataExtended)o;
+ if (!other.canEqual(this)) return false;
if (this.getX() != other.getX()) return false;
return true;
}
+ @java.lang.SuppressWarnings("all")
+ public boolean canEqual(final java.lang.Object other) {
+ return other instanceof DataExtended;
+ }
@java.lang.Override
@java.lang.SuppressWarnings("all")
public int hashCode() {
diff --git a/test/transform/resource/after-delombok/DataIgnore.java b/test/transform/resource/after-delombok/DataIgnore.java
index 7e81432d..9f2a7d79 100644
--- a/test/transform/resource/after-delombok/DataIgnore.java
+++ b/test/transform/resource/after-delombok/DataIgnore.java
@@ -14,12 +14,16 @@ class DataIgnore {
@java.lang.SuppressWarnings("all")
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
- if (o == null) return false;
- if (o.getClass() != this.getClass()) return false;
+ if (!(o instanceof DataIgnore)) return false;
final DataIgnore other = (DataIgnore)o;
+ if (!other.canEqual(this)) return false;
if (this.getX() != other.getX()) return false;
return true;
}
+ @java.lang.SuppressWarnings("all")
+ public boolean canEqual(final java.lang.Object other) {
+ return other instanceof DataIgnore;
+ }
@java.lang.Override
@java.lang.SuppressWarnings("all")
public int hashCode() {
@@ -33,4 +37,4 @@ class DataIgnore {
public java.lang.String toString() {
return "DataIgnore(x=" + this.getX() + ")";
}
-}
+} \ No newline at end of file
diff --git a/test/transform/resource/after-delombok/DataOnLocalClass.java b/test/transform/resource/after-delombok/DataOnLocalClass.java
index bb3f564d..02101a81 100644
--- a/test/transform/resource/after-delombok/DataOnLocalClass.java
+++ b/test/transform/resource/after-delombok/DataOnLocalClass.java
@@ -23,13 +23,17 @@ class DataOnLocalClass1 {
@java.lang.SuppressWarnings("all")
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
- if (o == null) return false;
- if (o.getClass() != this.getClass()) return false;
+ if (!(o instanceof Local)) return false;
final Local other = (Local)o;
+ if (!other.canEqual(this)) return false;
if (this.getX() != other.getX()) return false;
if (this.getName() == null ? other.getName() != null : !this.getName().equals(other.getName())) return false;
return true;
}
+ @java.lang.SuppressWarnings("all")
+ public boolean canEqual(final java.lang.Object other) {
+ return other instanceof Local;
+ }
@java.lang.Override
@java.lang.SuppressWarnings("all")
public int hashCode() {
@@ -73,12 +77,16 @@ class DataOnLocalClass2 {
@java.lang.SuppressWarnings("all")
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
- if (o == null) return false;
- if (o.getClass() != this.getClass()) return false;
+ if (!(o instanceof InnerLocal)) return false;
final InnerLocal other = (InnerLocal)o;
+ if (!other.canEqual(this)) return false;
if (this.getName() == null ? other.getName() != null : !this.getName().equals(other.getName())) return false;
return true;
}
+ @java.lang.SuppressWarnings("all")
+ public boolean canEqual(final java.lang.Object other) {
+ return other instanceof InnerLocal;
+ }
@java.lang.Override
@java.lang.SuppressWarnings("all")
public int hashCode() {
@@ -105,12 +113,16 @@ class DataOnLocalClass2 {
@java.lang.SuppressWarnings("all")
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
- if (o == null) return false;
- if (o.getClass() != this.getClass()) return false;
+ if (!(o instanceof Local)) return false;
final Local other = (Local)o;
+ if (!other.canEqual(this)) return false;
if (this.getX() != other.getX()) return false;
return true;
}
+ @java.lang.SuppressWarnings("all")
+ public boolean canEqual(final java.lang.Object other) {
+ return other instanceof Local;
+ }
@java.lang.Override
@java.lang.SuppressWarnings("all")
public int hashCode() {
diff --git a/test/transform/resource/after-delombok/DataPlain.java b/test/transform/resource/after-delombok/DataPlain.java
index 1e11a33d..ef86f9d7 100644
--- a/test/transform/resource/after-delombok/DataPlain.java
+++ b/test/transform/resource/after-delombok/DataPlain.java
@@ -22,13 +22,17 @@ class Data1 {
@java.lang.SuppressWarnings("all")
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
- if (o == null) return false;
- if (o.getClass() != this.getClass()) return false;
+ if (!(o instanceof Data1)) return false;
final Data1 other = (Data1)o;
+ if (!other.canEqual(this)) return false;
if (this.getX() != other.getX()) return false;
if (this.getName() == null ? other.getName() != null : !this.getName().equals(other.getName())) return false;
return true;
}
+ @java.lang.SuppressWarnings("all")
+ public boolean canEqual(final java.lang.Object other) {
+ return other instanceof Data1;
+ }
@java.lang.Override
@java.lang.SuppressWarnings("all")
public int hashCode() {
@@ -68,13 +72,17 @@ class Data2 {
@java.lang.SuppressWarnings("all")
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
- if (o == null) return false;
- if (o.getClass() != this.getClass()) return false;
+ if (!(o instanceof Data2)) return false;
final Data2 other = (Data2)o;
+ if (!other.canEqual(this)) return false;
if (this.getX() != other.getX()) return false;
if (this.getName() == null ? other.getName() != null : !this.getName().equals(other.getName())) return false;
return true;
}
+ @java.lang.SuppressWarnings("all")
+ public boolean canEqual(final java.lang.Object other) {
+ return other instanceof Data2;
+ }
@java.lang.Override
@java.lang.SuppressWarnings("all")
public int hashCode() {
@@ -90,3 +98,87 @@ class Data2 {
return "Data2(x=" + this.getX() + ", name=" + this.getName() + ")";
}
}
+final class Data3 {
+ final int x;
+ String name;
+ @java.beans.ConstructorProperties({"x"})
+ @java.lang.SuppressWarnings("all")
+ public Data3(final int x) {
+ this.x = x;
+ }
+ @java.lang.SuppressWarnings("all")
+ public int getX() {
+ return this.x;
+ }
+ @java.lang.SuppressWarnings("all")
+ public String getName() {
+ return this.name;
+ }
+ @java.lang.SuppressWarnings("all")
+ public void setName(final String name) {
+ this.name = name;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public boolean equals(final java.lang.Object o) {
+ if (o == this) return true;
+ if (!(o instanceof Data3)) return false;
+ final Data3 other = (Data3)o;
+ if (this.getX() != other.getX()) return false;
+ if (this.getName() == null ? other.getName() != null : !this.getName().equals(other.getName())) 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.getX();
+ result = result * PRIME + (this.getName() == null ? 0 : this.getName().hashCode());
+ return result;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "Data3(x=" + this.getX() + ", name=" + this.getName() + ")";
+ }
+}
+final class Data4 extends java.util.Timer {
+ final int x;
+ Data4() {
+ super();
+ }
+ @java.lang.SuppressWarnings("all")
+ public int getX() {
+ return this.x;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "Data4(x=" + this.getX() + ")";
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public boolean equals(final java.lang.Object o) {
+ if (o == this) return true;
+ if (!(o instanceof Data4)) return false;
+ final Data4 other = (Data4)o;
+ if (!other.canEqual(this)) return false;
+ if (!super.equals(o)) return false;
+ if (this.getX() != other.getX()) return false;
+ return true;
+ }
+ @java.lang.SuppressWarnings("all")
+ public boolean canEqual(final java.lang.Object other) {
+ return other instanceof Data4;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public int hashCode() {
+ final int PRIME = 31;
+ int result = 1;
+ result = result * PRIME + super.hashCode();
+ result = result * PRIME + this.getX();
+ return result;
+ }
+}
diff --git a/test/transform/resource/after-delombok/DataWithGetter.java b/test/transform/resource/after-delombok/DataWithGetter.java
index 28b8dee0..1e181370 100644
--- a/test/transform/resource/after-delombok/DataWithGetter.java
+++ b/test/transform/resource/after-delombok/DataWithGetter.java
@@ -19,14 +19,18 @@ class DataWithGetter {
@java.lang.SuppressWarnings("all")
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
- if (o == null) return false;
- if (o.getClass() != this.getClass()) return false;
+ if (!(o instanceof DataWithGetter)) return false;
final DataWithGetter other = (DataWithGetter)o;
+ if (!other.canEqual(this)) return false;
if (this.getX() != other.getX()) return false;
if (this.getY() != other.getY()) return false;
if (this.getZ() == null ? other.getZ() != null : !this.getZ().equals(other.getZ())) return false;
return true;
}
+ @java.lang.SuppressWarnings("all")
+ public boolean canEqual(final java.lang.Object other) {
+ return other instanceof DataWithGetter;
+ }
@java.lang.Override
@java.lang.SuppressWarnings("all")
public int hashCode() {
diff --git a/test/transform/resource/after-delombok/DataWithGetterNone.java b/test/transform/resource/after-delombok/DataWithGetterNone.java
index 161c70f9..b1cab7cf 100644
--- a/test/transform/resource/after-delombok/DataWithGetterNone.java
+++ b/test/transform/resource/after-delombok/DataWithGetterNone.java
@@ -19,14 +19,18 @@ class DataWithGetterNone {
@java.lang.SuppressWarnings("all")
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
- if (o == null) return false;
- if (o.getClass() != this.getClass()) return false;
+ if (!(o instanceof DataWithGetterNone)) return false;
final DataWithGetterNone other = (DataWithGetterNone)o;
+ if (!other.canEqual(this)) return false;
if (this.x != other.x) return false;
if (this.y != other.y) return false;
if (this.z == null ? other.z != null : !this.z.equals(other.z)) return false;
return true;
}
+ @java.lang.SuppressWarnings("all")
+ public boolean canEqual(final java.lang.Object other) {
+ return other instanceof DataWithGetterNone;
+ }
@java.lang.Override
@java.lang.SuppressWarnings("all")
public int hashCode() {
diff --git a/test/transform/resource/after-ecj/DataPlain.java b/test/transform/resource/after-ecj/DataPlain.java
index b6e385f3..b0af873f 100644
--- a/test/transform/resource/after-ecj/DataPlain.java
+++ b/test/transform/resource/after-ecj/DataPlain.java
@@ -81,3 +81,77 @@ import lombok.Data;
return (((("Data2(x=" + this.getX()) + ", name=") + this.getName()) + ")");
}
}
+final @Data class Data3 {
+ final int x;
+ String name;
+ public @java.beans.ConstructorProperties({"x"}) @java.lang.SuppressWarnings("all") Data3(final int x) {
+ super();
+ this.x = x;
+ }
+ public @java.lang.SuppressWarnings("all") int getX() {
+ return this.x;
+ }
+ public @java.lang.SuppressWarnings("all") String getName() {
+ return this.name;
+ }
+ public @java.lang.SuppressWarnings("all") void setName(final String name) {
+ this.name = name;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
+ if ((o == this))
+ return true;
+ if ((o == null))
+ return false;
+ if ((o.getClass() != this.getClass()))
+ return false;
+ final Data3 other = (Data3) o;
+ if ((this.getX() != other.getX()))
+ return false;
+ if (((this.getName() == null) ? (other.getName() != null) : (! this.getName().equals(other.getName()))))
+ return false;
+ return true;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
+ final int PRIME = 31;
+ int result = 1;
+ result = ((result * PRIME) + this.getX());
+ result = ((result * PRIME) + ((this.getName() == null) ? 0 : this.getName().hashCode()));
+ return result;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (((("Data3(x=" + this.getX()) + ", name=") + this.getName()) + ")");
+ }
+}
+final @Data @lombok.EqualsAndHashCode(callSuper = true) class Data4 extends java.util.Timer {
+ final int x;
+ public @java.lang.SuppressWarnings("all") int getX() {
+ return this.x;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("Data4(x=" + this.getX()) + ")");
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
+ if ((o == this))
+ return true;
+ if ((o == null))
+ return false;
+ if ((o.getClass() != this.getClass()))
+ return false;
+ if ((! super.equals(o)))
+ return false;
+ final Data4 other = (Data4) o;
+ if ((this.getX() != other.getX()))
+ return false;
+ return true;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
+ final int PRIME = 31;
+ int result = 1;
+ result = ((result * PRIME) + super.hashCode());
+ result = ((result * PRIME) + this.getX());
+ return result;
+ }
+ Data4() {
+ super();
+ }
+}
diff --git a/test/transform/resource/before/DataPlain.java b/test/transform/resource/before/DataPlain.java
index 680ae46f..4151dd20 100644
--- a/test/transform/resource/before/DataPlain.java
+++ b/test/transform/resource/before/DataPlain.java
@@ -6,4 +6,16 @@ import lombok.Data;
@Data class Data2 {
final int x;
String name;
-} \ No newline at end of file
+}
+final @Data class Data3 {
+ final int x;
+ String name;
+}
+@Data
+@lombok.EqualsAndHashCode(callSuper=true)
+final class Data4 extends java.util.Timer {
+ final int x;
+ Data4() {
+ super();
+ }
+}