diff options
3 files changed, 35 insertions, 21 deletions
diff --git a/test/transform/resource/after-delombok/SuperBuilderBasicToBuilder.java b/test/transform/resource/after-delombok/SuperBuilderBasicToBuilder.java index 7d34d28a..e44b3aeb 100644 --- a/test/transform/resource/after-delombok/SuperBuilderBasicToBuilder.java +++ b/test/transform/resource/after-delombok/SuperBuilderBasicToBuilder.java @@ -1,12 +1,12 @@ import java.util.List;
public class SuperBuilderBasicToBuilder {
public static class Parent {
- int field1;
+ private int field1;
int obtainViaField;
int obtainViaMethod;
String obtainViaStaticMethod;
List<String> items;
- int method() {
+ private int method() {
return 2;
}
private static String staticMethod(Parent instance) {
@@ -26,11 +26,7 @@ public class SuperBuilderBasicToBuilder { private java.util.ArrayList<String> items;
@java.lang.SuppressWarnings("all")
protected B $fillValuesFrom(final C instance) {
- this.field1(instance.field1);
- this.obtainViaField(instance.field1);
- this.obtainViaMethod(instance.method());
- this.obtainViaStaticMethod(Parent.staticMethod(instance));
- this.items(instance.items == null ? java.util.Collections.emptyList() : instance.items);
+ ParentBuilderImpl.$fillValuesFromInto(instance, this);
return self();
}
@java.lang.SuppressWarnings("all")
@@ -83,6 +79,14 @@ public class SuperBuilderBasicToBuilder { @java.lang.SuppressWarnings("all")
private static final class ParentBuilderImpl extends ParentBuilder<Parent, ParentBuilderImpl> {
@java.lang.SuppressWarnings("all")
+ private static void $fillValuesFromInto(Parent instance, ParentBuilder<?,?> b) {
+ b.field1(instance.field1);
+ b.obtainViaField(instance.field1);
+ b.obtainViaMethod(instance.method());
+ b.obtainViaStaticMethod(Parent.staticMethod(instance));
+ b.items(instance.items == null ? java.util.Collections.emptyList() : instance.items);
+ }
+ @java.lang.SuppressWarnings("all")
private ParentBuilderImpl() {
}
@java.lang.Override
@@ -125,7 +129,7 @@ public class SuperBuilderBasicToBuilder { }
}
public static class Child extends Parent {
- double field3;
+ private double field3;
@java.lang.SuppressWarnings("all")
public static abstract class ChildBuilder<C extends Child, B extends ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> {
@java.lang.SuppressWarnings("all")
@@ -134,7 +138,7 @@ public class SuperBuilderBasicToBuilder { @java.lang.SuppressWarnings("all")
protected B $fillValuesFrom(final C instance) {
super.$fillValuesFrom(instance);
- this.field3(instance.field3);
+ ChildBuilderImpl.$fillValuesFromInto(instance, this);
return self();
}
@java.lang.Override
@@ -157,6 +161,10 @@ public class SuperBuilderBasicToBuilder { @java.lang.SuppressWarnings("all")
private static final class ChildBuilderImpl extends ChildBuilder<Child, ChildBuilderImpl> {
@java.lang.SuppressWarnings("all")
+ private static void $fillValuesFromInto(Parent instance, ParentBuilder<?,?> b) {
+ b.field3(instance.field3);
+ }
+ @java.lang.SuppressWarnings("all")
private ChildBuilderImpl() {
}
@java.lang.Override
diff --git a/test/transform/resource/after-ecj/SuperBuilderBasicToBuilder.java b/test/transform/resource/after-ecj/SuperBuilderBasicToBuilder.java index 974d933d..6ff2849d 100644 --- a/test/transform/resource/after-ecj/SuperBuilderBasicToBuilder.java +++ b/test/transform/resource/after-ecj/SuperBuilderBasicToBuilder.java @@ -11,11 +11,7 @@ public class SuperBuilderBasicToBuilder { 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));
+ ParentBuilderImpl.$fillValuesFromInto(instance, this);
return self();
}
protected abstract @java.lang.SuppressWarnings("all") B self();
@@ -61,6 +57,13 @@ public class SuperBuilderBasicToBuilder { private ParentBuilderImpl() {
super();
}
+ private static @java.lang.SuppressWarnings("all") void $fillValuesFromInto(Parent instance, ParentBuilder<?,?> b) {
+ b.field1(instance.field1);
+ b.obtainViaField(instance.field1);
+ b.obtainViaMethod(instance.method());
+ b.obtainViaStaticMethod(Parent.staticMethod(instance));
+ b.items(((instance.items == null) ? java.util.Collections.emptyList() : instance.items));
+ }
protected @java.lang.Override @java.lang.SuppressWarnings("all") ParentBuilderImpl self() {
return this;
}
@@ -68,12 +71,12 @@ public class SuperBuilderBasicToBuilder { return new Parent(this);
}
}
- int field1;
+ 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;
- int method() {
+ private int method() {
return 2;
}
private static String staticMethod(Parent instance) {
@@ -113,7 +116,7 @@ public class SuperBuilderBasicToBuilder { }
protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) {
super.$fillValuesFrom(instance);
- field3(instance.field3);
+ ChildBuilderImpl.$fillValuesFromInto(instance, this);
return self();
}
protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self();
@@ -130,6 +133,9 @@ public class SuperBuilderBasicToBuilder { private ChildBuilderImpl() {
super();
}
+ private static @java.lang.SuppressWarnings("all") void $fillValuesFromInto(Child instance, ChildBuilder<?,?> b) {
+ b.field3(instance.field3);
+ }
protected @java.lang.Override @java.lang.SuppressWarnings("all") ChildBuilderImpl self() {
return this;
}
@@ -137,7 +143,7 @@ public class SuperBuilderBasicToBuilder { return new Child(this);
}
}
- double field3;
+ private double field3;
protected @java.lang.SuppressWarnings("all") Child(final ChildBuilder<?, ?> b) {
super(b);
this.field3 = b.field3;
diff --git a/test/transform/resource/before/SuperBuilderBasicToBuilder.java b/test/transform/resource/before/SuperBuilderBasicToBuilder.java index 4dfac613..93161443 100644 --- a/test/transform/resource/before/SuperBuilderBasicToBuilder.java +++ b/test/transform/resource/before/SuperBuilderBasicToBuilder.java @@ -3,7 +3,7 @@ import java.util.List; public class SuperBuilderBasicToBuilder { @lombok.experimental.SuperBuilder(toBuilder=true) public static class Parent { - int field1; + private int field1; @lombok.Builder.ObtainVia(field="field1") int obtainViaField; @lombok.Builder.ObtainVia(method="method") @@ -12,7 +12,7 @@ public class SuperBuilderBasicToBuilder { String obtainViaStaticMethod; @lombok.Singular List<String> items; - int method() { + private int method() { return 2; } @@ -23,7 +23,7 @@ public class SuperBuilderBasicToBuilder { @lombok.experimental.SuperBuilder(toBuilder=true) public static class Child extends Parent { - double field3; + private double field3; } public static void test() { |