diff options
Diffstat (limited to 'test/transform/resource/before')
11 files changed, 79 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(); + } +} diff --git a/test/transform/resource/before/VarComplex.java b/test/transform/resource/before/VarComplex.java index c93e177a..0f2afb2a 100644 --- a/test/transform/resource/before/VarComplex.java +++ b/test/transform/resource/before/VarComplex.java @@ -1,3 +1,4 @@ +//version :9 import lombok.var; public class VarComplex { diff --git a/test/transform/resource/before/VarInFor.java b/test/transform/resource/before/VarInFor.java index 7f7bb7a7..0c54921e 100644 --- a/test/transform/resource/before/VarInFor.java +++ b/test/transform/resource/before/VarInFor.java @@ -1,3 +1,4 @@ +//version :9 import lombok.var; public class VarInFor { diff --git a/test/transform/resource/before/VarInForOld.java b/test/transform/resource/before/VarInForOld.java index 99e83b57..a6e1333d 100644 --- a/test/transform/resource/before/VarInForOld.java +++ b/test/transform/resource/before/VarInForOld.java @@ -1,3 +1,4 @@ +//version :9 import lombok.var; public class VarInForOld { diff --git a/test/transform/resource/before/VarInForOldMulti.java b/test/transform/resource/before/VarInForOldMulti.java index e2ea9682..417076d0 100644 --- a/test/transform/resource/before/VarInForOldMulti.java +++ b/test/transform/resource/before/VarInForOldMulti.java @@ -1,3 +1,4 @@ +//version :9 //skip compare contents import lombok.var; diff --git a/test/transform/resource/before/VarModifier.java b/test/transform/resource/before/VarModifier.java index 5c68caa7..22d8f2ad 100644 --- a/test/transform/resource/before/VarModifier.java +++ b/test/transform/resource/before/VarModifier.java @@ -1,3 +1,4 @@ +//version :9 import lombok.experimental.var; public class VarModifier { diff --git a/test/transform/resource/before/VarNullInit.java b/test/transform/resource/before/VarNullInit.java index f9bb53a3..08eb4dda 100644 --- a/test/transform/resource/before/VarNullInit.java +++ b/test/transform/resource/before/VarNullInit.java @@ -1,3 +1,4 @@ +//version :9 import lombok.var; public class VarNullInit { diff --git a/test/transform/resource/before/VarWarning.java b/test/transform/resource/before/VarWarning.java index 90464d30..47b7ad3c 100644 --- a/test/transform/resource/before/VarWarning.java +++ b/test/transform/resource/before/VarWarning.java @@ -1,3 +1,4 @@ +//version :9 //CONF: lombok.var.flagUsage = WARNING import lombok.var; |