diff options
Diffstat (limited to 'test/transform')
44 files changed, 1162 insertions, 28 deletions
diff --git a/test/transform/resource/after-delombok/GetterWithDollar.java b/test/transform/resource/after-delombok/GetterWithDollar.java index 9e02ccb8..520f4ea5 100644 --- a/test/transform/resource/after-delombok/GetterWithDollar.java +++ b/test/transform/resource/after-delombok/GetterWithDollar.java @@ -1,7 +1,7 @@ class GetterWithDollar1 { int $i; @java.lang.SuppressWarnings("all") - public int getI() { + public int get$i() { return this.$i; } } @@ -9,6 +9,10 @@ class GetterWithDollar2 { int $i; int i; @java.lang.SuppressWarnings("all") + public int get$i() { + return this.$i; + } + @java.lang.SuppressWarnings("all") public int getI() { return this.i; } diff --git a/test/transform/resource/after-delombok/NonNullPlain.java b/test/transform/resource/after-delombok/NonNullPlain.java index 19869db1..0c58425c 100644 --- a/test/transform/resource/after-delombok/NonNullPlain.java +++ b/test/transform/resource/after-delombok/NonNullPlain.java @@ -3,15 +3,15 @@ class NonNullPlain { int i; @lombok.NonNull String s; + @java.lang.SuppressWarnings("all") + public void setI(@lombok.NonNull final int i) { + this.i = i; + } @lombok.NonNull @java.lang.SuppressWarnings("all") public int getI() { return this.i; } - @java.lang.SuppressWarnings("all") - public void setI(@lombok.NonNull final int i) { - this.i = i; - } @lombok.NonNull @java.lang.SuppressWarnings("all") public String getS() { diff --git a/test/transform/resource/after-delombok/SetterWithDollar.java b/test/transform/resource/after-delombok/SetterWithDollar.java index c26a1ccd..974efdcd 100644 --- a/test/transform/resource/after-delombok/SetterWithDollar.java +++ b/test/transform/resource/after-delombok/SetterWithDollar.java @@ -1,14 +1,20 @@ class SetterWithDollar1 { int $i; - public void setI(final int i) { - this.$i = i; + @java.lang.SuppressWarnings("all") + public void set$i(final int $i) { + this.$i = $i; } } class SetterWithDollar2 { int $i; int i; + @java.lang.SuppressWarnings("all") + public void set$i(final int $i) { + this.$i = $i; + } + @java.lang.SuppressWarnings("all") public void setI(final int i) { this.i = i; } diff --git a/test/transform/resource/after-delombok/SneakyThrowsMultiple.java b/test/transform/resource/after-delombok/SneakyThrowsMultiple.java index bab13990..42b275c6 100644 --- a/test/transform/resource/after-delombok/SneakyThrowsMultiple.java +++ b/test/transform/resource/after-delombok/SneakyThrowsMultiple.java @@ -7,10 +7,10 @@ class SneakyThrowsMultiple { try { System.out.println("test1"); throw new IOException(); - } catch (IOException $ex) { + } catch (final IOException $ex) { throw lombok.Lombok.sneakyThrow($ex); } - } catch (Throwable $ex) { + } catch (final Throwable $ex) { throw lombok.Lombok.sneakyThrow($ex); } } @@ -23,10 +23,10 @@ class SneakyThrowsMultiple { } else { throw new AWTException("WHAT"); } - } catch (AWTException $ex) { + } catch (final AWTException $ex) { throw lombok.Lombok.sneakyThrow($ex); } - } catch (IOException $ex) { + } catch (final IOException $ex) { throw lombok.Lombok.sneakyThrow($ex); } } @@ -35,10 +35,10 @@ class SneakyThrowsMultiple { try { System.out.println("test3"); throw new IOException(); - } catch (IOException $ex) { + } catch (final IOException $ex) { throw lombok.Lombok.sneakyThrow($ex); } - } catch (Throwable $ex) { + } catch (final Throwable $ex) { throw lombok.Lombok.sneakyThrow($ex); } } diff --git a/test/transform/resource/after-delombok/SneakyThrowsPlain.java b/test/transform/resource/after-delombok/SneakyThrowsPlain.java index d5abc478..28c39b40 100644 --- a/test/transform/resource/after-delombok/SneakyThrowsPlain.java +++ b/test/transform/resource/after-delombok/SneakyThrowsPlain.java @@ -2,7 +2,7 @@ class SneakyThrowsPlain { public void test() { try { System.out.println("test1"); - } catch (java.lang.Throwable $ex) { + } catch (final java.lang.Throwable $ex) { throw lombok.Lombok.sneakyThrow($ex); } } @@ -10,7 +10,7 @@ class SneakyThrowsPlain { public void test2() { try { System.out.println("test2"); - } catch (java.lang.Throwable $ex) { + } catch (final java.lang.Throwable $ex) { throw lombok.Lombok.sneakyThrow($ex); } } diff --git a/test/transform/resource/after-delombok/SneakyThrowsSingle.java b/test/transform/resource/after-delombok/SneakyThrowsSingle.java index 519d06a9..8901f827 100644 --- a/test/transform/resource/after-delombok/SneakyThrowsSingle.java +++ b/test/transform/resource/after-delombok/SneakyThrowsSingle.java @@ -3,7 +3,7 @@ class SneakyThrowsSingle { public void test() { try { System.out.println("test1"); - } catch (Throwable $ex) { + } catch (final Throwable $ex) { throw lombok.Lombok.sneakyThrow($ex); } } @@ -11,7 +11,7 @@ class SneakyThrowsSingle { try { System.out.println("test2"); throw new IOException(); - } catch (IOException $ex) { + } catch (final IOException $ex) { throw lombok.Lombok.sneakyThrow($ex); } } @@ -19,7 +19,7 @@ class SneakyThrowsSingle { try { System.out.println("test3"); throw new IOException(); - } catch (IOException $ex) { + } catch (final IOException $ex) { throw lombok.Lombok.sneakyThrow($ex); } } diff --git a/test/transform/resource/after-delombok/SynchronizedName.java b/test/transform/resource/after-delombok/SynchronizedName.java index 066e3bdf..e7dd23ff 100644 --- a/test/transform/resource/after-delombok/SynchronizedName.java +++ b/test/transform/resource/after-delombok/SynchronizedName.java @@ -2,7 +2,7 @@ class SynchronizedName { private Object read = new Object(); private static Object READ = new Object(); void test1() { - synchronized (read) { + synchronized (this.read) { System.out.println("one"); } } @@ -10,15 +10,17 @@ class SynchronizedName { System.out.println("two"); } static void test3() { - System.out.println("three"); + synchronized (SynchronizedName.read) { + System.out.println("three"); + } } void test4() { - synchronized (READ) { + synchronized (this.READ) { System.out.println("four"); } } void test5() { - synchronized (read) { + synchronized (this.read) { System.out.println("five"); } } diff --git a/test/transform/resource/after-ecj/ClassNamedAfterGetter.java b/test/transform/resource/after-ecj/ClassNamedAfterGetter.java new file mode 100644 index 00000000..fdb6f122 --- /dev/null +++ b/test/transform/resource/after-ecj/ClassNamedAfterGetter.java @@ -0,0 +1,9 @@ +class GetFoo { + private @lombok.Getter int foo; + GetFoo() { + super(); + } + public @java.lang.SuppressWarnings("all") int getFoo() { + return this.foo; + } +} diff --git a/test/transform/resource/after-ecj/CleanupName.java b/test/transform/resource/after-ecj/CleanupName.java new file mode 100644 index 00000000..944a81e1 --- /dev/null +++ b/test/transform/resource/after-ecj/CleanupName.java @@ -0,0 +1,27 @@ +class CleanupName { + CleanupName() { + super(); + } + void test() { + @lombok.Cleanup("toString") Object o = "Hello World!"; + try + { + System.out.println(o); + } + finally + { + o.toString(); + } + } + void test2() { + @lombok.Cleanup(value = "toString") Object o = "Hello World too!"; + try + { + System.out.println(o); + } + finally + { + o.toString(); + } + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/CleanupPlain.java b/test/transform/resource/after-ecj/CleanupPlain.java new file mode 100644 index 00000000..6754b4f6 --- /dev/null +++ b/test/transform/resource/after-ecj/CleanupPlain.java @@ -0,0 +1,29 @@ +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 + { + out.close(); + } + } + finally + { + in.close(); + } + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/CommentsInterspersed.java b/test/transform/resource/after-ecj/CommentsInterspersed.java new file mode 100644 index 00000000..d708ad72 --- /dev/null +++ b/test/transform/resource/after-ecj/CommentsInterspersed.java @@ -0,0 +1,12 @@ +import lombok.Getter; +public class CommentsInterspersed { + private int x; + private @Getter String test = "foo"; + public CommentsInterspersed() { + super(); + } + public native void gwtTest(); + public @java.lang.SuppressWarnings("all") String getTest() { + return this.test; + } +} diff --git a/test/transform/resource/after-ecj/DataExtended.java b/test/transform/resource/after-ecj/DataExtended.java new file mode 100644 index 00000000..b7be8bcf --- /dev/null +++ b/test/transform/resource/after-ecj/DataExtended.java @@ -0,0 +1,33 @@ +@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 == null)) + return false; + if ((o.getClass() != this.getClass())) + return false; + final DataExtended other = (DataExtended) 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) + 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-ecj/DataIgnore.java b/test/transform/resource/after-ecj/DataIgnore.java new file mode 100644 index 00000000..df2254c8 --- /dev/null +++ b/test/transform/resource/after-ecj/DataIgnore.java @@ -0,0 +1,32 @@ +@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 == null)) + return false; + if ((o.getClass() != this.getClass())) + return false; + final DataIgnore other = (DataIgnore) 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) + 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-ecj/DataPlain.java b/test/transform/resource/after-ecj/DataPlain.java new file mode 100644 index 00000000..b6e385f3 --- /dev/null +++ b/test/transform/resource/after-ecj/DataPlain.java @@ -0,0 +1,83 @@ +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 == null)) + return false; + if ((o.getClass() != this.getClass())) + return false; + final Data1 other = (Data1) 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 (((("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 == null)) + return false; + if ((o.getClass() != this.getClass())) + return false; + final Data2 other = (Data2) 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 (((("Data2(x=" + this.getX()) + ", name=") + this.getName()) + ")"); + } +} diff --git a/test/transform/resource/after-ecj/GetterAccessLevel.java b/test/transform/resource/after-ecj/GetterAccessLevel.java new file mode 100644 index 00000000..14edfb56 --- /dev/null +++ b/test/transform/resource/after-ecj/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; + GetterAccessLevel() { + super(); + } + 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; + } +} diff --git a/test/transform/resource/after-ecj/GetterAlreadyExists.java b/test/transform/resource/after-ecj/GetterAlreadyExists.java new file mode 100644 index 00000000..959b6a64 --- /dev/null +++ b/test/transform/resource/after-ecj/GetterAlreadyExists.java @@ -0,0 +1,186 @@ +class Getter1 { + @lombok.Getter boolean 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; + Getter4() { + super(); + } + String hasFoo() { + return null; + } + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } +} +class Getter5 { + @lombok.Getter String foo; + Getter5() { + super(); + } + String isFoo() { + return null; + } + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } +} +class Getter6 { + @lombok.Getter String foo; + Getter6() { + super(); + } + String getFoo() { + return null; + } +} +class Getter7 { + @lombok.Getter String foo; + Getter7() { + super(); + } + boolean hasFoo() { + return false; + } + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } +} +class Getter8 { + @lombok.Getter String foo; + Getter8() { + super(); + } + boolean isFoo() { + return false; + } + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } +} +class Getter9 { + @lombok.Getter String foo; + Getter9() { + super(); + } + boolean getFoo() { + return false; + } +} +class Getter10 { + @lombok.Getter boolean 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; + Getter13() { + super(); + } + static boolean hasFoo() { + return false; + } + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } +} +class Getter14 { + @lombok.Getter String foo; + Getter14() { + super(); + } + static boolean isFoo() { + return false; + } + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } +} +class Getter15 { + @lombok.Getter String foo; + Getter15() { + super(); + } + static boolean getFoo() { + return false; + } +} +class Getter16 { + @lombok.Getter String foo; + Getter16() { + super(); + } + static String hasFoo() { + return false; + } + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } +} +class Getter17 { + @lombok.Getter String foo; + Getter17() { + super(); + } + static String isFoo() { + return false; + } + public @java.lang.SuppressWarnings("all") String getFoo() { + return this.foo; + } +} +class Getter18 { + @lombok.Getter String foo; + Getter18() { + super(); + } + static String getFoo() { + return false; + } +} diff --git a/test/transform/resource/after-ecj/GetterBoolean.java b/test/transform/resource/after-ecj/GetterBoolean.java new file mode 100644 index 00000000..caf758c1 --- /dev/null +++ b/test/transform/resource/after-ecj/GetterBoolean.java @@ -0,0 +1,26 @@ +class Getter { + @lombok.Getter boolean foo; + @lombok.Getter boolean isBar; + @lombok.Getter boolean hasBaz; + Getter() { + super(); + } + 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 hasBaz() { + return this.hasBaz; + } +} +class MoreGetter { + @lombok.Getter boolean foo; + MoreGetter() { + super(); + } + boolean hasFoo() { + return true; + } +} diff --git a/test/transform/resource/after-ecj/GetterOnClass.java b/test/transform/resource/after-ecj/GetterOnClass.java new file mode 100644 index 00000000..7668c9d3 --- /dev/null +++ b/test/transform/resource/after-ecj/GetterOnClass.java @@ -0,0 +1,67 @@ +@lombok.Getter class GetterOnClass1 { + @lombok.Getter(lombok.AccessLevel.NONE) boolean isNone; + boolean isPublic; + GetterOnClass1() { + super(); + } + public @java.lang.SuppressWarnings("all") boolean isPublic() { + return this.isPublic; + } +} +@lombok.Getter(lombok.AccessLevel.PROTECTED) class GetterOnClass2 { + @lombok.Getter(lombok.AccessLevel.NONE) boolean isNone; + boolean isProtected; + @lombok.Getter(lombok.AccessLevel.PACKAGE) boolean isPackage; + GetterOnClass2() { + super(); + } + @java.lang.SuppressWarnings("all") boolean isPackage() { + return this.isPackage; + } + protected @java.lang.SuppressWarnings("all") boolean isProtected() { + return this.isProtected; + } +} +@lombok.Getter(lombok.AccessLevel.PACKAGE) class GetterOnClass3 { + @lombok.Getter(lombok.AccessLevel.NONE) boolean isNone; + boolean isPackage; + GetterOnClass3() { + super(); + } + @java.lang.SuppressWarnings("all") boolean isPackage() { + return this.isPackage; + } +} +@lombok.Getter(lombok.AccessLevel.PRIVATE) class GetterOnClass4 { + @lombok.Getter(lombok.AccessLevel.NONE) boolean isNone; + boolean isPrivate; + GetterOnClass4() { + super(); + } + private @java.lang.SuppressWarnings("all") boolean isPrivate() { + return this.isPrivate; + } +} +@lombok.Getter(lombok.AccessLevel.PUBLIC) class GetterOnClass5 { + @lombok.Getter(lombok.AccessLevel.NONE) boolean isNone; + boolean isPublic; + GetterOnClass5() { + super(); + } + public @java.lang.SuppressWarnings("all") boolean isPublic() { + return this.isPublic; + } +} +@lombok.Getter class GetterOnClass6 { + String couldBeNull; + @lombok.NonNull String nonNull; + GetterOnClass6() { + super(); + } + public @java.lang.SuppressWarnings("all") String getCouldBeNull() { + return this.couldBeNull; + } + public @lombok.NonNull @java.lang.SuppressWarnings("all") String getNonNull() { + return this.nonNull; + } +} diff --git a/test/transform/resource/after-ecj/GetterPlain.java b/test/transform/resource/after-ecj/GetterPlain.java new file mode 100644 index 00000000..19e24c77 --- /dev/null +++ b/test/transform/resource/after-ecj/GetterPlain.java @@ -0,0 +1,14 @@ +import lombok.Getter; +class GetterPlain { + @lombok.Getter int i; + @Getter int foo; + GetterPlain() { + super(); + } + public @java.lang.SuppressWarnings("all") int getI() { + return this.i; + } + public @java.lang.SuppressWarnings("all") int getFoo() { + return this.foo; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/GetterWithDollar.java b/test/transform/resource/after-ecj/GetterWithDollar.java new file mode 100644 index 00000000..f4bc799c --- /dev/null +++ b/test/transform/resource/after-ecj/GetterWithDollar.java @@ -0,0 +1,22 @@ +class GetterWithDollar1 { + @lombok.Getter int $i; + GetterWithDollar1() { + super(); + } + public @java.lang.SuppressWarnings("all") int get$i() { + return this.$i; + } +} +class GetterWithDollar2 { + @lombok.Getter int $i; + @lombok.Getter int i; + GetterWithDollar2() { + super(); + } + public @java.lang.SuppressWarnings("all") int get$i() { + return this.$i; + } + public @java.lang.SuppressWarnings("all") int getI() { + return this.i; + } +} diff --git a/test/transform/resource/after-ecj/NonNullPlain.java b/test/transform/resource/after-ecj/NonNullPlain.java new file mode 100644 index 00000000..877f97ae --- /dev/null +++ b/test/transform/resource/after-ecj/NonNullPlain.java @@ -0,0 +1,21 @@ +class NonNullPlain { + @lombok.Setter @lombok.NonNull @lombok.Getter int i; + @lombok.Getter @lombok.Setter @lombok.NonNull String s; + NonNullPlain() { + super(); + } + 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; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/SetterAccessLevel.java b/test/transform/resource/after-ecj/SetterAccessLevel.java new file mode 100644 index 00000000..20eb9d2c --- /dev/null +++ b/test/transform/resource/after-ecj/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; + SetterAccessLevel() { + super(); + } + private @java.lang.SuppressWarnings("all") void setIsPrivate(final boolean isPrivate) { + this.isPrivate = isPrivate; + } + @java.lang.SuppressWarnings("all") void setIsPackage(final boolean isPackage) { + this.isPackage = isPackage; + } + protected @java.lang.SuppressWarnings("all") void setIsProtected(final boolean isProtected) { + this.isProtected = isProtected; + } + public @java.lang.SuppressWarnings("all") void setIsPublic(final boolean isPublic) { + this.isPublic = isPublic; + } + public @java.lang.SuppressWarnings("all") void setValue(final boolean value) { + this.value = value; + } +} diff --git a/test/transform/resource/after-ecj/SetterAlreadyExists.java b/test/transform/resource/after-ecj/SetterAlreadyExists.java new file mode 100644 index 00000000..a1de2156 --- /dev/null +++ b/test/transform/resource/after-ecj/SetterAlreadyExists.java @@ -0,0 +1,56 @@ +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() { + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/SetterOnClass.java b/test/transform/resource/after-ecj/SetterOnClass.java new file mode 100644 index 00000000..e92e217c --- /dev/null +++ b/test/transform/resource/after-ecj/SetterOnClass.java @@ -0,0 +1,69 @@ +@lombok.Setter class SetterOnClass1 { + @lombok.Setter(lombok.AccessLevel.NONE) boolean isNone; + boolean isPublic; + SetterOnClass1() { + super(); + } + public @java.lang.SuppressWarnings("all") void setIsPublic(final boolean isPublic) { + this.isPublic = isPublic; + } +} +@lombok.Setter(lombok.AccessLevel.PROTECTED) class SetterOnClass2 { + @lombok.Setter(lombok.AccessLevel.NONE) boolean isNone; + boolean isProtected; + @lombok.Setter(lombok.AccessLevel.PACKAGE) boolean isPackage; + SetterOnClass2() { + super(); + } + @java.lang.SuppressWarnings("all") void setIsPackage(final boolean isPackage) { + this.isPackage = isPackage; + } + protected @java.lang.SuppressWarnings("all") void setIsProtected(final boolean isProtected) { + this.isProtected = isProtected; + } +} +@lombok.Setter(lombok.AccessLevel.PACKAGE) class SetterOnClass3 { + @lombok.Setter(lombok.AccessLevel.NONE) boolean isNone; + boolean isPackage; + SetterOnClass3() { + super(); + } + @java.lang.SuppressWarnings("all") void setIsPackage(final boolean isPackage) { + this.isPackage = isPackage; + } +} +@lombok.Setter(lombok.AccessLevel.PRIVATE) class SetterOnClass4 { + @lombok.Setter(lombok.AccessLevel.NONE) boolean isNone; + boolean isPrivate; + SetterOnClass4() { + super(); + } + private @java.lang.SuppressWarnings("all") void setIsPrivate(final boolean isPrivate) { + this.isPrivate = isPrivate; + } +} +@lombok.Setter(lombok.AccessLevel.PUBLIC) class SetterOnClass5 { + @lombok.Setter(lombok.AccessLevel.NONE) boolean isNone; + boolean isPublic; + SetterOnClass5() { + super(); + } + public @java.lang.SuppressWarnings("all") void setIsPublic(final boolean isPublic) { + this.isPublic = isPublic; + } +} +@lombok.Setter class SetterOnClass6 { + String couldBeNull; + @lombok.NonNull String nonNull; + SetterOnClass6() { + super(); + } + 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; + } +} diff --git a/test/transform/resource/after-ecj/SetterPlain.java b/test/transform/resource/after-ecj/SetterPlain.java new file mode 100644 index 00000000..7f0a4a81 --- /dev/null +++ b/test/transform/resource/after-ecj/SetterPlain.java @@ -0,0 +1,14 @@ +import lombok.Setter; +class SetterPlain { + @lombok.Setter int i; + @Setter int foo; + SetterPlain() { + super(); + } + 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; + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/SetterWithDollar.java b/test/transform/resource/after-ecj/SetterWithDollar.java new file mode 100644 index 00000000..c5bc14f1 --- /dev/null +++ b/test/transform/resource/after-ecj/SetterWithDollar.java @@ -0,0 +1,22 @@ +class SetterWithDollar1 { + @lombok.Setter int $i; + SetterWithDollar1() { + super(); + } + public @java.lang.SuppressWarnings("all") void set$i(final int $i) { + this.$i = $i; + } +} +class SetterWithDollar2 { + @lombok.Setter int $i; + @lombok.Setter int i; + SetterWithDollar2() { + super(); + } + 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; + } +} diff --git a/test/transform/resource/after-ecj/SneakyThrowsMultiple.java b/test/transform/resource/after-ecj/SneakyThrowsMultiple.java new file mode 100644 index 00000000..82eda411 --- /dev/null +++ b/test/transform/resource/after-ecj/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-ecj/SneakyThrowsPlain.java b/test/transform/resource/after-ecj/SneakyThrowsPlain.java new file mode 100644 index 00000000..6e75a75c --- /dev/null +++ b/test/transform/resource/after-ecj/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-ecj/SneakyThrowsSingle.java b/test/transform/resource/after-ecj/SneakyThrowsSingle.java new file mode 100644 index 00000000..eea593f2 --- /dev/null +++ b/test/transform/resource/after-ecj/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-ecj/SynchronizedName.java b/test/transform/resource/after-ecj/SynchronizedName.java new file mode 100644 index 00000000..a7edd3e7 --- /dev/null +++ b/test/transform/resource/after-ecj/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-ecj/SynchronizedPlain.java b/test/transform/resource/after-ecj/SynchronizedPlain.java new file mode 100644 index 00000000..b9f032c5 --- /dev/null +++ b/test/transform/resource/after-ecj/SynchronizedPlain.java @@ -0,0 +1,37 @@ +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]; + 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-ecj/ToStringInner.java b/test/transform/resource/after-ecj/ToStringInner.java new file mode 100644 index 00000000..3970cdc4 --- /dev/null +++ b/test/transform/resource/after-ecj/ToStringInner.java @@ -0,0 +1,43 @@ +import lombok.ToString; +@ToString class ToStringOuter { + @ToString class ToStringInner { + final int y; + ToStringInner() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("ToStringInner(y=" + this.y) + ")"); + } + } + static @ToString class ToStringStaticInner { + final int y; + ToStringStaticInner() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("ToStringStaticInner(y=" + this.y) + ")"); + } + } + class ToStringMiddle { + @ToString class ToStringMoreInner { + final String name; + ToStringMoreInner() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("ToStringMoreInner(name=" + this.name) + ")"); + } + } + ToStringMiddle() { + super(); + } + } + final int x; + String name; + ToStringOuter() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("ToStringOuter(x=" + this.x) + ", name=") + this.name) + ")"); + } +} diff --git a/test/transform/resource/after-ecj/ToStringPlain.java b/test/transform/resource/after-ecj/ToStringPlain.java new file mode 100644 index 00000000..7196abb9 --- /dev/null +++ b/test/transform/resource/after-ecj/ToStringPlain.java @@ -0,0 +1,21 @@ +import lombok.ToString; +@lombok.ToString class ToString1 { + final int x; + String name; + ToString1() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("ToString1(x=" + this.x) + ", name=") + this.name) + ")"); + } +} +@ToString class ToString2 { + final int x; + String name; + ToString2() { + super(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("ToString2(x=" + this.x) + ", name=") + this.name) + ")"); + } +} diff --git a/test/transform/resource/before/GetterWithDollar.java b/test/transform/resource/before/GetterWithDollar.java index e1ef0818..88579373 100644 --- a/test/transform/resource/before/GetterWithDollar.java +++ b/test/transform/resource/before/GetterWithDollar.java @@ -1,4 +1,3 @@ -//ignore class GetterWithDollar1 { @lombok.Getter int $i; } diff --git a/test/transform/resource/before/NonNullPlain.java b/test/transform/resource/before/NonNullPlain.java index eef64b2f..265b8c5a 100644 --- a/test/transform/resource/before/NonNullPlain.java +++ b/test/transform/resource/before/NonNullPlain.java @@ -1,5 +1,4 @@ class NonNullPlain { - @lombok.Getter @lombok.Setter @lombok.NonNull @lombok.Getter int i; diff --git a/test/transform/resource/before/SetterWithDollar.java b/test/transform/resource/before/SetterWithDollar.java index c09173b0..53734458 100644 --- a/test/transform/resource/before/SetterWithDollar.java +++ b/test/transform/resource/before/SetterWithDollar.java @@ -1,4 +1,3 @@ -//ignore class SetterWithDollar1 { @lombok.Setter int $i; } diff --git a/test/transform/resource/before/SneakyThrowsMultiple.java b/test/transform/resource/before/SneakyThrowsMultiple.java index 7e644f3d..95ab1140 100644 --- a/test/transform/resource/before/SneakyThrowsMultiple.java +++ b/test/transform/resource/before/SneakyThrowsMultiple.java @@ -3,13 +3,13 @@ import java.io.IOException; import java.util.Random; class SneakyThrowsMultiple { - @lombok.SneakyThrows(IOException.class,Throwable.class) + @lombok.SneakyThrows({IOException.class,Throwable.class}) public void test() { System.out.println("test1"); throw new IOException(); } - @lombok.SneakyThrows(AWTException.class,IOException.class) + @lombok.SneakyThrows({AWTException.class,IOException.class}) public void test2() { System.out.println("test2"); if (new Random().nextBoolean()) { diff --git a/test/transform/resource/before/SynchronizedName.java b/test/transform/resource/before/SynchronizedName.java index 6d9ca5e9..5d074113 100644 --- a/test/transform/resource/before/SynchronizedName.java +++ b/test/transform/resource/before/SynchronizedName.java @@ -1,4 +1,3 @@ -//ignore class SynchronizedName { private Object read = new Object(); private static Object READ = new Object(); diff --git a/test/transform/resource/messages-delombok/SynchronizedName.java.messages b/test/transform/resource/messages-delombok/SynchronizedName.java.messages new file mode 100644 index 00000000..2af3ca1d --- /dev/null +++ b/test/transform/resource/messages-delombok/SynchronizedName.java.messages @@ -0,0 +1 @@ +8:9 ERROR The field write does not exist.
\ No newline at end of file diff --git a/test/transform/resource/messages-ecj/GetterAlreadyExists.java.messages b/test/transform/resource/messages-ecj/GetterAlreadyExists.java.messages new file mode 100644 index 00000000..c811ab9a --- /dev/null +++ b/test/transform/resource/messages-ecj/GetterAlreadyExists.java.messages @@ -0,0 +1,10 @@ +2 warning Not generating isFoo(): A method with that name already exists (hasFoo) +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 +56 warning Not generating isFoo(): A method with that name already exists (hasFoo) +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-ecj/GetterBoolean.java.messages b/test/transform/resource/messages-ecj/GetterBoolean.java.messages new file mode 100644 index 00000000..23e7828c --- /dev/null +++ b/test/transform/resource/messages-ecj/GetterBoolean.java.messages @@ -0,0 +1 @@ +7 warning Not generating isFoo(): A method with that name already exists (hasFoo) diff --git a/test/transform/resource/messages-ecj/SetterAlreadyExists.java.messages b/test/transform/resource/messages-ecj/SetterAlreadyExists.java.messages new file mode 100644 index 00000000..df4a9025 --- /dev/null +++ b/test/transform/resource/messages-ecj/SetterAlreadyExists.java.messages @@ -0,0 +1,7 @@ +2 warning Not generating setFoo(boolean foo): A method with that name already exists +7 warning Not generating setFoo(boolean foo): A method with that name already exists +12 warning Not generating setFoo(String foo): A method with that name already exists +17 warning Not generating setFoo(String foo): A method with that name already exists +22 warning Not generating setFoo(String foo): A method with that name already exists +27 warning Not generating setFoo(String foo): A method with that name already exists +32 warning Not generating setFoo(String foo): A method with that name already exists
\ No newline at end of file diff --git a/test/transform/resource/messages-ecj/SynchronizedName.java.messages b/test/transform/resource/messages-ecj/SynchronizedName.java.messages new file mode 100644 index 00000000..2c94551c --- /dev/null +++ b/test/transform/resource/messages-ecj/SynchronizedName.java.messages @@ -0,0 +1 @@ +8 error The field write does not exist. diff --git a/test/transform/src/lombok/transform/TestWithEcj.java b/test/transform/src/lombok/transform/TestWithEcj.java new file mode 100644 index 00000000..923bf835 --- /dev/null +++ b/test/transform/src/lombok/transform/TestWithEcj.java @@ -0,0 +1,56 @@ +/* + * Copyright © 2009-2010 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; + +@RunWith(DirectoryRunner.class) +public class TestWithEcj implements DirectoryRunner.TestParams { + @Override + public DirectoryRunner.Compiler getCompiler() { + return DirectoryRunner.Compiler.ECJ; + } + + @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-ecj"); + } + + @Override + public File getMessagesDirectory() { + return new File("test/transform/resource/messages-ecj"); + } +} |