aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2013-06-14 15:21:17 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2013-06-16 13:20:54 +0200
commit9066d57ed9073cd99d664b2676d6fde54af1a7b6 (patch)
treed4ae818d465320310a23f5a894c84b8db3606f7c /test
parent648c3eeee69bede925f794b16b1f3d184359761f (diff)
downloadlombok-9066d57ed9073cd99d664b2676d6fde54af1a7b6.tar.gz
lombok-9066d57ed9073cd99d664b2676d6fde54af1a7b6.tar.bz2
lombok-9066d57ed9073cd99d664b2676d6fde54af1a7b6.zip
improved and added to test cases for @Builder.
Eclipse's implementation continues to pass them all.
Diffstat (limited to 'test')
-rw-r--r--test/transform/resource/after-ecj/BuilderComplex.java40
-rw-r--r--test/transform/resource/after-ecj/BuilderSimple.java33
-rw-r--r--test/transform/resource/after-ecj/BuilderWithExistingBuilderClass.java33
-rw-r--r--test/transform/resource/before/BuilderComplex.java2
4 files changed, 107 insertions, 1 deletions
diff --git a/test/transform/resource/after-ecj/BuilderComplex.java b/test/transform/resource/after-ecj/BuilderComplex.java
new file mode 100644
index 00000000..ca302a3d
--- /dev/null
+++ b/test/transform/resource/after-ecj/BuilderComplex.java
@@ -0,0 +1,40 @@
+import java.util.List;
+import lombok.experimental.Builder;
+class BuilderComplex {
+ public static @java.lang.SuppressWarnings("all") class VoidBuilder<T extends Number> {
+ private T number;
+ private int arg2;
+ private String arg3;
+ private BuilderComplex selfRef;
+ @java.lang.SuppressWarnings("all") VoidBuilder() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") VoidBuilder<T> number(final T number) {
+ this.number = number;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") VoidBuilder<T> arg2(final int arg2) {
+ this.arg2 = arg2;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") VoidBuilder<T> arg3(final String arg3) {
+ this.arg3 = arg3;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") VoidBuilder<T> selfRef(final BuilderComplex selfRef) {
+ this.selfRef = selfRef;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") void execute() {
+ BuilderComplex.<T>testVoidWithGenerics(number, arg2, arg3, selfRef);
+ }
+ }
+ BuilderComplex() {
+ super();
+ }
+ private static @Builder(buildMethodName = "execute") <T extends Number>void testVoidWithGenerics(T number, int arg2, String arg3, BuilderComplex selfRef) {
+ }
+ public static @java.lang.SuppressWarnings("all") <T extends Number>VoidBuilder<T> builder() {
+ return new VoidBuilder<T>();
+ }
+}
diff --git a/test/transform/resource/after-ecj/BuilderSimple.java b/test/transform/resource/after-ecj/BuilderSimple.java
new file mode 100644
index 00000000..4ca8e120
--- /dev/null
+++ b/test/transform/resource/after-ecj/BuilderSimple.java
@@ -0,0 +1,33 @@
+import java.util.List;
+@lombok.experimental.Builder class BuilderSimple<T> {
+ public static @java.lang.SuppressWarnings("all") class BuilderSimpleBuilder<T> {
+ private int yes;
+ private List<T> also;
+ @java.lang.SuppressWarnings("all") BuilderSimpleBuilder() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSimpleBuilder<T> yes(final int yes) {
+ this.yes = yes;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSimpleBuilder<T> also(final List<T> also) {
+ this.also = also;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderSimple<T> build() {
+ return new BuilderSimple<T>(yes, also);
+ }
+ }
+ private final int noshow = 0;
+ private final int yes;
+ private List<T> also;
+ private int $butNotMe;
+ private @java.lang.SuppressWarnings("all") BuilderSimple(final int yes, final List<T> also) {
+ super();
+ this.yes = yes;
+ this.also = also;
+ }
+ public static @java.lang.SuppressWarnings("all") <T>BuilderSimpleBuilder<T> builder() {
+ return new BuilderSimpleBuilder<T>();
+ }
+}
diff --git a/test/transform/resource/after-ecj/BuilderWithExistingBuilderClass.java b/test/transform/resource/after-ecj/BuilderWithExistingBuilderClass.java
new file mode 100644
index 00000000..02ed259e
--- /dev/null
+++ b/test/transform/resource/after-ecj/BuilderWithExistingBuilderClass.java
@@ -0,0 +1,33 @@
+import lombok.experimental.Builder;
+class BuilderWithExistingBuilderClass<T, K extends Number> {
+ public static class BuilderWithExistingBuilderClassBuilder<Z extends Number> {
+ private boolean arg2;
+ private String arg3;
+ private Z arg1;
+ public void arg2(boolean arg) {
+ }
+ @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassBuilder() {
+ super();
+ }
+ public @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassBuilder<Z> arg1(final Z arg1) {
+ this.arg1 = arg1;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassBuilder<Z> arg3(final String arg3) {
+ this.arg3 = arg3;
+ return this;
+ }
+ public @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClass<String, Z> build() {
+ return BuilderWithExistingBuilderClass.<Z>staticMethod(arg1, arg2, arg3);
+ }
+ }
+ BuilderWithExistingBuilderClass() {
+ super();
+ }
+ public static @Builder <Z extends Number>BuilderWithExistingBuilderClass<String, Z> staticMethod(Z arg1, boolean arg2, String arg3) {
+ return null;
+ }
+ public static @java.lang.SuppressWarnings("all") <Z extends Number>BuilderWithExistingBuilderClassBuilder<Z> builder() {
+ return new BuilderWithExistingBuilderClassBuilder<Z>();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/before/BuilderComplex.java b/test/transform/resource/before/BuilderComplex.java
index 3d3e7187..590a2723 100644
--- a/test/transform/resource/before/BuilderComplex.java
+++ b/test/transform/resource/before/BuilderComplex.java
@@ -2,6 +2,6 @@ import java.util.List;
import lombok.experimental.Builder;
class BuilderComplex {
- @Builder
+ @Builder(buildMethodName = "execute")
private static <T extends Number> void testVoidWithGenerics(T number, int arg2, String arg3, BuilderComplex selfRef) {}
}