diff options
Diffstat (limited to 'test/transform')
70 files changed, 2263 insertions, 0 deletions
diff --git a/test/transform/resource/after-eclipse/ClassNamedAfterGetter.java b/test/transform/resource/after-eclipse/ClassNamedAfterGetter.java new file mode 100644 index 00000000..fb9df0ea --- /dev/null +++ b/test/transform/resource/after-eclipse/ClassNamedAfterGetter.java @@ -0,0 +1,9 @@ +class GetFoo { + private @lombok.Getter int foo; + public @java.lang.SuppressWarnings("all") int getFoo() { + return this.foo; + } + GetFoo() { + super(); + } +} diff --git a/test/transform/resource/after-eclipse/CleanupName.java b/test/transform/resource/after-eclipse/CleanupName.java new file mode 100644 index 00000000..f3f725f2 --- /dev/null +++ b/test/transform/resource/after-eclipse/CleanupName.java @@ -0,0 +1,33 @@ +class CleanupName { + CleanupName() { + super(); + } + void test() { + @lombok.Cleanup("toString") Object o = "Hello World!"; + try + { + System.out.println(o); + } + finally + { + if ((java.util.Collections.singletonList(o).get(0) != null)) + { + o.toString(); + } + } + } + void test2() { + @lombok.Cleanup(value = "toString") Object o = "Hello World too!"; + try + { + System.out.println(o); + } + finally + { + if ((java.util.Collections.singletonList(o).get(0) != null)) + { + o.toString(); + } + } + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/CleanupPlain.java b/test/transform/resource/after-eclipse/CleanupPlain.java new file mode 100644 index 00000000..a9b9eceb --- /dev/null +++ b/test/transform/resource/after-eclipse/CleanupPlain.java @@ -0,0 +1,35 @@ +import lombok.Cleanup; +import java.io.*; +class CleanupPlain { + CleanupPlain() { + super(); + } + void test() throws Exception { + @lombok.Cleanup InputStream in = new FileInputStream("in"); + try + { + @Cleanup OutputStream out = new FileOutputStream("out"); + try + { + if (in.markSupported()) + { + out.flush(); + } + } + finally + { + if ((java.util.Collections.singletonList(out).get(0) != null)) + { + out.close(); + } + } + } + finally + { + if ((java.util.Collections.singletonList(in).get(0) != null)) + { + in.close(); + } + } + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/CommentsInterspersed.java b/test/transform/resource/after-eclipse/CommentsInterspersed.java new file mode 100644 index 00000000..60c69aed --- /dev/null +++ b/test/transform/resource/after-eclipse/CommentsInterspersed.java @@ -0,0 +1,12 @@ +import lombok.Getter; +public class CommentsInterspersed { + private int x; + private @Getter String test = "foo"; + public @java.lang.SuppressWarnings("all") String getTest() { + return this.test; + } + public CommentsInterspersed() { + super(); + } + public native void gwtTest(); +} diff --git a/test/transform/resource/after-eclipse/Constructors.java b/test/transform/resource/after-eclipse/Constructors.java new file mode 100644 index 00000000..e4fba7ff --- /dev/null +++ b/test/transform/resource/after-eclipse/Constructors.java @@ -0,0 +1,56 @@ +@lombok.RequiredArgsConstructor class RequiredArgsConstructor1 { + final int x; + String name; + public @java.beans.ConstructorProperties({"x"}) @java.lang.SuppressWarnings("all") RequiredArgsConstructor1(final int x) { + super(); + this.x = x; + } +} + +@lombok.RequiredArgsConstructor(access = lombok.AccessLevel.PROTECTED) class RequiredArgsConstructorAccess { + final int x; + String name; + protected @java.beans.ConstructorProperties({"x"}) @java.lang.SuppressWarnings("all") RequiredArgsConstructorAccess(final int x) { + super(); + this.x = x; + } +} + +@lombok.RequiredArgsConstructor(staticName = "staticname") class RequiredArgsConstructorStaticName { + final int x; + String name; + private @java.lang.SuppressWarnings("all") RequiredArgsConstructorStaticName(final int x) { + super(); + this.x = x; + } + public static @java.lang.SuppressWarnings("all") RequiredArgsConstructorStaticName staticname(final int x) { + return new RequiredArgsConstructorStaticName(x); + } +} + +@lombok.RequiredArgsConstructor() class RequiredArgsConstructorWithAnnotations { + final int x; + String name; + public @Deprecated @java.beans.ConstructorProperties({"x"}) @java.lang.SuppressWarnings("all") RequiredArgsConstructorWithAnnotations(final int x) { + super(); + this.x = x; + } +} + +@lombok.AllArgsConstructor class AllArgsConstructor1 { + final int x; + String name; + public @java.beans.ConstructorProperties({"x", "name"}) @java.lang.SuppressWarnings("all") AllArgsConstructor1(final int x, final String name) { + super(); + this.x = x; + this.name = name; + } +} + +@lombok.NoArgsConstructor class NoArgsConstructor1 { + final int x; + String name; + public @java.lang.SuppressWarnings("all") NoArgsConstructor1() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/DataExtended.java b/test/transform/resource/after-eclipse/DataExtended.java new file mode 100644 index 00000000..924fe8da --- /dev/null +++ b/test/transform/resource/after-eclipse/DataExtended.java @@ -0,0 +1,36 @@ +@lombok.Data @lombok.ToString(doNotUseGetters = true) class DataExtended { + int x; + public @java.lang.SuppressWarnings("all") DataExtended() { + super(); + } + public @java.lang.SuppressWarnings("all") int getX() { + return this.x; + } + public @java.lang.SuppressWarnings("all") void setX(final int x) { + this.x = x; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof DataExtended))) + return false; + final DataExtended other = (DataExtended) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + if ((this.getX() != other.getX())) + return false; + return true; + } + public @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof DataExtended); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + final int PRIME = 31; + int result = 1; + result = ((result * PRIME) + this.getX()); + return result; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("DataExtended(x=" + this.x) + ")"); + } +} diff --git a/test/transform/resource/after-eclipse/DataIgnore.java b/test/transform/resource/after-eclipse/DataIgnore.java new file mode 100644 index 00000000..fb700ee2 --- /dev/null +++ b/test/transform/resource/after-eclipse/DataIgnore.java @@ -0,0 +1,35 @@ +@lombok.Data class DataIgnore { + final int x; + String $name; + public @java.beans.ConstructorProperties({"x"}) @java.lang.SuppressWarnings("all") DataIgnore(final int x) { + super(); + this.x = x; + } + public @java.lang.SuppressWarnings("all") int getX() { + return this.x; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof DataIgnore))) + return false; + final DataIgnore other = (DataIgnore) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + if ((this.getX() != other.getX())) + return false; + return true; + } + public @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof DataIgnore); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + final int PRIME = 31; + int result = 1; + result = ((result * PRIME) + this.getX()); + return result; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("DataIgnore(x=" + this.getX()) + ")"); + } +} diff --git a/test/transform/resource/after-eclipse/DataOnEnum.java b/test/transform/resource/after-eclipse/DataOnEnum.java new file mode 100644 index 00000000..8bab5925 --- /dev/null +++ b/test/transform/resource/after-eclipse/DataOnEnum.java @@ -0,0 +1,16 @@ +public @lombok.Getter @lombok.ToString @lombok.RequiredArgsConstructor enum DataOnEnum { + A("hello"), + private final String someField; + <clinit>() { + } + private @java.lang.SuppressWarnings("all") DataOnEnum(final String someField) { + super(); + this.someField = someField; + } + public @java.lang.SuppressWarnings("all") String getSomeField() { + return this.someField; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("DataOnEnum(someField=" + this.getSomeField()) + ")"); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/DataOnLocalClass.java b/test/transform/resource/after-eclipse/DataOnLocalClass.java new file mode 100644 index 00000000..6c85fae7 --- /dev/null +++ b/test/transform/resource/after-eclipse/DataOnLocalClass.java @@ -0,0 +1,134 @@ +import lombok.Data; +class DataOnLocalClass1 { + DataOnLocalClass1() { + super(); + } + public static void main(String[] args) { + @Data class Local { + final int x; + String name; + public @java.lang.SuppressWarnings("all") Local(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 instanceof Local))) + return false; + final Local other = (Local) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + if ((this.getX() != other.getX())) + return false; + if (((this.getName() == null) ? (other.getName() != null) : (! this.getName().equals((java.lang.Object) other.getName())))) + return false; + return true; + } + public @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof Local); + } + 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 (((("Local(x=" + this.getX()) + ", name=") + this.getName()) + ")"); + } + } + } +} +class DataOnLocalClass2 { + { + @Data class Local { + @Data class InnerLocal { + @lombok.NonNull String name; + public @java.lang.SuppressWarnings("all") InnerLocal(final @lombok.NonNull String name) { + super(); + if ((name == null)) + throw new java.lang.NullPointerException("name"); + this.name = name; + } + public @lombok.NonNull @java.lang.SuppressWarnings("all") String getName() { + return this.name; + } + public @java.lang.SuppressWarnings("all") void setName(final @lombok.NonNull String name) { + if ((name == null)) + throw new java.lang.NullPointerException("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 instanceof InnerLocal))) + return false; + final InnerLocal other = (InnerLocal) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + if (((this.getName() == null) ? (other.getName() != null) : (! this.getName().equals((java.lang.Object) other.getName())))) + return false; + return true; + } + public @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof InnerLocal); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + final int PRIME = 31; + int result = 1; + 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 (("Local.InnerLocal(name=" + this.getName()) + ")"); + } + } + final int x; + public @java.lang.SuppressWarnings("all") Local(final int x) { + super(); + this.x = x; + } + public @java.lang.SuppressWarnings("all") int getX() { + return this.x; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof Local))) + return false; + final Local other = (Local) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + if ((this.getX() != other.getX())) + return false; + return true; + } + public @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof Local); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + final int PRIME = 31; + int result = 1; + result = ((result * PRIME) + this.getX()); + return result; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("Local(x=" + this.getX()) + ")"); + } + } + } + DataOnLocalClass2() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/DataPlain.java b/test/transform/resource/after-eclipse/DataPlain.java new file mode 100644 index 00000000..0edf164b --- /dev/null +++ b/test/transform/resource/after-eclipse/DataPlain.java @@ -0,0 +1,208 @@ +import lombok.Data; +@lombok.Data class Data1 { + final int x; + String name; + public @java.beans.ConstructorProperties({"x"}) @java.lang.SuppressWarnings("all") Data1(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 instanceof Data1))) + return false; + final Data1 other = (Data1) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + if ((this.getX() != other.getX())) + return false; + if (((this.getName() == null) ? (other.getName() != null) : (! this.getName().equals((java.lang.Object) other.getName())))) + return false; + return true; + } + public @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof Data1); + } + 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 (((("Data1(x=" + this.getX()) + ", name=") + this.getName()) + ")"); + } +} +@Data class Data2 { + final int x; + String name; + public @java.beans.ConstructorProperties({"x"}) @java.lang.SuppressWarnings("all") Data2(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 instanceof Data2))) + return false; + final Data2 other = (Data2) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + if ((this.getX() != other.getX())) + return false; + if (((this.getName() == null) ? (other.getName() != null) : (! this.getName().equals((java.lang.Object) other.getName())))) + return false; + return true; + } + public @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof Data2); + } + 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 (((("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 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((java.lang.Object) 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 instanceof Data4))) + return false; + final Data4 other = (Data4) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + if ((! super.equals(o))) + return false; + if ((this.getX() != other.getX())) + return false; + return true; + } + public @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof Data4); + } + 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(); + } +} +@Data class Data5 { + public @java.lang.SuppressWarnings("all") Data5() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof Data5))) + return false; + final Data5 other = (Data5) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + return true; + } + public @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof Data5); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + int result = 1; + return result; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return "Data5()"; + } +} +final @Data class Data6 { + public @java.lang.SuppressWarnings("all") Data6() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof Data6))) + return false; + return true; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + int result = 1; + return result; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return "Data6()"; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/DataWithGetter.java b/test/transform/resource/after-eclipse/DataWithGetter.java new file mode 100644 index 00000000..d409382d --- /dev/null +++ b/test/transform/resource/after-eclipse/DataWithGetter.java @@ -0,0 +1,54 @@ +@lombok.Data @lombok.Getter class DataWithGetter { + private int x; + private int y; + private final String z; + public @java.beans.ConstructorProperties({"z"}) @java.lang.SuppressWarnings("all") DataWithGetter(final String z) { + super(); + this.z = z; + } + public @java.lang.SuppressWarnings("all") void setX(final int x) { + this.x = x; + } + public @java.lang.SuppressWarnings("all") void setY(final int y) { + this.y = y; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof DataWithGetter))) + return false; + final DataWithGetter other = (DataWithGetter) o; + if ((! other.canEqual((java.lang.Object) 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((java.lang.Object) other.getZ())))) + return false; + return true; + } + public @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof DataWithGetter); + } + 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.getY()); + result = ((result * PRIME) + ((this.getZ() == null) ? 0 : this.getZ().hashCode())); + return result; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("DataWithGetter(x=" + this.getX()) + ", y=") + this.getY()) + ", z=") + this.getZ()) + ")"); + } + public @java.lang.SuppressWarnings("all") int getX() { + return this.x; + } + public @java.lang.SuppressWarnings("all") int getY() { + return this.y; + } + public @java.lang.SuppressWarnings("all") String getZ() { + return this.z; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/DataWithGetterNone.java b/test/transform/resource/after-eclipse/DataWithGetterNone.java new file mode 100644 index 00000000..2380865b --- /dev/null +++ b/test/transform/resource/after-eclipse/DataWithGetterNone.java @@ -0,0 +1,45 @@ +@lombok.Data @lombok.Getter(lombok.AccessLevel.NONE) class DataWithGetterNone { + private int x; + private int y; + private final String z; + public @java.beans.ConstructorProperties({"z"}) @java.lang.SuppressWarnings("all") DataWithGetterNone(final String z) { + super(); + this.z = z; + } + public @java.lang.SuppressWarnings("all") void setX(final int x) { + this.x = x; + } + public @java.lang.SuppressWarnings("all") void setY(final int y) { + this.y = y; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof DataWithGetterNone))) + return false; + final DataWithGetterNone other = (DataWithGetterNone) o; + if ((! other.canEqual((java.lang.Object) 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((java.lang.Object) other.z)))) + return false; + return true; + } + public @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof DataWithGetterNone); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + final int PRIME = 31; + int result = 1; + result = ((result * PRIME) + this.x); + result = ((result * PRIME) + this.y); + result = ((result * PRIME) + ((this.z == null) ? 0 : this.z.hashCode())); + return result; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("DataWithGetterNone(x=" + this.x) + ", y=") + this.y) + ", z=") + this.z) + ")"); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/DelegateTypesAndExcludes.java b/test/transform/resource/after-eclipse/DelegateTypesAndExcludes.java new file mode 100644 index 00000000..821c0851 --- /dev/null +++ b/test/transform/resource/after-eclipse/DelegateTypesAndExcludes.java @@ -0,0 +1,36 @@ +import lombok.Delegate; +class DelegatePlain { + private static class FooImpl implements Foo { + private FooImpl() { + super(); + } + public void foo() { + } + public void bar(java.util.ArrayList<java.lang.String> list) { + } + } + private static class BarImpl implements Bar { + private BarImpl() { + super(); + } + public void bar(java.util.ArrayList<java.lang.String> list) { + } + } + private static interface Foo extends Bar { + void foo(); + } + private static interface Bar { + void bar(java.util.ArrayList<java.lang.String> list); + } + private final @Delegate(types = Bar.class) BarImpl bar = new BarImpl(); + private final @Delegate(types = Foo.class,excludes = Bar.class) FooImpl foo = new FooImpl(); + public @java.lang.SuppressWarnings("all") void bar(final java.util.ArrayList<java.lang.String> list) { + this.bar.bar(list); + } + public @java.lang.SuppressWarnings("all") void foo() { + this.foo.foo(); + } + DelegatePlain() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/GetterAccessLevel.java b/test/transform/resource/after-eclipse/GetterAccessLevel.java new file mode 100644 index 00000000..f0de95e7 --- /dev/null +++ b/test/transform/resource/after-eclipse/GetterAccessLevel.java @@ -0,0 +1,43 @@ +class GetterAccessLevel { + @lombok.Getter(lombok.AccessLevel.NONE) boolean isNone; + @lombok.Getter(lombok.AccessLevel.PRIVATE) boolean isPrivate; + @lombok.Getter(lombok.AccessLevel.PACKAGE) boolean isPackage; + @lombok.Getter(lombok.AccessLevel.PROTECTED) boolean isProtected; + @lombok.Getter(lombok.AccessLevel.PUBLIC) boolean isPublic; + @lombok.Getter(lombok.AccessLevel.NONE) String noneString; + @lombok.Getter(lombok.AccessLevel.PRIVATE) String privateString; + @lombok.Getter(lombok.AccessLevel.PACKAGE) String packageString; + @lombok.Getter(lombok.AccessLevel.PROTECTED) String protectedString; + @lombok.Getter(lombok.AccessLevel.PUBLIC) String publicString; + @lombok.Getter(value = lombok.AccessLevel.PUBLIC) String value; + private @java.lang.SuppressWarnings("all") boolean isPrivate() { + return this.isPrivate; + } + @java.lang.SuppressWarnings("all") boolean isPackage() { + return this.isPackage; + } + protected @java.lang.SuppressWarnings("all") boolean isProtected() { + return this.isProtected; + } + public @java.lang.SuppressWarnings("all") boolean isPublic() { + return this.isPublic; + } + private @java.lang.SuppressWarnings("all") String getPrivateString() { + return this.privateString; + } + @java.lang.SuppressWarnings("all") String getPackageString() { + return this.packageString; + } + protected @java.lang.SuppressWarnings("all") String getProtectedString() { + return this.protectedString; + } + public @java.lang.SuppressWarnings("all") String getPublicString() { + return this.publicString; + } + public @java.lang.SuppressWarnings("all") String getValue() { + return this.value; + } + GetterAccessLevel() { + super(); + } +} diff --git a/test/transform/resource/after-eclipse/GetterAlreadyExists.java b/test/transform/resource/after-eclipse/GetterAlreadyExists.java new file mode 100644 index 00000000..257457bb --- /dev/null +++ b/test/transform/resource/after-eclipse/GetterAlreadyExists.java @@ -0,0 +1,192 @@ +class Getter1 { + @lombok.Getter boolean foo; + public @java.lang.SuppressWarnings("all") boolean isFoo() { + return this.foo; + } + Getter1() { + super(); + } + boolean hasFoo() { + return true; + } +} +class Getter2 { + @lombok.Getter boolean foo; + Getter2() { + super(); + } + boolean isFoo() { + return true; + } +} +class Getter3 { + @lombok.Getter boolean foo; + Getter3() { + super(); + } + boolean getFoo() { + return true; + } +} +class Getter4 { + @lombok.Getter String foo; + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } + Getter4() { + super(); + } + String hasFoo() { + return null; + } +} +class Getter5 { + @lombok.Getter String foo; + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } + Getter5() { + super(); + } + String isFoo() { + return null; + } +} +class Getter6 { + @lombok.Getter String foo; + Getter6() { + super(); + } + String getFoo() { + return null; + } +} +class Getter7 { + @lombok.Getter String foo; + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } + Getter7() { + super(); + } + boolean hasFoo() { + return false; + } +} +class Getter8 { + @lombok.Getter String foo; + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } + Getter8() { + super(); + } + boolean isFoo() { + return false; + } +} +class Getter9 { + @lombok.Getter String foo; + Getter9() { + super(); + } + boolean getFoo() { + return false; + } +} +class Getter10 { + @lombok.Getter boolean foo; + public @java.lang.SuppressWarnings("all") boolean isFoo() { + return this.foo; + } + Getter10() { + super(); + } + static boolean hasFoo() { + return false; + } +} +class Getter11 { + @lombok.Getter boolean foo; + Getter11() { + super(); + } + static boolean isFoo() { + return false; + } +} +class Getter12 { + @lombok.Getter boolean foo; + Getter12() { + super(); + } + static boolean getFoo() { + return false; + } +} +class Getter13 { + @lombok.Getter String foo; + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } + Getter13() { + super(); + } + static boolean hasFoo() { + return false; + } +} +class Getter14 { + @lombok.Getter String foo; + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } + Getter14() { + super(); + } + static boolean isFoo() { + return false; + } +} +class Getter15 { + @lombok.Getter String foo; + Getter15() { + super(); + } + static boolean getFoo() { + return false; + } +} +class Getter16 { + @lombok.Getter String foo; + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } + Getter16() { + super(); + } + static String hasFoo() { + return false; + } +} +class Getter17 { + @lombok.Getter String foo; + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } + Getter17() { + super(); + } + static String isFoo() { + return false; + } +} +class Getter18 { + @lombok.Getter String foo; + Getter18() { + super(); + } + static String getFoo() { + return false; + } +} diff --git a/test/transform/resource/after-eclipse/GetterBoolean.java b/test/transform/resource/after-eclipse/GetterBoolean.java new file mode 100644 index 00000000..121af119 --- /dev/null +++ b/test/transform/resource/after-eclipse/GetterBoolean.java @@ -0,0 +1,38 @@ +class Getter { + @lombok.Getter boolean foo; + @lombok.Getter boolean isBar; + @lombok.Getter boolean hasBaz; + public @java.lang.SuppressWarnings("all") boolean isFoo() { + return this.foo; + } + public @java.lang.SuppressWarnings("all") boolean isBar() { + return this.isBar; + } + public @java.lang.SuppressWarnings("all") boolean isHasBaz() { + return this.hasBaz; + } + Getter() { + super(); + } +} +class MoreGetter { + @lombok.Getter boolean foo; + public @java.lang.SuppressWarnings("all") boolean isFoo() { + return this.foo; + } + MoreGetter() { + super(); + } + boolean hasFoo() { + return true; + } +} +class YetMoreGetter { + @lombok.Getter boolean foo; + YetMoreGetter() { + super(); + } + boolean getFoo() { + return true; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/GetterLazy.java b/test/transform/resource/after-eclipse/GetterLazy.java new file mode 100644 index 00000000..669a9a81 --- /dev/null +++ b/test/transform/resource/after-eclipse/GetterLazy.java @@ -0,0 +1,27 @@ +class GetterLazy { + static class ValueType { + ValueType() { + super(); + } + } + private final @lombok.Getter(lazy = true) java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<ValueType>> fieldName = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<ValueType>>(); + public @java.lang.SuppressWarnings("all") ValueType getFieldName() { + java.util.concurrent.atomic.AtomicReference<ValueType> value = this.fieldName.get(); + if ((value == null)) + { + synchronized (this.fieldName) + { + value = this.fieldName.get(); + if ((value == null)) + { + value = new java.util.concurrent.atomic.AtomicReference<ValueType>(new ValueType()); + this.fieldName.set(value); + } + } + } + return value.get(); + } + GetterLazy() { + super(); + } +} diff --git a/test/transform/resource/after-eclipse/GetterLazyEahcToString.java b/test/transform/resource/after-eclipse/GetterLazyEahcToString.java new file mode 100644 index 00000000..dc732861 --- /dev/null +++ b/test/transform/resource/after-eclipse/GetterLazyEahcToString.java @@ -0,0 +1,53 @@ +@lombok.EqualsAndHashCode(doNotUseGetters = true) @lombok.ToString(doNotUseGetters = true) class GetterLazyEahcToString { + private final @lombok.Getter(lazy = true) java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<String>> value = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<String>>(); + private final @lombok.Getter String value2 = ""; + public @java.lang.SuppressWarnings("all") String getValue() { + java.util.concurrent.atomic.AtomicReference<String> value = this.value.get(); + if ((value == null)) + { + synchronized (this.value) + { + value = this.value.get(); + if ((value == null)) + { + value = new java.util.concurrent.atomic.AtomicReference<String>(""); + this.value.set(value); + } + } + } + return value.get(); + } + public @java.lang.SuppressWarnings("all") String getValue2() { + return this.value2; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof GetterLazyEahcToString))) + return false; + final GetterLazyEahcToString other = (GetterLazyEahcToString) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + if (((this.getValue() == null) ? (other.getValue() != null) : (! this.getValue().equals((java.lang.Object) other.getValue())))) + return false; + if (((this.value2 == null) ? (other.value2 != null) : (! this.value2.equals((java.lang.Object) other.value2)))) + return false; + return true; + } + public @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof GetterLazyEahcToString); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + final int PRIME = 31; + int result = 1; + result = ((result * PRIME) + ((this.getValue() == null) ? 0 : this.getValue().hashCode())); + result = ((result * PRIME) + ((this.value2 == null) ? 0 : this.value2.hashCode())); + return result; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("GetterLazyEahcToString(value=" + this.getValue()) + ", value2=") + this.value2) + ")"); + } + GetterLazyEahcToString() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/GetterLazyInvalid.java b/test/transform/resource/after-eclipse/GetterLazyInvalid.java new file mode 100644 index 00000000..eaa22d71 --- /dev/null +++ b/test/transform/resource/after-eclipse/GetterLazyInvalid.java @@ -0,0 +1,40 @@ +class GetterLazyInvalidNotFinal { + private @lombok.Getter(lazy = true) String fieldName = ""; + GetterLazyInvalidNotFinal() { + super(); + } +} +class GetterLazyInvalidNotPrivate { + final @lombok.Getter(lazy = true) String fieldName = ""; + GetterLazyInvalidNotPrivate() { + super(); + } +} +class GetterLazyInvalidNotPrivateFinal { + @lombok.Getter(lazy = true) String fieldName = ""; + GetterLazyInvalidNotPrivateFinal() { + super(); + } +} +class GetterLazyInvalidNone { + private final @lombok.Getter(lazy = true,value = lombok.AccessLevel.NONE) String fieldName = ""; + GetterLazyInvalidNone() { + super(); + } +} +@lombok.Getter(lazy = true) class GetterLazyInvalidClass { + private final String fieldName = ""; + public @java.lang.SuppressWarnings("all") String getFieldName() { + return this.fieldName; + } + GetterLazyInvalidClass() { + super(); + } +} +class GetterLazyInvalidNoInit { + private final @lombok.Getter(lazy = true) String fieldName; + GetterLazyInvalidNoInit() { + super(); + this.fieldName = "foo"; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/GetterLazyNative.java b/test/transform/resource/after-eclipse/GetterLazyNative.java new file mode 100644 index 00000000..6c90a101 --- /dev/null +++ b/test/transform/resource/after-eclipse/GetterLazyNative.java @@ -0,0 +1,158 @@ +class GetterLazyNative { + private final @lombok.Getter(lazy = true) java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>> booleanField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>>(); + private final @lombok.Getter(lazy = true) java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Byte>> byteField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Byte>>(); + private final @lombok.Getter(lazy = true) java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Short>> shortField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Short>>(); + private final @lombok.Getter(lazy = true) java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Integer>> intField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Integer>>(); + private final @lombok.Getter(lazy = true) java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Long>> longField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Long>>(); + private final @lombok.Getter(lazy = true) java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Float>> floatField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Float>>(); + private final @lombok.Getter(lazy = true) java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Double>> doubleField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Double>>(); + private final @lombok.Getter(lazy = true) java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Character>> charField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Character>>(); + private final @lombok.Getter(lazy = true) java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<int[]>> intArrayField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<int[]>>(); + public @java.lang.SuppressWarnings("all") boolean isBooleanField() { + java.util.concurrent.atomic.AtomicReference<java.lang.Boolean> value = this.booleanField.get(); + if ((value == null)) + { + synchronized (this.booleanField) + { + value = this.booleanField.get(); + if ((value == null)) + { + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>(true); + this.booleanField.set(value); + } + } + } + return value.get(); + } + public @java.lang.SuppressWarnings("all") byte getByteField() { + java.util.concurrent.atomic.AtomicReference<java.lang.Byte> value = this.byteField.get(); + if ((value == null)) + { + synchronized (this.byteField) + { + value = this.byteField.get(); + if ((value == null)) + { + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Byte>(1); + this.byteField.set(value); + } + } + } + return value.get(); + } + public @java.lang.SuppressWarnings("all") short getShortField() { + java.util.concurrent.atomic.AtomicReference<java.lang.Short> value = this.shortField.get(); + if ((value == null)) + { + synchronized (this.shortField) + { + value = this.shortField.get(); + if ((value == null)) + { + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Short>(1); + this.shortField.set(value); + } + } + } + return value.get(); + } + public @java.lang.SuppressWarnings("all") int getIntField() { + java.util.concurrent.atomic.AtomicReference<java.lang.Integer> value = this.intField.get(); + if ((value == null)) + { + synchronized (this.intField) + { + value = this.intField.get(); + if ((value == null)) + { + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Integer>(1); + this.intField.set(value); + } + } + } + return value.get(); + } + public @java.lang.SuppressWarnings("all") long getLongField() { + java.util.concurrent.atomic.AtomicReference<java.lang.Long> value = this.longField.get(); + if ((value == null)) + { + synchronized (this.longField) + { + value = this.longField.get(); + if ((value == null)) + { + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Long>(1); + this.longField.set(value); + } + } + } + return value.get(); + } + public @java.lang.SuppressWarnings("all") float getFloatField() { + java.util.concurrent.atomic.AtomicReference<java.lang.Float> value = this.floatField.get(); + if ((value == null)) + { + synchronized (this.floatField) + { + value = this.floatField.get(); + if ((value == null)) + { + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Float>(1.0f); + this.floatField.set(value); + } + } + } + return value.get(); + } + public @java.lang.SuppressWarnings("all") double getDoubleField() { + java.util.concurrent.atomic.AtomicReference<java.lang.Double> value = this.doubleField.get(); + if ((value == null)) + { + synchronized (this.doubleField) + { + value = this.doubleField.get(); + if ((value == null)) + { + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Double>(1.0); + this.doubleField.set(value); + } + } + } + return value.get(); + } + public @java.lang.SuppressWarnings("all") char getCharField() { + java.util.concurrent.atomic.AtomicReference<java.lang.Character> value = this.charField.get(); + if ((value == null)) + { + synchronized (this.charField) + { + value = this.charField.get(); + if ((value == null)) + { + value = new java.util.concurrent.atomic.AtomicReference<java.lang.Character>('1'); + this.charField.set(value); + } + } + } + return value.get(); + } + public @java.lang.SuppressWarnings("all") int[] getIntArrayField() { + java.util.concurrent.atomic.AtomicReference<int[]> value = this.intArrayField.get(); + if ((value == null)) + { + synchronized (this.intArrayField) + { + value = this.intArrayField.get(); + if ((value == null)) + { + value = new java.util.concurrent.atomic.AtomicReference<int[]>(new int[]{1}); + this.intArrayField.set(value); + } + } + } + return value.get(); + } + GetterLazyNative() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/GetterOnClass.java b/test/transform/resource/after-eclipse/GetterOnClass.java new file mode 100644 index 00000000..421aa150 --- /dev/null +++ b/test/transform/resource/after-eclipse/GetterOnClass.java @@ -0,0 +1,68 @@ +@lombok.Getter class GetterOnClass1 { + @lombok.Getter(lombok.AccessLevel.NONE) boolean isNone; + boolean isPublic; + public @java.lang.SuppressWarnings("all") boolean isPublic() { + return this.isPublic; + } + GetterOnClass1() { + super(); + } + +} +@lombok.Getter(lombok.AccessLevel.PROTECTED) class GetterOnClass2 { + @lombok.Getter(lombok.AccessLevel.NONE) boolean isNone; + boolean isProtected; + @lombok.Getter(lombok.AccessLevel.PACKAGE) boolean isPackage; + @java.lang.SuppressWarnings("all") boolean isPackage() { + return this.isPackage; + } + protected @java.lang.SuppressWarnings("all") boolean isProtected() { + return this.isProtected; + } + GetterOnClass2() { + super(); + } +} +@lombok.Getter(lombok.AccessLevel.PACKAGE) class GetterOnClass3 { + @lombok.Getter(lombok.AccessLevel.NONE) boolean isNone; + boolean isPackage; + @java.lang.SuppressWarnings("all") boolean isPackage() { + return this.isPackage; + } + GetterOnClass3() { + super(); + } +} +@lombok.Getter(lombok.AccessLevel.PRIVATE) class GetterOnClass4 { + @lombok.Getter(lombok.AccessLevel.NONE) boolean isNone; + boolean isPrivate; + private @java.lang.SuppressWarnings("all") boolean isPrivate() { + return this.isPrivate; + } + GetterOnClass4() { + super(); + } +} +@lombok.Getter(lombok.AccessLevel.PUBLIC) class GetterOnClass5 { + @lombok.Getter(lombok.AccessLevel.NONE) boolean isNone; + boolean isPublic; + public @java.lang.SuppressWarnings("all") boolean isPublic() { + return this.isPublic; + } + GetterOnClass5() { + super(); + } +} +@lombok.Getter class GetterOnClass6 { + String couldBeNull; + @lombok.NonNull String nonNull; + public @java.lang.SuppressWarnings("all") String getCouldBeNull() { + return this.couldBeNull; + } + public @lombok.NonNull @java.lang.SuppressWarnings("all") String getNonNull() { + return this.nonNull; + } + GetterOnClass6() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/GetterOnMethod.java b/test/transform/resource/after-eclipse/GetterOnMethod.java new file mode 100644 index 00000000..d7be009b --- /dev/null +++ b/test/transform/resource/after-eclipse/GetterOnMethod.java @@ -0,0 +1,40 @@ +import lombok.Getter; +class GetterOnMethod { + @lombok.Getter() int i; + @lombok.Getter() int j; + public @Deprecated @java.lang.SuppressWarnings("all") int getI() { + return this.i; + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") int getJ() { + return this.j; + } + GetterOnMethod() { + super(); + } +} +@lombok.Getter() class GetterOnClassOnMethod { + int i; + int j; + public @java.lang.SuppressWarnings("all") int getI() { + return this.i; + } + public @java.lang.SuppressWarnings("all") int getJ() { + return this.j; + } + GetterOnClassOnMethod() { + super(); + } +} +@lombok.Getter() class GetterOnClassAndOnAField { + int i; + @lombok.Getter() int j; + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") int getJ() { + return this.j; + } + public @java.lang.SuppressWarnings("all") int getI() { + return this.i; + } + GetterOnClassAndOnAField() { + super(); + } +} diff --git a/test/transform/resource/after-eclipse/GetterOnStatic.java b/test/transform/resource/after-eclipse/GetterOnStatic.java new file mode 100644 index 00000000..538f25cb --- /dev/null +++ b/test/transform/resource/after-eclipse/GetterOnStatic.java @@ -0,0 +1,15 @@ +class Getter { + static @lombok.Getter boolean foo; + static @lombok.Getter int bar; + <clinit>() { + } + public static @java.lang.SuppressWarnings("all") boolean isFoo() { + return Getter.foo; + } + public static @java.lang.SuppressWarnings("all") int getBar() { + return Getter.bar; + } + Getter() { + super(); + } +} diff --git a/test/transform/resource/after-eclipse/GetterPlain.java b/test/transform/resource/after-eclipse/GetterPlain.java new file mode 100644 index 00000000..cd096ca3 --- /dev/null +++ b/test/transform/resource/after-eclipse/GetterPlain.java @@ -0,0 +1,14 @@ +import lombok.Getter; +class GetterPlain { + @lombok.Getter int i; + @Getter int foo; + public @java.lang.SuppressWarnings("all") int getI() { + return this.i; + } + public @java.lang.SuppressWarnings("all") int getFoo() { + return this.foo; + } + GetterPlain() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/GetterWithDollar.java b/test/transform/resource/after-eclipse/GetterWithDollar.java new file mode 100644 index 00000000..b102ba66 --- /dev/null +++ b/test/transform/resource/after-eclipse/GetterWithDollar.java @@ -0,0 +1,22 @@ +class GetterWithDollar1 { + @lombok.Getter int $i; + public @java.lang.SuppressWarnings("all") int get$i() { + return this.$i; + } + GetterWithDollar1() { + super(); + } +} +class GetterWithDollar2 { + @lombok.Getter int $i; + @lombok.Getter int i; + public @java.lang.SuppressWarnings("all") int get$i() { + return this.$i; + } + public @java.lang.SuppressWarnings("all") int getI() { + return this.i; + } + GetterWithDollar2() { + super(); + } +} diff --git a/test/transform/resource/after-eclipse/LoggerCommons.java b/test/transform/resource/after-eclipse/LoggerCommons.java new file mode 100644 index 00000000..d63bb9c1 --- /dev/null +++ b/test/transform/resource/after-eclipse/LoggerCommons.java @@ -0,0 +1,17 @@ +import lombok.extern.apachecommons.CommonsLog; +@lombok.extern.apachecommons.CommonsLog class LoggerCommons { + private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(LoggerCommons.class); + <clinit>() { + } + LoggerCommons() { + super(); + } +} +@CommonsLog class LoggerCommonsWithImport { + private static final org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(LoggerCommonsWithImport.class); + <clinit>() { + } + LoggerCommonsWithImport() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/LoggerJul.java b/test/transform/resource/after-eclipse/LoggerJul.java new file mode 100644 index 00000000..c98dfe27 --- /dev/null +++ b/test/transform/resource/after-eclipse/LoggerJul.java @@ -0,0 +1,17 @@ +import lombok.extern.java.Log; +@lombok.extern.java.Log class LoggerJul { + private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(LoggerJul.class.getName()); + <clinit>() { + } + LoggerJul() { + super(); + } +} +@Log class LoggerJulWithImport { + private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(LoggerJulWithImport.class.getName()); + <clinit>() { + } + LoggerJulWithImport() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/LoggerLog4j.java b/test/transform/resource/after-eclipse/LoggerLog4j.java new file mode 100644 index 00000000..6814be7b --- /dev/null +++ b/test/transform/resource/after-eclipse/LoggerLog4j.java @@ -0,0 +1,17 @@ +import lombok.extern.log4j.Log4j; +@lombok.extern.log4j.Log4j class LoggerLog4j { + private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(LoggerLog4j.class); + <clinit>() { + } + LoggerLog4j() { + super(); + } +} +@Log4j class LoggerLog4jWithImport { + private static final org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(LoggerLog4jWithImport.class); + <clinit>() { + } + LoggerLog4jWithImport() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/LoggerSlf4j.java b/test/transform/resource/after-eclipse/LoggerSlf4j.java new file mode 100644 index 00000000..1ccf5c9e --- /dev/null +++ b/test/transform/resource/after-eclipse/LoggerSlf4j.java @@ -0,0 +1,30 @@ +import lombok.extern.slf4j.Slf4j; +@lombok.extern.slf4j.Slf4j class LoggerSlf4j { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LoggerSlf4j.class); + <clinit>() { + } + LoggerSlf4j() { + super(); + } +} +@Slf4j class LoggerSlf4jWithImport { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LoggerSlf4jWithImport.class); + <clinit>() { + } + LoggerSlf4jWithImport() { + super(); + } +} +class LoggerSlf4jOuter { + static @lombok.extern.slf4j.Slf4j class Inner { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(Inner.class); + <clinit>() { + } + Inner() { + super(); + } + } + LoggerSlf4jOuter() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/LoggerSlf4jAlreadyExists.java b/test/transform/resource/after-eclipse/LoggerSlf4jAlreadyExists.java new file mode 100644 index 00000000..5fb6bc06 --- /dev/null +++ b/test/transform/resource/after-eclipse/LoggerSlf4jAlreadyExists.java @@ -0,0 +1,6 @@ +@lombok.extern.slf4j.Slf4j class LoggerSlf4jAlreadyExists { + int log; + LoggerSlf4jAlreadyExists() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/LoggerSlf4jOnNonType.java b/test/transform/resource/after-eclipse/LoggerSlf4jOnNonType.java new file mode 100644 index 00000000..f0c2ee58 --- /dev/null +++ b/test/transform/resource/after-eclipse/LoggerSlf4jOnNonType.java @@ -0,0 +1,7 @@ +class LoggerSlf4jOnNonType { + LoggerSlf4jOnNonType() { + super(); + } + @lombok.extern.slf4j.Slf4j void foo() { + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/LoggerSlf4jTypes.java b/test/transform/resource/after-eclipse/LoggerSlf4jTypes.java new file mode 100644 index 00000000..95ed1ebf --- /dev/null +++ b/test/transform/resource/after-eclipse/LoggerSlf4jTypes.java @@ -0,0 +1,31 @@ +@lombok.extern.slf4j.Slf4j interface LoggerSlf4jTypesInterface { +} +@lombok.extern.slf4j.Slf4j @interface LoggerSlf4jTypesAnnotation { +} +@lombok.extern.slf4j.Slf4j enum LoggerSlf4jTypesEnum { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LoggerSlf4jTypesEnum.class); + <clinit>() { + } + LoggerSlf4jTypesEnum() { + super(); + } +} +@lombok.extern.slf4j.Slf4j enum LoggerSlf4jTypesEnumWithElement { + FOO(), + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(LoggerSlf4jTypesEnumWithElement.class); + <clinit>() { + } + LoggerSlf4jTypesEnumWithElement() { + super(); + } +} +interface LoggerSlf4jTypesInterfaceOuter { + @lombok.extern.slf4j.Slf4j class Inner { + private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(Inner.class); + <clinit>() { + } + Inner() { + super(); + } + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/LoggerSlf4jWithPackage.java b/test/transform/resource/after-eclipse/LoggerSlf4jWithPackage.java new file mode 100644 index 00000000..cb06d3c1 --- /dev/null +++ b/test/transform/resource/after-eclipse/LoggerSlf4jWithPackage.java @@ -0,0 +1 @@ +//ignore
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/MultiFieldGetter.java b/test/transform/resource/after-eclipse/MultiFieldGetter.java new file mode 100644 index 00000000..16368f25 --- /dev/null +++ b/test/transform/resource/after-eclipse/MultiFieldGetter.java @@ -0,0 +1,28 @@ +import lombok.Getter; +import lombok.AccessLevel; +class MultiFieldGetter { + @Getter(AccessLevel.PROTECTED) int x; + @Getter(AccessLevel.PROTECTED) int y; + protected @java.lang.SuppressWarnings("all") int getX() { + return this.x; + } + protected @java.lang.SuppressWarnings("all") int getY() { + return this.y; + } + MultiFieldGetter() { + super(); + } +} +@Getter class MultiFieldGetter2 { + @Getter(AccessLevel.PACKAGE) int x; + @Getter(AccessLevel.PACKAGE) int y; + @java.lang.SuppressWarnings("all") int getX() { + return this.x; + } + @java.lang.SuppressWarnings("all") int getY() { + return this.y; + } + MultiFieldGetter2() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/NonNullPlain.java b/test/transform/resource/after-eclipse/NonNullPlain.java new file mode 100644 index 00000000..6f552436 --- /dev/null +++ b/test/transform/resource/after-eclipse/NonNullPlain.java @@ -0,0 +1,21 @@ +class NonNullPlain { + @lombok.Setter @lombok.NonNull @lombok.Getter int i; + @lombok.Getter @lombok.Setter @lombok.NonNull String s; + public @java.lang.SuppressWarnings("all") void setI(final @lombok.NonNull int i) { + this.i = i; + } + public @lombok.NonNull @java.lang.SuppressWarnings("all") int getI() { + return this.i; + } + public @lombok.NonNull @java.lang.SuppressWarnings("all") String getS() { + return this.s; + } + public @java.lang.SuppressWarnings("all") void setS(final @lombok.NonNull String s) { + if ((s == null)) + throw new java.lang.NullPointerException("s"); + this.s = s; + } + NonNullPlain() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/SetterAccessLevel.java b/test/transform/resource/after-eclipse/SetterAccessLevel.java new file mode 100644 index 00000000..58baac51 --- /dev/null +++ b/test/transform/resource/after-eclipse/SetterAccessLevel.java @@ -0,0 +1,26 @@ +class SetterAccessLevel { + @lombok.Setter(lombok.AccessLevel.NONE) boolean isNone; + @lombok.Setter(lombok.AccessLevel.PRIVATE) boolean isPrivate; + @lombok.Setter(lombok.AccessLevel.PACKAGE) boolean isPackage; + @lombok.Setter(lombok.AccessLevel.PROTECTED) boolean isProtected; + @lombok.Setter(lombok.AccessLevel.PUBLIC) boolean isPublic; + @lombok.Setter(value = lombok.AccessLevel.PUBLIC) boolean value; + private @java.lang.SuppressWarnings("all") void setPrivate(final boolean isPrivate) { + this.isPrivate = isPrivate; + } + @java.lang.SuppressWarnings("all") void setPackage(final boolean isPackage) { + this.isPackage = isPackage; + } + protected @java.lang.SuppressWarnings("all") void setProtected(final boolean isProtected) { + this.isProtected = isProtected; + } + public @java.lang.SuppressWarnings("all") void setPublic(final boolean isPublic) { + this.isPublic = isPublic; + } + public @java.lang.SuppressWarnings("all") void setValue(final boolean value) { + this.value = value; + } + SetterAccessLevel() { + super(); + } +} diff --git a/test/transform/resource/after-eclipse/SetterAlreadyExists.java b/test/transform/resource/after-eclipse/SetterAlreadyExists.java new file mode 100644 index 00000000..69983ac5 --- /dev/null +++ b/test/transform/resource/after-eclipse/SetterAlreadyExists.java @@ -0,0 +1,72 @@ +class Setter1 { + @lombok.Setter boolean foo; + Setter1() { + super(); + } + void setFoo(boolean foo) { + } +} +class Setter2 { + @lombok.Setter boolean foo; + Setter2() { + super(); + } + void setFoo(String foo) { + } +} +class Setter3 { + @lombok.Setter String foo; + Setter3() { + super(); + } + void setFoo(boolean foo) { + } +} +class Setter4 { + @lombok.Setter String foo; + Setter4() { + super(); + } + void setFoo(String foo) { + } +} +class Setter5 { + @lombok.Setter String foo; + Setter5() { + super(); + } + void setFoo() { + } +} +class Setter6 { + @lombok.Setter String foo; + Setter6() { + super(); + } + void setFoo(String foo, int x) { + } +} +class Setter7 { + @lombok.Setter String foo; + Setter7() { + super(); + } + static void setFoo() { + } +} +class Setter8 { + @lombok.Setter boolean isFoo; + Setter8() { + super(); + } + void setIsFoo() { + } +} +class Setter9 { + @lombok.Setter boolean isFoo; + Setter9() { + super(); + } + void setFoo() { + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/SetterOnClass.java b/test/transform/resource/after-eclipse/SetterOnClass.java new file mode 100644 index 00000000..370c0335 --- /dev/null +++ b/test/transform/resource/after-eclipse/SetterOnClass.java @@ -0,0 +1,69 @@ +@lombok.Setter class SetterOnClass1 { + @lombok.Setter(lombok.AccessLevel.NONE) boolean isNone; + boolean isPublic; + public @java.lang.SuppressWarnings("all") void setPublic(final boolean isPublic) { + this.isPublic = isPublic; + } + SetterOnClass1() { + super(); + } +} +@lombok.Setter(lombok.AccessLevel.PROTECTED) class SetterOnClass2 { + @lombok.Setter(lombok.AccessLevel.NONE) boolean isNone; + boolean isProtected; + @lombok.Setter(lombok.AccessLevel.PACKAGE) boolean isPackage; + @java.lang.SuppressWarnings("all") void setPackage(final boolean isPackage) { + this.isPackage = isPackage; + } + protected @java.lang.SuppressWarnings("all") void setProtected(final boolean isProtected) { + this.isProtected = isProtected; + } + SetterOnClass2() { + super(); + } +} +@lombok.Setter(lombok.AccessLevel.PACKAGE) class SetterOnClass3 { + @lombok.Setter(lombok.AccessLevel.NONE) boolean isNone; + boolean isPackage; + @java.lang.SuppressWarnings("all") void setPackage(final boolean isPackage) { + this.isPackage = isPackage; + } + SetterOnClass3() { + super(); + } +} +@lombok.Setter(lombok.AccessLevel.PRIVATE) class SetterOnClass4 { + @lombok.Setter(lombok.AccessLevel.NONE) boolean isNone; + boolean isPrivate; + private @java.lang.SuppressWarnings("all") void setPrivate(final boolean isPrivate) { + this.isPrivate = isPrivate; + } + SetterOnClass4() { + super(); + } +} +@lombok.Setter(lombok.AccessLevel.PUBLIC) class SetterOnClass5 { + @lombok.Setter(lombok.AccessLevel.NONE) boolean isNone; + boolean isPublic; + public @java.lang.SuppressWarnings("all") void setPublic(final boolean isPublic) { + this.isPublic = isPublic; + } + SetterOnClass5() { + super(); + } +} +@lombok.Setter class SetterOnClass6 { + String couldBeNull; + @lombok.NonNull String nonNull; + public @java.lang.SuppressWarnings("all") void setCouldBeNull(final String couldBeNull) { + this.couldBeNull = couldBeNull; + } + public @java.lang.SuppressWarnings("all") void setNonNull(final @lombok.NonNull String nonNull) { + if ((nonNull == null)) + throw new java.lang.NullPointerException("nonNull"); + this.nonNull = nonNull; + } + SetterOnClass6() { + super(); + } +} diff --git a/test/transform/resource/after-eclipse/SetterOnMethod.java b/test/transform/resource/after-eclipse/SetterOnMethod.java new file mode 100644 index 00000000..8cd9727b --- /dev/null +++ b/test/transform/resource/after-eclipse/SetterOnMethod.java @@ -0,0 +1,40 @@ +import lombok.Setter; +class SetterOnMethod { + @lombok.Setter() int i; + @lombok.Setter() int j; + public @Deprecated @java.lang.SuppressWarnings("all") void setI(final int i) { + this.i = i; + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") void setJ(final int j) { + this.j = j; + } + SetterOnMethod() { + super(); + } +} +@lombok.Setter() class SetterOnClassOnMethod { + int i; + int j; + public @java.lang.SuppressWarnings("all") void setI(final int i) { + this.i = i; + } + public @java.lang.SuppressWarnings("all") void setJ(final int j) { + this.j = j; + } + SetterOnClassOnMethod() { + super(); + } +} +@lombok.Setter() class SetterOnClassAndOnAField { + int i; + @lombok.Setter() int j; + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") void setJ(final int j) { + this.j = j; + } + public @java.lang.SuppressWarnings("all") void setI(final int i) { + this.i = i; + } + SetterOnClassAndOnAField() { + super(); + } +} diff --git a/test/transform/resource/after-eclipse/SetterOnParam.java b/test/transform/resource/after-eclipse/SetterOnParam.java new file mode 100644 index 00000000..3ec7f098 --- /dev/null +++ b/test/transform/resource/after-eclipse/SetterOnParam.java @@ -0,0 +1,40 @@ +import lombok.Setter; +class SetterOnParam { + @lombok.Setter() int i; + @lombok.Setter() int j; + public @java.lang.SuppressWarnings("all") void setI(final @SuppressWarnings("all") int i) { + this.i = i; + } + public @java.lang.SuppressWarnings("all") void setJ(final @java.lang.SuppressWarnings("all") int j) { + this.j = j; + } + SetterOnParam() { + super(); + } +} +@lombok.Setter() class SetterOnClassOnParam { + int i; + int j; + public @java.lang.SuppressWarnings("all") void setI(final int i) { + this.i = i; + } + public @java.lang.SuppressWarnings("all") void setJ(final int j) { + this.j = j; + } + SetterOnClassOnParam() { + super(); + } +} +@lombok.Setter() class SetterOnClassAndOnAFieldParam { + int i; + @lombok.Setter() int j; + public @java.lang.SuppressWarnings("all") void setJ(final @java.lang.SuppressWarnings("all") int j) { + this.j = j; + } + public @java.lang.SuppressWarnings("all") void setI(final int i) { + this.i = i; + } + SetterOnClassAndOnAFieldParam() { + super(); + } +} diff --git a/test/transform/resource/after-eclipse/SetterOnParamAndOnMethod.java b/test/transform/resource/after-eclipse/SetterOnParamAndOnMethod.java new file mode 100644 index 00000000..8d77fc67 --- /dev/null +++ b/test/transform/resource/after-eclipse/SetterOnParamAndOnMethod.java @@ -0,0 +1,9 @@ +class SetterOnParamAndOnMethod { + @lombok.Setter() int i; + public @Deprecated @java.lang.SuppressWarnings("all") void setI(final @SuppressWarnings("all") int i) { + this.i = i; + } + SetterOnParamAndOnMethod() { + super(); + } +} diff --git a/test/transform/resource/after-eclipse/SetterOnStatic.java b/test/transform/resource/after-eclipse/SetterOnStatic.java new file mode 100644 index 00000000..c1e4d3d1 --- /dev/null +++ b/test/transform/resource/after-eclipse/SetterOnStatic.java @@ -0,0 +1,15 @@ +class Setter { + static @lombok.Setter boolean foo; + static @lombok.Setter int bar; + <clinit>() { + } + public static @java.lang.SuppressWarnings("all") void setFoo(final boolean foo) { + Setter.foo = foo; + } + public static @java.lang.SuppressWarnings("all") void setBar(final int bar) { + Setter.bar = bar; + } + Setter() { + super(); + } +} diff --git a/test/transform/resource/after-eclipse/SetterPlain.java b/test/transform/resource/after-eclipse/SetterPlain.java new file mode 100644 index 00000000..08154244 --- /dev/null +++ b/test/transform/resource/after-eclipse/SetterPlain.java @@ -0,0 +1,14 @@ +import lombok.Setter; +class SetterPlain { + @lombok.Setter int i; + @Setter int foo; + public @java.lang.SuppressWarnings("all") void setI(final int i) { + this.i = i; + } + public @java.lang.SuppressWarnings("all") void setFoo(final int foo) { + this.foo = foo; + } + SetterPlain() { + super(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/SetterWithDollar.java b/test/transform/resource/after-eclipse/SetterWithDollar.java new file mode 100644 index 00000000..bf27536b --- /dev/null +++ b/test/transform/resource/after-eclipse/SetterWithDollar.java @@ -0,0 +1,22 @@ +class SetterWithDollar1 { + @lombok.Setter int $i; + public @java.lang.SuppressWarnings("all") void set$i(final int $i) { + this.$i = $i; + } + SetterWithDollar1() { + super(); + } +} +class SetterWithDollar2 { + @lombok.Setter int $i; + @lombok.Setter int i; + public @java.lang.SuppressWarnings("all") void set$i(final int $i) { + this.$i = $i; + } + public @java.lang.SuppressWarnings("all") void setI(final int i) { + this.i = i; + } + SetterWithDollar2() { + super(); + } +} diff --git a/test/transform/resource/after-eclipse/SneakyThrowsMultiple.java b/test/transform/resource/after-eclipse/SneakyThrowsMultiple.java new file mode 100644 index 00000000..82eda411 --- /dev/null +++ b/test/transform/resource/after-eclipse/SneakyThrowsMultiple.java @@ -0,0 +1,63 @@ +import java.awt.AWTException; +import java.io.IOException; +import java.util.Random; +class SneakyThrowsMultiple { + SneakyThrowsMultiple() { + super(); + } + public @lombok.SneakyThrows({IOException.class, Throwable.class}) void test() { + try + { + try + { + System.out.println("test1"); + throw new IOException(); + } + catch (final IOException $ex) { + throw lombok.Lombok.sneakyThrow($ex); + } + } + catch (final Throwable $ex) { + throw lombok.Lombok.sneakyThrow($ex); + } + } + public @lombok.SneakyThrows({AWTException.class, IOException.class}) void test2() { + try + { + try + { + System.out.println("test2"); + if (new Random().nextBoolean()) + { + throw new IOException(); + } + else + { + throw new AWTException("WHAT"); + } + } + catch (final AWTException $ex) { + throw lombok.Lombok.sneakyThrow($ex); + } + } + catch (final IOException $ex) { + throw lombok.Lombok.sneakyThrow($ex); + } + } + public @lombok.SneakyThrows(value = {IOException.class, Throwable.class}) void test3() { + try + { + try + { + System.out.println("test3"); + throw new IOException(); + } + catch (final IOException $ex) { + throw lombok.Lombok.sneakyThrow($ex); + } + } + catch (final Throwable $ex) { + throw lombok.Lombok.sneakyThrow($ex); + } + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/SneakyThrowsPlain.java b/test/transform/resource/after-eclipse/SneakyThrowsPlain.java new file mode 100644 index 00000000..6e75a75c --- /dev/null +++ b/test/transform/resource/after-eclipse/SneakyThrowsPlain.java @@ -0,0 +1,24 @@ +import lombok.SneakyThrows; +class SneakyThrowsPlain { + SneakyThrowsPlain() { + super(); + } + public @lombok.SneakyThrows void test() { + try + { + System.out.println("test1"); + } + catch (final java.lang.Throwable $ex) { + throw lombok.Lombok.sneakyThrow($ex); + } + } + public @SneakyThrows void test2() { + try + { + System.out.println("test2"); + } + catch (final java.lang.Throwable $ex) { + throw lombok.Lombok.sneakyThrow($ex); + } + } +} diff --git a/test/transform/resource/after-eclipse/SneakyThrowsSingle.java b/test/transform/resource/after-eclipse/SneakyThrowsSingle.java new file mode 100644 index 00000000..eea593f2 --- /dev/null +++ b/test/transform/resource/after-eclipse/SneakyThrowsSingle.java @@ -0,0 +1,35 @@ +import java.io.IOException; +class SneakyThrowsSingle { + SneakyThrowsSingle() { + super(); + } + public @lombok.SneakyThrows(Throwable.class) void test() { + try + { + System.out.println("test1"); + } + catch (final Throwable $ex) { + throw lombok.Lombok.sneakyThrow($ex); + } + } + public @lombok.SneakyThrows(IOException.class) void test2() { + try + { + System.out.println("test2"); + throw new IOException(); + } + catch (final IOException $ex) { + throw lombok.Lombok.sneakyThrow($ex); + } + } + public @lombok.SneakyThrows(value = IOException.class) void test3() { + try + { + System.out.println("test3"); + throw new IOException(); + } + catch (final IOException $ex) { + throw lombok.Lombok.sneakyThrow($ex); + } + } +} diff --git a/test/transform/resource/after-eclipse/SynchronizedName.java b/test/transform/resource/after-eclipse/SynchronizedName.java new file mode 100644 index 00000000..a7edd3e7 --- /dev/null +++ b/test/transform/resource/after-eclipse/SynchronizedName.java @@ -0,0 +1,36 @@ +class SynchronizedName { + private Object read = new Object(); + private static Object READ = new Object(); + <clinit>() { + } + SynchronizedName() { + super(); + } + @lombok.Synchronized("read") void test1() { + synchronized (this.read) + { + System.out.println("one"); + } + } + @lombok.Synchronized("write") void test2() { + System.out.println("two"); + } + static @lombok.Synchronized("read") void test3() { + synchronized (SynchronizedName.read) + { + System.out.println("three"); + } + } + @lombok.Synchronized("READ") void test4() { + synchronized (this.READ) + { + System.out.println("four"); + } + } + @lombok.Synchronized(value = "read") void test5() { + synchronized (this.read) + { + System.out.println("five"); + } + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/SynchronizedPlain.java b/test/transform/resource/after-eclipse/SynchronizedPlain.java new file mode 100644 index 00000000..8e5b6297 --- /dev/null +++ b/test/transform/resource/after-eclipse/SynchronizedPlain.java @@ -0,0 +1,39 @@ +import lombok.Synchronized; +class SynchronizedPlain1 { + private final @java.lang.SuppressWarnings("all") java.lang.Object $lock = new java.lang.Object[0]; + SynchronizedPlain1() { + super(); + } + @lombok.Synchronized void test() { + synchronized (this.$lock) + { + System.out.println("one"); + } + } + @Synchronized void test2() { + synchronized (this.$lock) + { + System.out.println("two"); + } + } +} +class SynchronizedPlain2 { + private static final @java.lang.SuppressWarnings("all") java.lang.Object $LOCK = new java.lang.Object[0]; + <clinit>() { + } + SynchronizedPlain2() { + super(); + } + static @lombok.Synchronized void test() { + synchronized (SynchronizedPlain2.$LOCK) + { + System.out.println("three"); + } + } + static @Synchronized void test2() { + synchronized (SynchronizedPlain2.$LOCK) + { + System.out.println("four"); + } + } +} diff --git a/test/transform/resource/after-eclipse/ToStringInner.java b/test/transform/resource/after-eclipse/ToStringInner.java new file mode 100644 index 00000000..963299db --- /dev/null +++ b/test/transform/resource/after-eclipse/ToStringInner.java @@ -0,0 +1,43 @@ +import lombok.ToString; +@ToString class ToStringOuter { + @ToString class ToStringInner { + final int y; + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("ToStringOuter.ToStringInner(y=" + this.y) + ")"); + } + ToStringInner() { + super(); + } + } + static @ToString class ToStringStaticInner { + final int y; + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("ToStringOuter.ToStringStaticInner(y=" + this.y) + ")"); + } + ToStringStaticInner() { + super(); + } + } + class ToStringMiddle { + @ToString class ToStringMoreInner { + final String name; + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("ToStringOuter.ToStringMiddle.ToStringMoreInner(name=" + this.name) + ")"); + } + ToStringMoreInner() { + super(); + } + } + ToStringMiddle() { + super(); + } + } + final int x; + String name; + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("ToStringOuter(x=" + this.x) + ", name=") + this.name) + ")"); + } + ToStringOuter() { + super(); + } +} diff --git a/test/transform/resource/after-eclipse/ToStringPlain.java b/test/transform/resource/after-eclipse/ToStringPlain.java new file mode 100644 index 00000000..458f78d0 --- /dev/null +++ b/test/transform/resource/after-eclipse/ToStringPlain.java @@ -0,0 +1,21 @@ +import lombok.ToString; +@lombok.ToString class ToString1 { + final int x; + String name; + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("ToString1(x=" + this.x) + ", name=") + this.name) + ")"); + } + ToString1() { + super(); + } +} +@ToString class ToString2 { + final int x; + String name; + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("ToString2(x=" + this.x) + ", name=") + this.name) + ")"); + } + ToString2() { + super(); + } +} diff --git a/test/transform/resource/after-eclipse/ValComplex.java b/test/transform/resource/after-eclipse/ValComplex.java new file mode 100644 index 00000000..cb06d3c1 --- /dev/null +++ b/test/transform/resource/after-eclipse/ValComplex.java @@ -0,0 +1 @@ +//ignore
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/ValErrors.java b/test/transform/resource/after-eclipse/ValErrors.java new file mode 100644 index 00000000..cb06d3c1 --- /dev/null +++ b/test/transform/resource/after-eclipse/ValErrors.java @@ -0,0 +1 @@ +//ignore
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/ValInFor.java b/test/transform/resource/after-eclipse/ValInFor.java new file mode 100644 index 00000000..cb06d3c1 --- /dev/null +++ b/test/transform/resource/after-eclipse/ValInFor.java @@ -0,0 +1 @@ +//ignore
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/ValLessSimple.java b/test/transform/resource/after-eclipse/ValLessSimple.java new file mode 100644 index 00000000..cb06d3c1 --- /dev/null +++ b/test/transform/resource/after-eclipse/ValLessSimple.java @@ -0,0 +1 @@ +//ignore
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/ValSimple.java b/test/transform/resource/after-eclipse/ValSimple.java new file mode 100644 index 00000000..cb06d3c1 --- /dev/null +++ b/test/transform/resource/after-eclipse/ValSimple.java @@ -0,0 +1 @@ +//ignore
\ No newline at end of file diff --git a/test/transform/resource/after-eclipse/ValWeirdTypes.java b/test/transform/resource/after-eclipse/ValWeirdTypes.java new file mode 100644 index 00000000..cb06d3c1 --- /dev/null +++ b/test/transform/resource/after-eclipse/ValWeirdTypes.java @@ -0,0 +1 @@ +//ignore
\ No newline at end of file diff --git a/test/transform/resource/messages-eclipse/GetterAlreadyExists.java.messages b/test/transform/resource/messages-eclipse/GetterAlreadyExists.java.messages new file mode 100644 index 00000000..86415168 --- /dev/null +++ b/test/transform/resource/messages-eclipse/GetterAlreadyExists.java.messages @@ -0,0 +1,8 @@ +8 warning Not generating isFoo(): A method with that name already exists +14 warning Not generating isFoo(): A method with that name already exists (getFoo) +32 warning Not generating getFoo(): A method with that name already exists +50 warning Not generating getFoo(): A method with that name already exists +62 warning Not generating isFoo(): A method with that name already exists +68 warning Not generating isFoo(): A method with that name already exists (getFoo) +86 warning Not generating getFoo(): A method with that name already exists +104 warning Not generating getFoo(): A method with that name already exists
\ No newline at end of file diff --git a/test/transform/resource/messages-eclipse/GetterBoolean.java.messages b/test/transform/resource/messages-eclipse/GetterBoolean.java.messages new file mode 100644 index 00000000..51d9dd6e --- /dev/null +++ b/test/transform/resource/messages-eclipse/GetterBoolean.java.messages @@ -0,0 +1 @@ +13 warning Not generating isFoo(): A method with that name already exists (getFoo) diff --git a/test/transform/resource/messages-eclipse/GetterLazyInvalid.java.messages b/test/transform/resource/messages-eclipse/GetterLazyInvalid.java.messages new file mode 100644 index 00000000..25641930 --- /dev/null +++ b/test/transform/resource/messages-eclipse/GetterLazyInvalid.java.messages @@ -0,0 +1,6 @@ +2 error 'lazy' requires the field to be private and final. +6 error 'lazy' requires the field to be private and final. +10 error 'lazy' requires the field to be private and final. +14 warning 'lazy' does not work with AccessLevel.NONE. +17 error 'lazy' is not supported for @Getter on a type. +22 error 'lazy' requires field initialization. diff --git a/test/transform/resource/messages-eclipse/GetterOnMethod.java.messages b/test/transform/resource/messages-eclipse/GetterOnMethod.java.messages new file mode 100644 index 00000000..24e00370 --- /dev/null +++ b/test/transform/resource/messages-eclipse/GetterOnMethod.java.messages @@ -0,0 +1,2 @@ +6 error 'onMethod' is not supported for @Getter on a type. +11 error 'onMethod' is not supported for @Getter on a type.
\ No newline at end of file diff --git a/test/transform/resource/messages-eclipse/LoggerSlf4jAlreadyExists.java.messages b/test/transform/resource/messages-eclipse/LoggerSlf4jAlreadyExists.java.messages new file mode 100644 index 00000000..f03c7660 --- /dev/null +++ b/test/transform/resource/messages-eclipse/LoggerSlf4jAlreadyExists.java.messages @@ -0,0 +1 @@ +1 warning Field 'log' already exists. diff --git a/test/transform/resource/messages-eclipse/LoggerSlf4jOnNonStaticInnerClass.java.messages b/test/transform/resource/messages-eclipse/LoggerSlf4jOnNonStaticInnerClass.java.messages new file mode 100644 index 00000000..e0bbdb2a --- /dev/null +++ b/test/transform/resource/messages-eclipse/LoggerSlf4jOnNonStaticInnerClass.java.messages @@ -0,0 +1 @@ +2:9 ERROR @Log is not legal on non-static inner classes.
\ No newline at end of file diff --git a/test/transform/resource/messages-eclipse/LoggerSlf4jOnNonType.java.messages b/test/transform/resource/messages-eclipse/LoggerSlf4jOnNonType.java.messages new file mode 100644 index 00000000..4a446f28 --- /dev/null +++ b/test/transform/resource/messages-eclipse/LoggerSlf4jOnNonType.java.messages @@ -0,0 +1 @@ +2 error @Log is legal only on types.
\ No newline at end of file diff --git a/test/transform/resource/messages-eclipse/LoggerSlf4jTypes.java.messages b/test/transform/resource/messages-eclipse/LoggerSlf4jTypes.java.messages new file mode 100644 index 00000000..42236c7c --- /dev/null +++ b/test/transform/resource/messages-eclipse/LoggerSlf4jTypes.java.messages @@ -0,0 +1,2 @@ +1 error @Log is legal only on classes and enums. +4 error @Log is legal only on classes and enums.
\ No newline at end of file diff --git a/test/transform/resource/messages-eclipse/SetterAlreadyExists.java.messages b/test/transform/resource/messages-eclipse/SetterAlreadyExists.java.messages new file mode 100644 index 00000000..e82f4e6d --- /dev/null +++ b/test/transform/resource/messages-eclipse/SetterAlreadyExists.java.messages @@ -0,0 +1,9 @@ +2 warning Not generating setFoo(): A method with that name already exists +7 warning Not generating setFoo(): A method with that name already exists +12 warning Not generating setFoo(): A method with that name already exists +17 warning Not generating setFoo(): A method with that name already exists +22 warning Not generating setFoo(): A method with that name already exists +27 warning Not generating setFoo(): A method with that name already exists +32 warning Not generating setFoo(): A method with that name already exists +37 warning Not generating setFoo(): A method with that name already exists (setIsFoo) +42 warning Not generating setFoo(): A method with that name already exists diff --git a/test/transform/resource/messages-eclipse/SetterOnMethod.java.messages b/test/transform/resource/messages-eclipse/SetterOnMethod.java.messages new file mode 100644 index 00000000..608489ce --- /dev/null +++ b/test/transform/resource/messages-eclipse/SetterOnMethod.java.messages @@ -0,0 +1,2 @@ +6 error 'onMethod' is not supported for @Setter on a type. +11 error 'onMethod' is not supported for @Setter on a type.
\ No newline at end of file diff --git a/test/transform/resource/messages-eclipse/SetterOnParam.java.messages b/test/transform/resource/messages-eclipse/SetterOnParam.java.messages new file mode 100644 index 00000000..d067b156 --- /dev/null +++ b/test/transform/resource/messages-eclipse/SetterOnParam.java.messages @@ -0,0 +1,2 @@ +6 error 'onParam' is not supported for @Setter on a type. +11 error 'onParam' is not supported for @Setter on a type.
\ No newline at end of file diff --git a/test/transform/resource/messages-eclipse/SynchronizedName.java.messages b/test/transform/resource/messages-eclipse/SynchronizedName.java.messages new file mode 100644 index 00000000..2c94551c --- /dev/null +++ b/test/transform/resource/messages-eclipse/SynchronizedName.java.messages @@ -0,0 +1 @@ +8 error The field write does not exist. diff --git a/test/transform/src/lombok/transform/TestWithEclipse.java b/test/transform/src/lombok/transform/TestWithEclipse.java new file mode 100644 index 00000000..dff73425 --- /dev/null +++ b/test/transform/src/lombok/transform/TestWithEclipse.java @@ -0,0 +1,59 @@ +/* + * Copyright © 2011 Reinier Zwitserloot and Roel Spilker. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package lombok.transform; + +import java.io.File; + +import lombok.DirectoryRunner; + +import org.junit.runner.RunWith; + +// For now you need to add the following vm-parameter to run the test: +// -javaagent:${project_loc:lombok}/dist/lombok.jar + +@RunWith(DirectoryRunner.class) +public class TestWithEclipse implements DirectoryRunner.TestParams { + @Override + public DirectoryRunner.Compiler getCompiler() { + return DirectoryRunner.Compiler.ECLIPSE; + } + + @Override + public boolean printErrors() { + return true; + } + + @Override + public File getBeforeDirectory() { + return new File("test/transform/resource/before"); + } + + @Override + public File getAfterDirectory() { + return new File("test/transform/resource/after-eclipse"); + } + + @Override + public File getMessagesDirectory() { + return new File("test/transform/resource/messages-eclipse"); + } +} |