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 has |
