From 279ceaa72795ea7b427ab37535892e3c5cbde958 Mon Sep 17 00:00:00 2001 From: Jan Rieke Date: Mon, 24 Sep 2018 09:26:37 +0200 Subject: SuperBuilder toBuilder with generics (ecj) --- .../SuperBuilderWithGenericsAndToBuilder.java | 24 ++++++++-------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'test') diff --git a/test/transform/resource/after-ecj/SuperBuilderWithGenericsAndToBuilder.java b/test/transform/resource/after-ecj/SuperBuilderWithGenericsAndToBuilder.java index fcdadb3b..40e3bdca 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithGenericsAndToBuilder.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithGenericsAndToBuilder.java @@ -1,12 +1,6 @@ import java.util.List; - -import SuperBuilderBasicToBuilder.Child; -import SuperBuilderBasicToBuilder.Parent; -import SuperBuilderBasicToBuilder.Child.ChildBuilder; -import SuperBuilderBasicToBuilder.Child.ChildBuilderImpl; -import SuperBuilderBasicToBuilder.Parent.ParentBuilder; public class SuperBuilderWithGenericsAndToBuilder { - public static @lombok.experimental.SuperBuilder class Parent { + public static @lombok.experimental.SuperBuilder(toBuilder = true) class Parent { public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder, B extends ParentBuilder> { private @java.lang.SuppressWarnings("all") A field1; private @java.lang.SuppressWarnings("all") java.util.ArrayList items; @@ -14,10 +8,10 @@ public class SuperBuilderWithGenericsAndToBuilder { super(); } protected @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { - ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); - return self(); - } - private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final Parent instance, final ParentBuilder b) { + ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final Parent instance, final ParentBuilder b) { b.field1(instance.field1); b.items(((instance.items == null) ? java.util.Collections.emptyList() : instance.items)); } @@ -77,14 +71,14 @@ public class SuperBuilderWithGenericsAndToBuilder { } this.items = items; } - public @java.lang.SuppressWarnings("all") ParentBuilder toBuilder() { + public @java.lang.SuppressWarnings("all") ParentBuilder toBuilder() { return new ParentBuilderImpl().$fillValuesFrom(this); } public static @java.lang.SuppressWarnings("all") ParentBuilder builder() { return new ParentBuilderImpl(); } } - public static @lombok.experimental.SuperBuilder class Child extends Parent { + public static @lombok.experimental.SuperBuilder(toBuilder = true) class Child extends Parent { public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder, B extends ChildBuilder> extends Parent.ParentBuilder { private @java.lang.SuppressWarnings("all") double field3; public ChildBuilder() { @@ -95,7 +89,7 @@ public class SuperBuilderWithGenericsAndToBuilder { ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); return self(); } - private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final Child instance, final ChildBuilder b) { + private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final Child instance, final ChildBuilder b) { b.field3(instance.field3); } protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); @@ -131,7 +125,7 @@ public class SuperBuilderWithGenericsAndToBuilder { return new ChildBuilderImpl(); } } - public SuperBuilderWithGenerics() { + public SuperBuilderWithGenericsAndToBuilder() { super(); } public static void test() { -- cgit