diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2012-08-06 21:26:55 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2012-08-06 21:26:55 +0200 |
commit | 8ca3ddaa530ca287caff32c2b0dbcff8c17e74c2 (patch) | |
tree | cf0f8d893ea563b1109762c7220ecf18f588a705 /test/transform | |
parent | 87f763a94c87b03da269d110c44e7e750ddf5211 (diff) | |
download | lombok-8ca3ddaa530ca287caff32c2b0dbcff8c17e74c2.tar.gz lombok-8ca3ddaa530ca287caff32c2b0dbcff8c17e74c2.tar.bz2 lombok-8ca3ddaa530ca287caff32c2b0dbcff8c17e74c2.zip |
fully tested the HandleWither impl for eclipse.
Diffstat (limited to 'test/transform')
17 files changed, 268 insertions, 19 deletions
diff --git a/test/transform/resource/after-delombok/WitherPlain.java b/test/transform/resource/after-delombok/WitherPlain.java index ab6a3f4b..a2e947bd 100644 --- a/test/transform/resource/after-delombok/WitherPlain.java +++ b/test/transform/resource/after-delombok/WitherPlain.java @@ -2,6 +2,8 @@ class WitherPlain { int i; final int foo; WitherPlain(int i, int foo) { + this.i = i; + this.foo = foo; } @java.lang.SuppressWarnings("all") public WitherPlain withI(final int i) { diff --git a/test/transform/resource/after-delombok/WitherWithGenerics.java b/test/transform/resource/after-delombok/WitherWithGenerics.java index 9630c792..98bbd04d 100644 --- a/test/transform/resource/after-delombok/WitherWithGenerics.java +++ b/test/transform/resource/after-delombok/WitherWithGenerics.java @@ -1,15 +1,20 @@ class WitherWithGenerics<T, J extends T, L extends java.lang.Number> { J test; java.util.List<L> test2; + java.util.List<? extends L> test3; int $i; - public WitherWithGenerics(J test, java.util.List<L> test2) { + public WitherWithGenerics(J test, java.util.List<L> test2, java.util.List<? extends L> test3) { } @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); + return this.test == test ? this : new WitherWithGenerics<T, J, L>(test, this.test2, this.test3); } @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); + return this.test2 == test2 ? this : new WitherWithGenerics<T, J, L>(this.test, test2, this.test3); + } + @java.lang.SuppressWarnings("all") + public WitherWithGenerics<T, J, L> withTest3(final java.util.List<? extends L> test3) { + return this.test3 == test3 ? this : new WitherWithGenerics<T, J, L>(this.test, this.test2, test3); } } diff --git a/test/transform/resource/after-ecj/WitherAccessLevel.java b/test/transform/resource/after-ecj/WitherAccessLevel.java index 0facc12f..09a2e514 100644 --- a/test/transform/resource/after-ecj/WitherAccessLevel.java +++ b/test/transform/resource/after-ecj/WitherAccessLevel.java @@ -1 +1,27 @@ -//ignore +import lombok.AccessLevel; +class WitherAccessLevel { + @lombok.experimental.Wither(lombok.AccessLevel.NONE) boolean isNone; + @lombok.experimental.Wither(AccessLevel.PRIVATE) boolean isPrivate; + @lombok.experimental.Wither(lombok.AccessLevel.PACKAGE) boolean isPackage; + @lombok.experimental.Wither(AccessLevel.PROTECTED) boolean isProtected; + @lombok.experimental.Wither(lombok.AccessLevel.PUBLIC) boolean isPublic; + @lombok.experimental.Wither(value = lombok.AccessLevel.PUBLIC) boolean value; + WitherAccessLevel(boolean isNone, boolean isPrivate, boolean isPackage, boolean isProtected, boolean isPublic, boolean value) { + super(); + } + private @java.lang.SuppressWarnings("all") 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)); + } + protected @java.lang.SuppressWarnings("all") WitherAccessLevel withProtected(final boolean isProtected) { + return ((this.isProtected == isProtected) ? this : new WitherAccessLevel(this.isNone, this.isPrivate, this.isPackage, isProtected, this.isPublic, this.value)); + } + public @java.lang.SuppressWarnings("all") WitherAccessLevel withPublic(final boolean isPublic) { + return ((this.isPublic == isPublic) ? this : new WitherAccessLevel(this.isNone, this.isPrivate, this.isPackage, this.isProtected, isPublic, this.value)); + } + public @java.lang.SuppressWarnings("all") WitherAccessLevel withValue(final boolean value) { + return ((this.value == value) ? this : new WitherAccessLevel(this.isNone, this.isPrivate, this.isPackage, this.isProtected, this.isPublic, value)); + } +} diff --git a/test/transform/resource/after-ecj/WitherAlreadyExists.java b/test/transform/resource/after-ecj/WitherAlreadyExists.java index 0facc12f..ded10755 100644 --- a/test/transform/resource/after-ecj/WitherAlreadyExists.java +++ b/test/transform/resource/after-ecj/WitherAlreadyExists.java @@ -1 +1,78 @@ -//ignore +class Wither1 { + @lombok.experimental.Wither boolean foo; + void withFoo(boolean foo) { + } + Wither1(boolean foo) { + super(); + } +} +class Wither2 { + @lombok.experimental.Wither boolean foo; + void withFoo(String foo) { + } + Wither2(boolean foo) { + super(); + } +} +class Wither3 { + @lombok.experimental.Wither String foo; + void withFoo(boolean foo) { + } + Wither3(String foo) { + super(); + } +} +class Wither4 { + @lombok.experimental.Wither String foo; + void withFoo(String foo) { + } + Wither4(String foo) { + super(); + } +} +class Wither5 { + @lombok.experimental.Wither String foo; + void withFoo() { + } + Wither5(String foo) { + super(); + } + public @java.lang.SuppressWarnings("all") Wither5 withFoo(final String foo) { + return ((this.foo == foo) ? this : new Wither5(foo)); + } +} +class Wither6 { + @lombok.experimental.Wither String foo; + void withFoo(String foo, int x) { + } + Wither6(String foo) { + super(); + } + public @java.lang.SuppressWarnings("all") Wither6 withFoo(final String foo) { + return ((this.foo == foo) ? this : new Wither6(foo)); + } +} +class Wither7 { + @lombok.experimental.Wither String foo; + void withFoo(String foo, Object... x) { + } + Wither7(String foo) { + super(); + } +} +class Wither8 { + @lombok.experimental.Wither boolean isFoo; + void withIsFoo(boolean foo) { + } + Wither8(boolean foo) { + super(); + } +} +class Wither9 { + @lombok.experimental.Wither boolean isFoo; + void withFoo(boolean foo) { + } + Wither9(boolean foo) { + super(); + } +} diff --git a/test/transform/resource/after-ecj/WitherAndAllArgsConstructor.java b/test/transform/resource/after-ecj/WitherAndAllArgsConstructor.java index 0facc12f..091024e2 100644 --- a/test/transform/resource/after-ecj/WitherAndAllArgsConstructor.java +++ b/test/transform/resource/after-ecj/WitherAndAllArgsConstructor.java @@ -1 +1,20 @@ -//ignore +@lombok.AllArgsConstructor class WitherAndAllArgsConstructor<T, J extends T, L extends java.lang.Number> { + @lombok.experimental.Wither J test; + @lombok.experimental.Wither java.util.List<L> test2; + final int x = 10; + int y = 20; + final int z; + public @java.lang.SuppressWarnings("all") 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)); + } + public @java.lang.SuppressWarnings("all") 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)); + } + public @java.beans.ConstructorProperties({"test", "test2", "y", "z"}) @java.lang.SuppressWarnings("all") WitherAndAllArgsConstructor(final J test, final java.util.List<L> test2, final int y, final int z) { + super(); + this.test = test; + this.test2 = test2; + this.y = y; + this.z = z; + } +} diff --git a/test/transform/resource/after-ecj/WitherDeprecated.java b/test/transform/resource/after-ecj/WitherDeprecated.java index 0facc12f..b57d0d79 100644 --- a/test/transform/resource/after-ecj/WitherDeprecated.java +++ b/test/transform/resource/after-ecj/WitherDeprecated.java @@ -1 +1,14 @@ -//ignore +import lombok.experimental.Wither; +class WitherDeprecated { + @Deprecated @Wither int annotation; + @Wither int javadoc; + WitherDeprecated(int annotation, int javadoc) { + super(); + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") WitherDeprecated withAnnotation(final int annotation) { + return ((this.annotation == annotation) ? this : new WitherDeprecated(annotation, this.javadoc)); + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") WitherDeprecated withJavadoc(final int javadoc) { + return ((this.javadoc == javadoc) ? this : new WitherDeprecated(this.annotation, javadoc)); + } +} diff --git a/test/transform/resource/after-ecj/WitherOnClass.java b/test/transform/resource/after-ecj/WitherOnClass.java index 0facc12f..ff4566e5 100644 --- a/test/transform/resource/after-ecj/WitherOnClass.java +++ b/test/transform/resource/after-ecj/WitherOnClass.java @@ -1 +1,50 @@ -//ignore +@lombok.experimental.Wither class WitherOnClass1 { + @lombok.experimental.Wither(lombok.AccessLevel.NONE) boolean isNone; + boolean isPublic; + WitherOnClass1(boolean isNone, boolean isPublic) { + super(); + } + public @java.lang.SuppressWarnings("all") WitherOnClass1 withPublic(final boolean isPublic) { + return ((this.isPublic == isPublic) ? this : new WitherOnClass1(this.isNone, isPublic)); + } +} +@lombok.experimental.Wither(lombok.AccessLevel.PROTECTED) class WitherOnClass2 { + @lombok.experimental.Wither(lombok.AccessLevel.NONE) boolean isNone; + boolean isProtected; + @lombok.experimental.Wither(lombok.AccessLevel.PACKAGE) boolean isPackage; + WitherOnClass2(boolean isNone, boolean isProtected, boolean isPackage) { + super(); + } + @java.lang.SuppressWarnings("all") WitherOnClass2 withPackage(final boolean isPackage) { + return ((this.isPackage == isPackage) ? this : new WitherOnClass2(this.isNone, this.isProtected, isPackage)); + } + protected @java.lang.SuppressWarnings("all") WitherOnClass2 withProtected(final boolean isProtected) { + return ((this.isProtected == isProtected) ? this : new WitherOnClass2(this.isNone, isProtected, this.isPackage)); + } +} +@lombok.experimental.Wither class WitherOnClass3 { + String couldBeNull; + @lombok.NonNull String nonNull; + WitherOnClass3(String couldBeNull, String nonNull) { + super(); + } + public @java.lang.SuppressWarnings("all") WitherOnClass3 withCouldBeNull(final String couldBeNull) { + return ((this.couldBeNull == couldBeNull) ? this : new WitherOnClass3(couldBeNull, this.nonNull)); + } + public @java.lang.SuppressWarnings("all") WitherOnClass3 withNonNull(final @lombok.NonNull String nonNull) { + if ((nonNull == null)) + throw new java.lang.NullPointerException("nonNull"); + return ((this.nonNull == nonNull) ? this : new WitherOnClass3(this.couldBeNull, nonNull)); + } +} +@lombok.experimental.Wither @lombok.experimental.Accessors(prefix = "f") class WitherOnClass4 { + final int fX = 10; + final int fY; + WitherOnClass4(int y) { + super(); + this.fY = y; + } + public @java.lang.SuppressWarnings("all") WitherOnClass4 withY(final int fY) { + return ((this.fY == fY) ? this : new WitherOnClass4(fY)); + } +} diff --git a/test/transform/resource/after-ecj/WitherOnStatic.java b/test/transform/resource/after-ecj/WitherOnStatic.java index 0facc12f..8f385e09 100644 --- a/test/transform/resource/after-ecj/WitherOnStatic.java +++ b/test/transform/resource/after-ecj/WitherOnStatic.java @@ -1 +1,9 @@ -//ignore +class WitherOnStatic { + static @lombok.experimental.Wither boolean foo; + static @lombok.experimental.Wither int bar; + <clinit>() { + } + WitherOnStatic() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/WitherPlain.java b/test/transform/resource/after-ecj/WitherPlain.java index 0facc12f..ae1988bc 100644 --- a/test/transform/resource/after-ecj/WitherPlain.java +++ b/test/transform/resource/after-ecj/WitherPlain.java @@ -1 +1,16 @@ -//ignore +import lombok.experimental.Wither; +class WitherPlain { + @lombok.experimental.Wither int i; + final @Wither int foo; + WitherPlain(int i, int foo) { + super(); + this.i = i; + this.foo = foo; + } + public @java.lang.SuppressWarnings("all") WitherPlain withI(final int i) { + return ((this.i == i) ? this : new WitherPlain(i, this.foo)); + } + public @java.lang.SuppressWarnings("all") WitherPlain withFoo(final int foo) { + return ((this.foo == foo) ? this : new WitherPlain(this.i, foo)); + } +} diff --git a/test/transform/resource/after-ecj/WitherWithDollar.java b/test/transform/resource/after-ecj/WitherWithDollar.java index 0facc12f..db46e259 100644 --- a/test/transform/resource/after-ecj/WitherWithDollar.java +++ b/test/transform/resource/after-ecj/WitherWithDollar.java @@ -1 +1,6 @@ -//ignore +class WitherWithDollar { + @lombok.experimental.Wither int $i; + WitherWithDollar() { + super(); + } +} diff --git a/test/transform/resource/after-ecj/WitherWithGenerics.java b/test/transform/resource/after-ecj/WitherWithGenerics.java index 0facc12f..ee73297c 100644 --- a/test/transform/resource/after-ecj/WitherWithGenerics.java +++ b/test/transform/resource/after-ecj/WitherWithGenerics.java @@ -1 +1,18 @@ -//ignore +class WitherWithGenerics<T, J extends T, L extends java.lang.Number> { + @lombok.experimental.Wither J test; + @lombok.experimental.Wither java.util.List<L> test2; + @lombok.experimental.Wither java.util.List<? extends L> test3; + int $i; + public WitherWithGenerics(J test, java.util.List<L> test2, java.util.List<? extends L> test3) { + super(); + } + public @java.lang.SuppressWarnings("all") WitherWithGenerics<T, J, L> withTest(final J test) { + return ((this.test == test) ? this : new WitherWithGenerics<T, J, L>(test, this.test2, this.test3)); + } + public @java.lang.SuppressWarnings("all") WitherWithGenerics<T, J, L> withTest2(final java.util.List<L> test2) { + return ((this.test2 == test2) ? this : new WitherWithGenerics<T, J, L>(this.test, test2, this.test3)); + } + public @java.lang.SuppressWarnings("all") WitherWithGenerics<T, J, L> withTest3(final java.util.List<? extends L> test3) { + return ((this.test3 == test3) ? this : new WitherWithGenerics<T, J, L>(this.test, this.test2, test3)); + } +} diff --git a/test/transform/resource/before/WitherPlain.java b/test/transform/resource/before/WitherPlain.java index 7f931217..436e6f3b 100644 --- a/test/transform/resource/before/WitherPlain.java +++ b/test/transform/resource/before/WitherPlain.java @@ -4,5 +4,7 @@ class WitherPlain { @Wither final int foo; WitherPlain(int i, int foo) { + this.i = i; + this.foo = foo; } } diff --git a/test/transform/resource/before/WitherWithGenerics.java b/test/transform/resource/before/WitherWithGenerics.java index 229cc94e..0b0fdd46 100644 --- a/test/transform/resource/before/WitherWithGenerics.java +++ b/test/transform/resource/before/WitherWithGenerics.java @@ -1,8 +1,9 @@ class WitherWithGenerics<T, J extends T, L extends java.lang.Number> { @lombok.experimental.Wither J test; @lombok.experimental.Wither java.util.List<L> test2; + @lombok.experimental.Wither java.util.List<? extends L> test3; int $i; - public WitherWithGenerics(J test, java.util.List<L> test2) { + public WitherWithGenerics(J test, java.util.List<L> test2, java.util.List<? extends L> test3) { } }
\ No newline at end of file diff --git a/test/transform/resource/messages-ecj/SetterAlreadyExists.java.messages b/test/transform/resource/messages-ecj/SetterAlreadyExists.java.messages index bc97510c..d33024db 100644 --- a/test/transform/resource/messages-ecj/SetterAlreadyExists.java.messages +++ b/test/transform/resource/messages-ecj/SetterAlreadyExists.java.messages @@ -1,7 +1,7 @@ 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 -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 +8 warning Not generating setFoo(): A method with that name already exists +14 warning Not generating setFoo(): A method with that name already exists +20 warning Not generating setFoo(): A method with that name already exists +38 warning Not generating setFoo(): A method with that name already exists +44 warning Not generating setFoo(): A method with that name already exists (setIsFoo) +50 warning Not generating setFoo(): A method with that name already exists
\ No newline at end of file diff --git a/test/transform/resource/messages-ecj/WitherAlreadyExists.java.messages b/test/transform/resource/messages-ecj/WitherAlreadyExists.java.messages new file mode 100644 index 00000000..bba8913b --- /dev/null +++ b/test/transform/resource/messages-ecj/WitherAlreadyExists.java.messages @@ -0,0 +1,7 @@ +2 warning Not generating withFoo(): A method with that name already exists +12 warning Not generating withFoo(): A method with that name already exists +22 warning Not generating withFoo(): A method with that name already exists +32 warning Not generating withFoo(): A method with that name already exists +62 warning Not generating withFoo(): A method with that name already exists +72 warning Not generating withFoo(): A method with that name already exists (withIsFoo) +82 warning Not generating withFoo(): A method with that name already exists diff --git a/test/transform/resource/messages-ecj/WitherOnStatic.java.messages b/test/transform/resource/messages-ecj/WitherOnStatic.java.messages new file mode 100644 index 00000000..5b52d54f --- /dev/null +++ b/test/transform/resource/messages-ecj/WitherOnStatic.java.messages @@ -0,0 +1,2 @@ +2 warning Not generating wither for this field: Withers cannot be generated for static fields. +3 warning Not generating wither for this field: Withers cannot be generated for static fields. diff --git a/test/transform/resource/messages-ecj/WitherWithDollar.java.messages b/test/transform/resource/messages-ecj/WitherWithDollar.java.messages new file mode 100644 index 00000000..e55530e3 --- /dev/null +++ b/test/transform/resource/messages-ecj/WitherWithDollar.java.messages @@ -0,0 +1 @@ +2 warning Not generating wither for this field: Withers cannot be generated for fields starting with $. |