aboutsummaryrefslogtreecommitdiff
path: root/test/transform/resource/before
diff options
context:
space:
mode:
Diffstat (limited to 'test/transform/resource/before')
-rw-r--r--test/transform/resource/before/BuilderWithToBuilder.java15
-rw-r--r--test/transform/resource/before/SuperBuilderAbstractToBuilder.java20
-rw-r--r--test/transform/resource/before/SuperBuilderBasicToBuilder.java32
-rw-r--r--test/transform/resource/before/SuperBuilderWithGenericsAndToBuilder.java18
4 files changed, 72 insertions, 13 deletions
diff --git a/test/transform/resource/before/BuilderWithToBuilder.java b/test/transform/resource/before/BuilderWithToBuilder.java
index 63e16ae8..50938ab2 100644
--- a/test/transform/resource/before/BuilderWithToBuilder.java
+++ b/test/transform/resource/before/BuilderWithToBuilder.java
@@ -13,19 +13,8 @@ class BuilderWithToBuilder<T> {
class ConstructorWithToBuilder<T> {
private String mOne, mTwo;
private T foo;
- @lombok.Singular private List<T> bars;
- @Builder(toBuilder = true)
- public ConstructorWithToBuilder(String mOne, @Builder.ObtainVia(field = "foo") T bar) {
- }
-}
-@lombok.experimental.Accessors(prefix = "m")
-class StaticWithToBuilder<T, K> {
- private String mOne, mTwo;
- private T foo;
- private K bar;
- @lombok.Singular private List<T> bars;
+ @lombok.Singular private com.google.common.collect.ImmutableList<T> bars;
@Builder(toBuilder = true)
- public static <Z> StaticWithToBuilder<Z, String> test(String mOne, @Builder.ObtainVia(field = "foo") Z bar) {
- return new StaticWithToBuilder<Z, String>();
+ public ConstructorWithToBuilder(String mOne, @Builder.ObtainVia(field = "foo") T baz, com.google.common.collect.ImmutableList<T> bars) {
}
}
diff --git a/test/transform/resource/before/SuperBuilderAbstractToBuilder.java b/test/transform/resource/before/SuperBuilderAbstractToBuilder.java
new file mode 100644
index 00000000..3359829c
--- /dev/null
+++ b/test/transform/resource/before/SuperBuilderAbstractToBuilder.java
@@ -0,0 +1,20 @@
+public class SuperBuilderAbstractToBuilder {
+ @lombok.experimental.SuperBuilder(toBuilder = true)
+ public static class Parent {
+ int parentField;
+ }
+
+ @lombok.experimental.SuperBuilder(toBuilder = true)
+ public abstract static class Child extends Parent {
+ double childField;
+ }
+
+ @lombok.experimental.SuperBuilder(toBuilder = true)
+ public static class GrandChild extends Child {
+ String grandChildField;
+ }
+
+ public static void test() {
+ GrandChild x = GrandChild.builder().grandChildField("").parentField(5).childField(2.5).build().toBuilder().build();
+ }
+}
diff --git a/test/transform/resource/before/SuperBuilderBasicToBuilder.java b/test/transform/resource/before/SuperBuilderBasicToBuilder.java
new file mode 100644
index 00000000..93161443
--- /dev/null
+++ b/test/transform/resource/before/SuperBuilderBasicToBuilder.java
@@ -0,0 +1,32 @@
+import java.util.List;
+
+public class SuperBuilderBasicToBuilder {
+ @lombok.experimental.SuperBuilder(toBuilder=true)
+ public static class Parent {
+ private int field1;
+ @lombok.Builder.ObtainVia(field="field1")
+ int obtainViaField;
+ @lombok.Builder.ObtainVia(method="method")
+ int obtainViaMethod;
+ @lombok.Builder.ObtainVia(method = "staticMethod", isStatic = true)
+ String obtainViaStaticMethod;
+ @lombok.Singular List<String> items;
+
+ private int method() {
+ return 2;
+ }
+
+ private static String staticMethod(Parent instance) {
+ return "staticMethod";
+ }
+ }
+
+ @lombok.experimental.SuperBuilder(toBuilder=true)
+ public static class Child extends Parent {
+ private double field3;
+ }
+
+ public static void test() {
+ Child x = Child.builder().field3(0.0).field1(5).item("").build().toBuilder().build();
+ }
+}
diff --git a/test/transform/resource/before/SuperBuilderWithGenericsAndToBuilder.java b/test/transform/resource/before/SuperBuilderWithGenericsAndToBuilder.java
new file mode 100644
index 00000000..dae68034
--- /dev/null
+++ b/test/transform/resource/before/SuperBuilderWithGenericsAndToBuilder.java
@@ -0,0 +1,18 @@
+import java.util.List;
+
+public class SuperBuilderWithGenericsAndToBuilder {
+ @lombok.experimental.SuperBuilder(toBuilder = true)
+ public static class Parent<A> {
+ A field1;
+ @lombok.Singular List<String> items;
+ }
+
+ @lombok.experimental.SuperBuilder(toBuilder = true)
+ public static class Child<A> extends Parent<A> {
+ double field3;
+ }
+
+ public static void test() {
+ Child<Integer> x = Child.<Integer>builder().field3(0.0).field1(5).item("").build().toBuilder().build();
+ }
+}