diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2012-07-12 02:58:26 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2012-07-12 02:58:26 +0200 |
commit | 3cf9ffed29cfe56734570b1c3c57d924ac7416df (patch) | |
tree | d7a9a68e89ccf4af2bf52ad4b90f0c2dc0d6de9b /test/transform/resource/after-delombok | |
parent | 1865bd7309b9d1dc743f83ccdbd7204fb0939ecd (diff) | |
download | lombok-3cf9ffed29cfe56734570b1c3c57d924ac7416df.tar.gz lombok-3cf9ffed29cfe56734570b1c3c57d924ac7416df.tar.bz2 lombok-3cf9ffed29cfe56734570b1c3c57d924ac7416df.zip |
Wither support + tests (javac only; ecj tests are currently set to ignore).
Diffstat (limited to 'test/transform/resource/after-delombok')
9 files changed, 232 insertions, 0 deletions
diff --git a/test/transform/resource/after-delombok/WitherAccessLevel.java b/test/transform/resource/after-delombok/WitherAccessLevel.java new file mode 100644 index 00000000..963f6972 --- /dev/null +++ b/test/transform/resource/after-delombok/WitherAccessLevel.java @@ -0,0 +1,30 @@ +class WitherAccessLevel { + boolean isNone; + boolean isPrivate; + boolean isPackage; + boolean isProtected; + boolean isPublic; + boolean value; + WitherAccessLevel(boolean isNone, boolean isPrivate, boolean isPackage, boolean isProtected, boolean isPublic, boolean value) { + } + @java.lang.SuppressWarnings("all") + private WitherAccessLevel withPrivate(final boolean isPrivate) { + return this.isPrivate == isPrivate ? this : new WitherAccessLevel(this.isNone, isPrivate, this.isPackage, this.isProtected, this.isPublic, this.value); + } + @java.lang.SuppressWarnings("all") + WitherAccessLevel withPackage(final boolean isPackage) { + return this.isPackage == isPackage ? this : new WitherAccessLevel(this.isNone, this.isPrivate, isPackage, this.isProtected, this.isPublic, this.value); + } + @java.lang.SuppressWarnings("all") + protected WitherAccessLevel withProtected(final boolean isProtected) { + return this.isProtected == isProtected ? this : new WitherAccessLevel(this.isNone, this.isPrivate, this.isPackage, isProtected, this.isPublic, this.value); + } + @java.lang.SuppressWarnings("all") + public WitherAccessLevel withPublic(final boolean isPublic) { + return this.isPublic == isPublic ? this : new WitherAccessLevel(this.isNone, this.isPrivate, this.isPackage, this.isProtected, isPublic, this.value); + } + @java.lang.SuppressWarnings("all") + public WitherAccessLevel withValue(final boolean value) { + return this.value == value ? this : new WitherAccessLevel(this.isNone, this.isPrivate, this.isPackage, this.isProtected, this.isPublic, value); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/WitherAlreadyExists.java b/test/transform/resource/after-delombok/WitherAlreadyExists.java new file mode 100644 index 00000000..be41f6bc --- /dev/null +++ b/test/transform/resource/after-delombok/WitherAlreadyExists.java @@ -0,0 +1,71 @@ +class Wither1 { + boolean foo; + void withFoo(boolean foo) { + } + Wither1(boolean foo) { + } +} +class Wither2 { + boolean foo; + void withFoo(String foo) { + } + Wither2(boolean foo) { + } +} +class Wither3 { + String foo; + void withFoo(boolean foo) { + } + Wither3(String foo) { + } +} +class Wither4 { + String foo; + void withFoo(String foo) { + } + Wither4(String foo) { + } +} +class Wither5 { + String foo; + void withFoo() { + } + Wither5(String foo) { + } + @java.lang.SuppressWarnings("all") + public Wither5 withFoo(final String foo) { + return this.foo == foo ? this : new Wither5(foo); + } +} +class Wither6 { + String foo; + void withFoo(String foo, int x) { + } + Wither6(String foo) { + } + @java.lang.SuppressWarnings("all") + public Wither6 withFoo(final String foo) { + return this.foo == foo ? this : new Wither6(foo); + } +} +class Wither7 { + String foo; + void withFoo(String foo, Object... x) { + } + Wither7(String foo) { + } +} +class Wither8 { + boolean isFoo; + void withIsFoo(boolean foo) { + } + Wither8(boolean foo) { + } +} +class Wither9 { + boolean isFoo; + void withFoo(boolean foo) { + } + Wither9(boolean foo) { + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/WitherAndAllArgsConstructor.java b/test/transform/resource/after-delombok/WitherAndAllArgsConstructor.java new file mode 100644 index 00000000..7607dce4 --- /dev/null +++ b/test/transform/resource/after-delombok/WitherAndAllArgsConstructor.java @@ -0,0 +1,23 @@ +class WitherAndAllArgsConstructor<T, J extends T, L extends java.lang.Number> { + J test; + java.util.List<L> test2; + final int x = 10; + int y = 20; + final int z; + @java.beans.ConstructorProperties({"test", "test2", "y", "z"}) + @java.lang.SuppressWarnings("all") + public WitherAndAllArgsConstructor(final J test, final java.util.List<L> test2, final int y, final int z) { + this.test = test; + this.test2 = test2; + this.y = y; + this.z = z; + } + @java.lang.SuppressWarnings("all") + public WitherAndAllArgsConstructor<T, J, L> withTest(final J test) { + return this.test == test ? this : new WitherAndAllArgsConstructor<T, J, L>(test, this.test2, this.y, this.z); + } + @java.lang.SuppressWarnings("all") + public WitherAndAllArgsConstructor<T, J, L> withTest2(final java.util.List<L> test2) { + return this.test2 == test2 ? this : new WitherAndAllArgsConstructor<T, J, L>(this.test, test2, this.y, this.z); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/WitherDeprecated.java b/test/transform/resource/after-delombok/WitherDeprecated.java new file mode 100644 index 00000000..f076d90e --- /dev/null +++ b/test/transform/resource/after-delombok/WitherDeprecated.java @@ -0,0 +1,20 @@ +class WitherDeprecated { + @Deprecated + int annotation; + /** + * @deprecated + */ + int javadoc; + WitherDeprecated(int annotation, int javadoc) { + } + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public WitherDeprecated withAnnotation(final int annotation) { + return this.annotation == annotation ? this : new WitherDeprecated(annotation, this.javadoc); + } + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public WitherDeprecated withJavadoc(final int javadoc) { + return this.javadoc == javadoc ? this : new WitherDeprecated(this.annotation, javadoc); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/WitherOnClass.java b/test/transform/resource/after-delombok/WitherOnClass.java new file mode 100644 index 00000000..783fede1 --- /dev/null +++ b/test/transform/resource/after-delombok/WitherOnClass.java @@ -0,0 +1,52 @@ +class WitherOnClass1 { + boolean isNone; + boolean isPublic; + WitherOnClass1(boolean isNone, boolean isPublic) { + } + @java.lang.SuppressWarnings("all") + public WitherOnClass1 withPublic(final boolean isPublic) { + return this.isPublic == isPublic ? this : new WitherOnClass1(this.isNone, isPublic); + } +} +class WitherOnClass2 { + boolean isNone; + boolean isProtected; + boolean isPackage; + WitherOnClass2(boolean isNone, boolean isProtected, boolean isPackage) { + } + @java.lang.SuppressWarnings("all") + protected WitherOnClass2 withProtected(final boolean isProtected) { + return this.isProtected == isProtected ? this : new WitherOnClass2(this.isNone, isProtected, this.isPackage); + } + @java.lang.SuppressWarnings("all") + WitherOnClass2 withPackage(final boolean isPackage) { + return this.isPackage == isPackage ? this : new WitherOnClass2(this.isNone, this.isProtected, isPackage); + } +} +class WitherOnClass3 { + String couldBeNull; + @lombok.NonNull + String nonNull; + WitherOnClass3(String couldBeNull, String nonNull) { + } + @java.lang.SuppressWarnings("all") + public WitherOnClass3 withCouldBeNull(final String couldBeNull) { + return this.couldBeNull == couldBeNull ? this : new WitherOnClass3(couldBeNull, this.nonNull); + } + @java.lang.SuppressWarnings("all") + public WitherOnClass3 withNonNull(@lombok.NonNull final String nonNull) { + if (nonNull == null) throw new java.lang.NullPointerException("nonNull"); + return this.nonNull == nonNull ? this : new WitherOnClass3(this.couldBeNull, nonNull); + } +} +class WitherOnClass4 { + final int fX = 10; + final int fY; + WitherOnClass4(int y) { + this.fY = y; + } + @java.lang.SuppressWarnings("all") + public WitherOnClass4 withY(final int fY) { + return this.fY == fY ? this : new WitherOnClass4(fY); + } +} diff --git a/test/transform/resource/after-delombok/WitherOnStatic.java b/test/transform/resource/after-delombok/WitherOnStatic.java new file mode 100644 index 00000000..e481beb7 --- /dev/null +++ b/test/transform/resource/after-delombok/WitherOnStatic.java @@ -0,0 +1,4 @@ +class WitherOnStatic { + static boolean foo; + static int bar; +} diff --git a/test/transform/resource/after-delombok/WitherPlain.java b/test/transform/resource/after-delombok/WitherPlain.java new file mode 100644 index 00000000..ab6a3f4b --- /dev/null +++ b/test/transform/resource/after-delombok/WitherPlain.java @@ -0,0 +1,14 @@ +class WitherPlain { + int i; + final int foo; + WitherPlain(int i, int foo) { + } + @java.lang.SuppressWarnings("all") + public WitherPlain withI(final int i) { + return this.i == i ? this : new WitherPlain(i, this.foo); + } + @java.lang.SuppressWarnings("all") + public WitherPlain withFoo(final int foo) { + return this.foo == foo ? this : new WitherPlain(this.i, foo); + } +} diff --git a/test/transform/resource/after-delombok/WitherWithDollar.java b/test/transform/resource/after-delombok/WitherWithDollar.java new file mode 100644 index 00000000..066f3fb5 --- /dev/null +++ b/test/transform/resource/after-delombok/WitherWithDollar.java @@ -0,0 +1,3 @@ +class WitherWithDollar { + int $i; +} diff --git a/test/transform/resource/after-delombok/WitherWithGenerics.java b/test/transform/resource/after-delombok/WitherWithGenerics.java new file mode 100644 index 00000000..9630c792 --- /dev/null +++ b/test/transform/resource/after-delombok/WitherWithGenerics.java @@ -0,0 +1,15 @@ +class WitherWithGenerics<T, J extends T, L extends java.lang.Number> { + J test; + java.util.List<L> test2; + int $i; + public WitherWithGenerics(J test, java.util.List<L> test2) { + } + @java.lang.SuppressWarnings("all") + public WitherWithGenerics<T, J, L> withTest(final J test) { + return this.test == test ? this : new WitherWithGenerics<T, J, L>(test, this.test2); + } + @java.lang.SuppressWarnings("all") + public WitherWithGenerics<T, J, L> withTest2(final java.util.List<L> test2) { + return this.test2 == test2 ? this : new WitherWithGenerics<T, J, L>(this.test, test2); + } +} |