aboutsummaryrefslogtreecommitdiff
path: root/test/transform
diff options
context:
space:
mode:
authorReinier Zwitserloot <r.zwitserloot@projectlombok.org>2019-07-09 00:10:36 +0200
committerReinier Zwitserloot <r.zwitserloot@projectlombok.org>2019-07-09 00:11:00 +0200
commitc1039553b088dc45d272b942d930414d3224b06c (patch)
treeec303678473bd2c56c711f93dbea464affeaaab3 /test/transform
parentbcf2d55abfb2b9d17de5ec339d16221dca6db6d4 (diff)
downloadlombok-c1039553b088dc45d272b942d930414d3224b06c.tar.gz
lombok-c1039553b088dc45d272b942d930414d3224b06c.tar.bz2
lombok-c1039553b088dc45d272b942d930414d3224b06c.zip
[builder] added a feature: you can now configure builder class name via the config system
Diffstat (limited to 'test/transform')
-rw-r--r--test/transform/resource/after-delombok/BuilderComplex.java18
-rw-r--r--test/transform/resource/after-delombok/BuilderCustomName.java47
-rw-r--r--test/transform/resource/after-ecj/BuilderComplex.java18
-rw-r--r--test/transform/resource/after-ecj/BuilderCustomName.java37
-rw-r--r--test/transform/resource/before/BuilderComplex.java1
-rw-r--r--test/transform/resource/before/BuilderCustomName.java7
-rw-r--r--test/transform/resource/before/BuilderJavadoc.java5
7 files changed, 112 insertions, 21 deletions
diff --git a/test/transform/resource/after-delombok/BuilderComplex.java b/test/transform/resource/after-delombok/BuilderComplex.java
index a89d7114..c63d7b59 100644
--- a/test/transform/resource/after-delombok/BuilderComplex.java
+++ b/test/transform/resource/after-delombok/BuilderComplex.java
@@ -3,7 +3,7 @@ class BuilderComplex {
private static <T extends Number> void testVoidWithGenerics(T number, int arg2, String arg3, BuilderComplex selfRef) {
}
@java.lang.SuppressWarnings("all")
- public static class VoidBuilder<T extends Number> {
+ public static class TestVoidName<T extends Number> {
@java.lang.SuppressWarnings("all")
private T number;
@java.lang.SuppressWarnings("all")
@@ -13,25 +13,25 @@ class BuilderComplex {
@java.lang.SuppressWarnings("all")
private BuilderComplex selfRef;
@java.lang.SuppressWarnings("all")
- VoidBuilder() {
+ TestVoidName() {
}
@java.lang.SuppressWarnings("all")
- public VoidBuilder<T> number(final T number) {
+ public TestVoidName<T> number(final T number) {
this.number = number;
return this;
}
@java.lang.SuppressWarnings("all")
- public VoidBuilder<T> arg2(final int arg2) {
+ public TestVoidName<T> arg2(final int arg2) {
this.arg2 = arg2;
return this;
}
@java.lang.SuppressWarnings("all")
- public VoidBuilder<T> arg3(final String arg3) {
+ public TestVoidName<T> arg3(final String arg3) {
this.arg3 = arg3;
return this;
}
@java.lang.SuppressWarnings("all")
- public VoidBuilder<T> selfRef(final BuilderComplex selfRef) {
+ public TestVoidName<T> selfRef(final BuilderComplex selfRef) {
this.selfRef = selfRef;
return this;
}
@@ -42,11 +42,11 @@ class BuilderComplex {
@java.lang.Override
@java.lang.SuppressWarnings("all")
public java.lang.String toString() {
- return "BuilderComplex.VoidBuilder(number=" + this.number + ", arg2=" + this.arg2 + ", arg3=" + this.arg3 + ", selfRef=" + this.selfRef + ")";
+ return "BuilderComplex.TestVoidName(number=" + this.number + ", arg2=" + this.arg2 + ", arg3=" + this.arg3 + ", selfRef=" + this.selfRef + ")";
}
}
@java.lang.SuppressWarnings("all")
- public static <T extends Number> VoidBuilder<T> builder() {
- return new VoidBuilder<T>();
+ public static <T extends Number> TestVoidName<T> builder() {
+ return new TestVoidName<T>();
}
}
diff --git a/test/transform/resource/after-delombok/BuilderCustomName.java b/test/transform/resource/after-delombok/BuilderCustomName.java
new file mode 100644
index 00000000..4db08220
--- /dev/null
+++ b/test/transform/resource/after-delombok/BuilderCustomName.java
@@ -0,0 +1,47 @@
+import java.util.List;
+class BuilderCustomName<T> {
+ private final int field;
+ @java.lang.SuppressWarnings("all")
+ public static abstract class SimpleTestBuilder<T, C extends BuilderCustomName<T>, B extends SimpleTestBuilder<T, C, B>> {
+ @java.lang.SuppressWarnings("all")
+ private int field;
+ @java.lang.SuppressWarnings("all")
+ protected abstract B self();
+ @java.lang.SuppressWarnings("all")
+ public abstract C build();
+ @java.lang.SuppressWarnings("all")
+ public B field(final int field) {
+ this.field = field;
+ return self();
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "BuilderCustomName.SimpleTestBuilder(field=" + this.field + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ private static final class SimpleTestBuilderImpl<T> extends SimpleTestBuilder<T, BuilderCustomName<T>, SimpleTestBuilderImpl<T>> {
+ @java.lang.SuppressWarnings("all")
+ private SimpleTestBuilderImpl() {
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ protected SimpleTestBuilderImpl<T> self() {
+ return this;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public BuilderCustomName<T> build() {
+ return new BuilderCustomName<T>(this);
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ protected BuilderCustomName(final SimpleTestBuilder<T, ?, ?> b) {
+ this.field = b.field;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static <T> SimpleTestBuilder<T, ?, ?> builder() {
+ return new SimpleTestBuilderImpl<T>();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/BuilderComplex.java b/test/transform/resource/after-ecj/BuilderComplex.java
index 93d70fe9..23dbf058 100644
--- a/test/transform/resource/after-ecj/BuilderComplex.java
+++ b/test/transform/resource/after-ecj/BuilderComplex.java
@@ -1,27 +1,27 @@
import java.util.List;
import lombok.Builder;
class BuilderComplex {
- public static @java.lang.SuppressWarnings("all") class VoidBuilder<T extends Number> {
+ public static @java.lang.SuppressWarnings("all") class TestVoidName<T extends Number> {
private @java.lang.SuppressWarnings("all") T number;
private @java.lang.SuppressWarnings("all") int arg2;
private @java.lang.SuppressWarnings("all") String arg3;
private @java.lang.SuppressWarnings("all") BuilderComplex selfRef;
- @java.lang.SuppressWarnings("all") VoidBuilder() {
+ @java.lang.SuppressWarnings("all") TestVoidName() {
super();
}
- public @java.lang.SuppressWarnings("all") VoidBuilder<T> number(final T number) {
+ public @java.lang.SuppressWarnings("all") TestVoidName<T> number(final T number) {
this.number = number;
return this;
}
- public @java.lang.SuppressWarnings("all") VoidBuilder<T> arg2(final int arg2) {
+ public @java.lang.SuppressWarnings("all") TestVoidName<T> arg2(final int arg2) {
this.arg2 = arg2;
return this;
}
- public @java.lang.SuppressWarnings("all") VoidBuilder<T> arg3(final String arg3) {
+ public @java.lang.SuppressWarnings("all") TestVoidName<T> arg3(final String arg3) {
this.arg3 = arg3;
return this;
}
- public @java.lang.SuppressWarnings("all") VoidBuilder<T> selfRef(final BuilderComplex selfRef) {
+ public @java.lang.SuppressWarnings("all") TestVoidName<T> selfRef(final BuilderComplex selfRef) {
this.selfRef = selfRef;
return this;
}
@@ -29,7 +29,7 @@ class BuilderComplex {
BuilderComplex.<T>testVoidWithGenerics(number, arg2, arg3, selfRef);
}
public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((((((("BuilderComplex.VoidBuilder(number=" + this.number) + ", arg2=") + this.arg2) + ", arg3=") + this.arg3) + ", selfRef=") + this.selfRef) + ")");
+ return (((((((("BuilderComplex.TestVoidName(number=" + this.number) + ", arg2=") + this.arg2) + ", arg3=") + this.arg3) + ", selfRef=") + this.selfRef) + ")");
}
}
BuilderComplex() {
@@ -37,7 +37,7 @@ class BuilderComplex {
}
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>();
+ public static @java.lang.SuppressWarnings("all") <T extends Number>TestVoidName<T> builder() {
+ return new TestVoidName<T>();
}
}
diff --git a/test/transform/resource/after-ecj/BuilderCustomName.java b/test/transform/resource/after-ecj/BuilderCustomName.java
new file mode 100644
index 00000000..1067a9d1
--- /dev/null
+++ b/test/transform/resource/after-ecj/BuilderCustomName.java
@@ -0,0 +1,37 @@
+import java.util.List;
+@lombok.experimental.SuperBuilder class BuilderCustomName<T> {
+ public static abstract @java.lang.SuppressWarnings("all") class SimpleTestBuilder<T, C extends BuilderCustomName<T>, B extends SimpleTestBuilder<T, C, B>> {
+ private @java.lang.SuppressWarnings("all") int field;
+ public SimpleTestBuilder() {
+ super();
+ }
+ protected abstract @java.lang.SuppressWarnings("all") B self();
+ public abstract @java.lang.SuppressWarnings("all") C build();
+ public @java.lang.SuppressWarnings("all") B field(final int field) {
+ this.field = field;
+ return self();
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("BuilderCustomName.SimpleTestBuilder(field=" + this.field) + ")");
+ }
+ }
+ private static final @java.lang.SuppressWarnings("all") class SimpleTestBuilderImpl<T> extends SimpleTestBuilder<T, BuilderCustomName<T>, SimpleTestBuilderImpl<T>> {
+ private SimpleTestBuilderImpl() {
+ super();
+ }
+ protected @java.lang.Override @java.lang.SuppressWarnings("all") SimpleTestBuilderImpl<T> self() {
+ return this;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") BuilderCustomName<T> build() {
+ return new BuilderCustomName<T>(this);
+ }
+ }
+ private final int field;
+ protected @java.lang.SuppressWarnings("all") BuilderCustomName(final SimpleTestBuilder<T, ?, ?> b) {
+ super();
+ this.field = b.field;
+ }
+ public static @java.lang.SuppressWarnings("all") <T>SimpleTestBuilder<T, ?, ?> builder() {
+ return new SimpleTestBuilderImpl<T>();
+ }
+}
diff --git a/test/transform/resource/before/BuilderComplex.java b/test/transform/resource/before/BuilderComplex.java
index c13f5877..46f62721 100644
--- a/test/transform/resource/before/BuilderComplex.java
+++ b/test/transform/resource/before/BuilderComplex.java
@@ -1,3 +1,4 @@
+//CONF: lombok.builder.className = Test*Name
import java.util.List;
import lombok.Builder;
diff --git a/test/transform/resource/before/BuilderCustomName.java b/test/transform/resource/before/BuilderCustomName.java
new file mode 100644
index 00000000..d5709e63
--- /dev/null
+++ b/test/transform/resource/before/BuilderCustomName.java
@@ -0,0 +1,7 @@
+//CONF: lombok.builder.className = SimpleTestBuilder
+import java.util.List;
+
+@lombok.experimental.SuperBuilder
+class BuilderCustomName<T> {
+ private final int field;
+}
diff --git a/test/transform/resource/before/BuilderJavadoc.java b/test/transform/resource/before/BuilderJavadoc.java
index c2e0a6e0..390e2096 100644
--- a/test/transform/resource/before/BuilderJavadoc.java
+++ b/test/transform/resource/before/BuilderJavadoc.java
@@ -4,7 +4,7 @@ import java.util.List;
class BuilderJavadoc<T> {
/**
* basic gets only a builder setter.
- * @see #getsetwith
+ * @see #getsetwith
* @param tag is moved to the setter.
* @return tag is removed from the setter.
*/
@@ -49,6 +49,5 @@ class BuilderJavadoc<T> {
this.predefWithJavadoc = x * 100;
return this;
}
- }
-
+ }
}