From a2b884c71194c780d37ccbd84561abd6a0f63741 Mon Sep 17 00:00:00 2001 From: Jan Rieke Date: Tue, 11 Sep 2018 20:37:16 +0200 Subject: SuperBuilder: fixed ObtainVia --- .../after-ecj/SuperBuilderBasicToBuilder.java | 33 ++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'test/transform/resource/after-ecj') diff --git a/test/transform/resource/after-ecj/SuperBuilderBasicToBuilder.java b/test/transform/resource/after-ecj/SuperBuilderBasicToBuilder.java index 2b294d65..974d933d 100644 --- a/test/transform/resource/after-ecj/SuperBuilderBasicToBuilder.java +++ b/test/transform/resource/after-ecj/SuperBuilderBasicToBuilder.java @@ -1,15 +1,20 @@ import java.util.List; - public class SuperBuilderBasicToBuilder { public static @lombok.experimental.SuperBuilder(toBuilder = true) class Parent { public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder> { private @java.lang.SuppressWarnings("all") int field1; + private @java.lang.SuppressWarnings("all") int obtainViaField; + private @java.lang.SuppressWarnings("all") int obtainViaMethod; + private @java.lang.SuppressWarnings("all") String obtainViaStaticMethod; private @java.lang.SuppressWarnings("all") java.util.ArrayList items; public ParentBuilder() { super(); } protected @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { field1(instance.field1); + obtainViaField(instance.field1); + obtainViaMethod(instance.method()); + obtainViaStaticMethod(Parent.staticMethod(instance)); items(((instance.items == null) ? java.util.Collections.emptyList() : instance.items)); return self(); } @@ -19,6 +24,18 @@ public class SuperBuilderBasicToBuilder { this.field1 = field1; return self(); } + public @java.lang.SuppressWarnings("all") B obtainViaField(final int obtainViaField) { + this.obtainViaField = obtainViaField; + return self(); + } + public @java.lang.SuppressWarnings("all") B obtainViaMethod(final int obtainViaMethod) { + this.obtainViaMethod = obtainViaMethod; + return self(); + } + public @java.lang.SuppressWarnings("all") B obtainViaStaticMethod(final String obtainViaStaticMethod) { + this.obtainViaStaticMethod = obtainViaStaticMethod; + return self(); + } public @java.lang.SuppressWarnings("all") B item(String item) { if ((this.items == null)) this.items = new java.util.ArrayList(); @@ -37,7 +54,7 @@ public class SuperBuilderBasicToBuilder { return self(); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("SuperBuilderBasicToBuilder.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")"); + return (((((((((("SuperBuilderBasicToBuilder.Parent.ParentBuilder(field1=" + this.field1) + ", obtainViaField=") + this.obtainViaField) + ", obtainViaMethod=") + this.obtainViaMethod) + ", obtainViaStaticMethod=") + this.obtainViaStaticMethod) + ", items=") + this.items) + ")"); } } private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends ParentBuilder { @@ -52,10 +69,22 @@ public class SuperBuilderBasicToBuilder { } } 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 items; + int method() { + return 2; + } + private static String staticMethod(Parent instance) { + return "staticMethod"; + } protected @java.lang.SuppressWarnings("all") Parent(final ParentBuilder b) { super(); this.field1 = b.field1; + this.obtainViaField = b.obtainViaField; + this.obtainViaMethod = b.obtainViaMethod; + this.obtainViaStaticMethod = b.obtainViaStaticMethod; java.util.List items; switch (((b.items == null) ? 0 : b.items.size())) { case 0 : -- cgit