From c1bf4ec3b66cf6632cfd3e554d59ad4f8ad1b3b8 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Sat, 13 Mar 2021 04:31:51 +0100 Subject: [trivial] just fixing line endings - no other changes --- .../JacksonizedSuperBuilderSimple.java | 118 +++--- .../after-delombok/SuperBuilderAbstract.java | 276 ++++++------- .../SuperBuilderAbstractToBuilder.java | 354 ++++++++--------- .../resource/after-delombok/SuperBuilderBasic.java | 284 +++++++------- .../after-delombok/SuperBuilderBasicToBuilder.java | 432 ++++++++++----------- .../after-delombok/SuperBuilderCustomized.java | 206 +++++----- .../SuperBuilderCustomizedWithSetterPrefix.java | 100 ++--- .../after-delombok/SuperBuilderNameClashes.java | 254 ++++++------ .../SuperBuilderNestedGenericTypes.java | 82 ++-- .../SuperBuilderWithCustomBuilderMethod.java | 282 +++++++------- .../after-delombok/SuperBuilderWithDefaults.java | 286 +++++++------- .../after-delombok/SuperBuilderWithGenerics.java | 284 +++++++------- .../after-delombok/SuperBuilderWithGenerics2.java | 284 +++++++------- .../SuperBuilderWithGenericsAndToBuilder.java | 376 +++++++++--------- .../after-delombok/SuperBuilderWithNonNull.java | 260 ++++++------- .../SuperBuilderWithSetterPrefix.java | 432 ++++++++++----------- .../resource/after-ecj/SuperBuilderAbstract.java | 222 +++++------ .../after-ecj/SuperBuilderAbstractToBuilder.java | 280 ++++++------- .../resource/after-ecj/SuperBuilderBasic.java | 244 ++++++------ .../after-ecj/SuperBuilderBasicToBuilder.java | 366 ++++++++--------- .../resource/after-ecj/SuperBuilderCustomized.java | 182 ++++----- .../SuperBuilderCustomizedWithSetterPrefix.java | 90 ++--- .../after-ecj/SuperBuilderNestedGenericTypes.java | 72 ++-- .../SuperBuilderWithCustomBuilderMethod.java | 244 ++++++------ .../after-ecj/SuperBuilderWithDefaults.java | 242 ++++++------ .../after-ecj/SuperBuilderWithGenerics.java | 244 ++++++------ .../after-ecj/SuperBuilderWithGenerics2.java | 244 ++++++------ .../SuperBuilderWithGenericsAndToBuilder.java | 324 ++++++++-------- .../after-ecj/SuperBuilderWithNonNull.java | 222 +++++------ .../after-ecj/SuperBuilderWithSetterPrefix.java | 366 ++++++++--------- .../resource/after-ecj/ValueCallSuper.java | 64 +-- test/transform/resource/before/ValueCallSuper.java | 14 +- 32 files changed, 3865 insertions(+), 3865 deletions(-) (limited to 'test/transform') diff --git a/test/transform/resource/after-delombok/JacksonizedSuperBuilderSimple.java b/test/transform/resource/after-delombok/JacksonizedSuperBuilderSimple.java index 5cd35b7e..88a51f41 100644 --- a/test/transform/resource/after-delombok/JacksonizedSuperBuilderSimple.java +++ b/test/transform/resource/after-delombok/JacksonizedSuperBuilderSimple.java @@ -1,59 +1,59 @@ -//version 8: Jackson deps are at least Java7+. -public class JacksonizedSuperBuilderSimple { - @com.fasterxml.jackson.annotation.JsonIgnoreProperties(ignoreUnknown = true) - @com.fasterxml.jackson.databind.annotation.JsonDeserialize(builder = JacksonizedSuperBuilderSimple.Parent.ParentBuilderImpl.class) - public static class Parent { - int field1; - @java.lang.SuppressWarnings("all") - public static abstract class ParentBuilder> { - @java.lang.SuppressWarnings("all") - private int field1; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B field1(final int field1) { - this.field1 = field1; - return self(); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "JacksonizedSuperBuilderSimple.Parent.ParentBuilder(field1=" + this.field1 + ")"; - } - } - @java.lang.SuppressWarnings("all") - @com.fasterxml.jackson.annotation.JsonIgnoreProperties(ignoreUnknown = true) - @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "", buildMethodName = "build") - static final class ParentBuilderImpl extends JacksonizedSuperBuilderSimple.Parent.ParentBuilder { - @java.lang.SuppressWarnings("all") - private ParentBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected JacksonizedSuperBuilderSimple.Parent.ParentBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public JacksonizedSuperBuilderSimple.Parent build() { - return new JacksonizedSuperBuilderSimple.Parent(this); - } - } - @java.lang.SuppressWarnings("all") - protected Parent(final JacksonizedSuperBuilderSimple.Parent.ParentBuilder b) { - this.field1 = b.field1; - } - @java.lang.SuppressWarnings("all") - public static JacksonizedSuperBuilderSimple.Parent.ParentBuilder builder() { - return new JacksonizedSuperBuilderSimple.Parent.ParentBuilderImpl(); - } - } - public static void test() { - Parent x = Parent.builder().field1(5).build(); - } -} +//version 8: Jackson deps are at least Java7+. +public class JacksonizedSuperBuilderSimple { + @com.fasterxml.jackson.annotation.JsonIgnoreProperties(ignoreUnknown = true) + @com.fasterxml.jackson.databind.annotation.JsonDeserialize(builder = JacksonizedSuperBuilderSimple.Parent.ParentBuilderImpl.class) + public static class Parent { + int field1; + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder> { + @java.lang.SuppressWarnings("all") + private int field1; + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B field1(final int field1) { + this.field1 = field1; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "JacksonizedSuperBuilderSimple.Parent.ParentBuilder(field1=" + this.field1 + ")"; + } + } + @java.lang.SuppressWarnings("all") + @com.fasterxml.jackson.annotation.JsonIgnoreProperties(ignoreUnknown = true) + @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "", buildMethodName = "build") + static final class ParentBuilderImpl extends JacksonizedSuperBuilderSimple.Parent.ParentBuilder { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected JacksonizedSuperBuilderSimple.Parent.ParentBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public JacksonizedSuperBuilderSimple.Parent build() { + return new JacksonizedSuperBuilderSimple.Parent(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final JacksonizedSuperBuilderSimple.Parent.ParentBuilder b) { + this.field1 = b.field1; + } + @java.lang.SuppressWarnings("all") + public static JacksonizedSuperBuilderSimple.Parent.ParentBuilder builder() { + return new JacksonizedSuperBuilderSimple.Parent.ParentBuilderImpl(); + } + } + public static void test() { + Parent x = Parent.builder().field1(5).build(); + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderAbstract.java b/test/transform/resource/after-delombok/SuperBuilderAbstract.java index 5fa0b1a0..727c5beb 100644 --- a/test/transform/resource/after-delombok/SuperBuilderAbstract.java +++ b/test/transform/resource/after-delombok/SuperBuilderAbstract.java @@ -1,138 +1,138 @@ -public class SuperBuilderAbstract { - public static class Parent { - int parentField; - @java.lang.SuppressWarnings("all") - public static abstract class ParentBuilder> { - @java.lang.SuppressWarnings("all") - private int parentField; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B parentField(final int parentField) { - this.parentField = parentField; - return self(); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderAbstract.Parent.ParentBuilder(parentField=" + this.parentField + ")"; - } - } - @java.lang.SuppressWarnings("all") - private static final class ParentBuilderImpl extends SuperBuilderAbstract.Parent.ParentBuilder { - @java.lang.SuppressWarnings("all") - private ParentBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderAbstract.Parent.ParentBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public SuperBuilderAbstract.Parent build() { - return new SuperBuilderAbstract.Parent(this); - } - } - @java.lang.SuppressWarnings("all") - protected Parent(final SuperBuilderAbstract.Parent.ParentBuilder b) { - this.parentField = b.parentField; - } - @java.lang.SuppressWarnings("all") - public static SuperBuilderAbstract.Parent.ParentBuilder builder() { - return new SuperBuilderAbstract.Parent.ParentBuilderImpl(); - } - } - public static abstract class Child extends Parent { - double childField; - @java.lang.SuppressWarnings("all") - public static abstract class ChildBuilder> extends Parent.ParentBuilder { - @java.lang.SuppressWarnings("all") - private double childField; - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B childField(final double childField) { - this.childField = childField; - return self(); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderAbstract.Child.ChildBuilder(super=" + super.toString() + ", childField=" + this.childField + ")"; - } - } - @java.lang.SuppressWarnings("all") - protected Child(final SuperBuilderAbstract.Child.ChildBuilder b) { - super(b); - this.childField = b.childField; - } - } - public static class GrandChild extends Child { - String grandChildField; - @java.lang.SuppressWarnings("all") - public static abstract class GrandChildBuilder> extends Child.ChildBuilder { - @java.lang.SuppressWarnings("all") - private String grandChildField; - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B grandChildField(final String grandChildField) { - this.grandChildField = grandChildField; - return self(); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderAbstract.GrandChild.GrandChildBuilder(super=" + super.toString() + ", grandChildField=" + this.grandChildField + ")"; - } - } - @java.lang.SuppressWarnings("all") - private static final class GrandChildBuilderImpl extends SuperBuilderAbstract.GrandChild.GrandChildBuilder { - @java.lang.SuppressWarnings("all") - private GrandChildBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public SuperBuilderAbstract.GrandChild build() { - return new SuperBuilderAbstract.GrandChild(this); - } - } - @java.lang.SuppressWarnings("all") - protected GrandChild(final SuperBuilderAbstract.GrandChild.GrandChildBuilder b) { - super(b); - this.grandChildField = b.grandChildField; - } - @java.lang.SuppressWarnings("all") - public static SuperBuilderAbstract.GrandChild.GrandChildBuilder builder() { - return new SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl(); - } - } - public static void test() { - GrandChild x = GrandChild.builder().grandChildField("").parentField(5).childField(2.5).build(); - } -} +public class SuperBuilderAbstract { + public static class Parent { + int parentField; + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder> { + @java.lang.SuppressWarnings("all") + private int parentField; + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B parentField(final int parentField) { + this.parentField = parentField; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderAbstract.Parent.ParentBuilder(parentField=" + this.parentField + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl extends SuperBuilderAbstract.Parent.ParentBuilder { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderAbstract.Parent.ParentBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderAbstract.Parent build() { + return new SuperBuilderAbstract.Parent(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderAbstract.Parent.ParentBuilder b) { + this.parentField = b.parentField; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderAbstract.Parent.ParentBuilder builder() { + return new SuperBuilderAbstract.Parent.ParentBuilderImpl(); + } + } + public static abstract class Child extends Parent { + double childField; + @java.lang.SuppressWarnings("all") + public static abstract class ChildBuilder> extends Parent.ParentBuilder { + @java.lang.SuppressWarnings("all") + private double childField; + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.Override + @java.lang.SuppressWarnings("all") + public abstract C build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B childField(final double childField) { + this.childField = childField; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderAbstract.Child.ChildBuilder(super=" + super.toString() + ", childField=" + this.childField + ")"; + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderAbstract.Child.ChildBuilder b) { + super(b); + this.childField = b.childField; + } + } + public static class GrandChild extends Child { + String grandChildField; + @java.lang.SuppressWarnings("all") + public static abstract class GrandChildBuilder> extends Child.ChildBuilder { + @java.lang.SuppressWarnings("all") + private String grandChildField; + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.Override + @java.lang.SuppressWarnings("all") + public abstract C build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B grandChildField(final String grandChildField) { + this.grandChildField = grandChildField; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderAbstract.GrandChild.GrandChildBuilder(super=" + super.toString() + ", grandChildField=" + this.grandChildField + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class GrandChildBuilderImpl extends SuperBuilderAbstract.GrandChild.GrandChildBuilder { + @java.lang.SuppressWarnings("all") + private GrandChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderAbstract.GrandChild build() { + return new SuperBuilderAbstract.GrandChild(this); + } + } + @java.lang.SuppressWarnings("all") + protected GrandChild(final SuperBuilderAbstract.GrandChild.GrandChildBuilder b) { + super(b); + this.grandChildField = b.grandChildField; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderAbstract.GrandChild.GrandChildBuilder builder() { + return new SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl(); + } + } + public static void test() { + GrandChild x = GrandChild.builder().grandChildField("").parentField(5).childField(2.5).build(); + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderAbstractToBuilder.java b/test/transform/resource/after-delombok/SuperBuilderAbstractToBuilder.java index e5c11562..53962c60 100644 --- a/test/transform/resource/after-delombok/SuperBuilderAbstractToBuilder.java +++ b/test/transform/resource/after-delombok/SuperBuilderAbstractToBuilder.java @@ -1,177 +1,177 @@ -public class SuperBuilderAbstractToBuilder { - public static class Parent { - int parentField; - @java.lang.SuppressWarnings("all") - public static abstract class ParentBuilder> { - @java.lang.SuppressWarnings("all") - private int parentField; - @java.lang.SuppressWarnings("all") - protected B $fillValuesFrom(final C instance) { - SuperBuilderAbstractToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); - return self(); - } - @java.lang.SuppressWarnings("all") - private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderAbstractToBuilder.Parent instance, final SuperBuilderAbstractToBuilder.Parent.ParentBuilder b) { - b.parentField(instance.parentField); - } - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B parentField(final int parentField) { - this.parentField = parentField; - return self(); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderAbstractToBuilder.Parent.ParentBuilder(parentField=" + this.parentField + ")"; - } - } - @java.lang.SuppressWarnings("all") - private static final class ParentBuilderImpl extends SuperBuilderAbstractToBuilder.Parent.ParentBuilder { - @java.lang.SuppressWarnings("all") - private ParentBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public SuperBuilderAbstractToBuilder.Parent build() { - return new SuperBuilderAbstractToBuilder.Parent(this); - } - } - @java.lang.SuppressWarnings("all") - protected Parent(final SuperBuilderAbstractToBuilder.Parent.ParentBuilder b) { - this.parentField = b.parentField; - } - @java.lang.SuppressWarnings("all") - public static SuperBuilderAbstractToBuilder.Parent.ParentBuilder builder() { - return new SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl(); - } - @java.lang.SuppressWarnings("all") - public SuperBuilderAbstractToBuilder.Parent.ParentBuilder toBuilder() { - return new SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl().$fillValuesFrom(this); - } - } - public static abstract class Child extends Parent { - double childField; - @java.lang.SuppressWarnings("all") - public static abstract class ChildBuilder> extends Parent.ParentBuilder { - @java.lang.SuppressWarnings("all") - private double childField; - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected B $fillValuesFrom(final C instance) { - super.$fillValuesFrom(instance); - SuperBuilderAbstractToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); - return self(); - } - @java.lang.SuppressWarnings("all") - private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderAbstractToBuilder.Child instance, final SuperBuilderAbstractToBuilder.Child.ChildBuilder b) { - b.childField(instance.childField); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B childField(final double childField) { - this.childField = childField; - return self(); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderAbstractToBuilder.Child.ChildBuilder(super=" + super.toString() + ", childField=" + this.childField + ")"; - } - } - @java.lang.SuppressWarnings("all") - protected Child(final SuperBuilderAbstractToBuilder.Child.ChildBuilder b) { - super(b); - this.childField = b.childField; - } - } - public static class GrandChild extends Child { - String grandChildField; - @java.lang.SuppressWarnings("all") - public static abstract class GrandChildBuilder> extends Child.ChildBuilder { - @java.lang.SuppressWarnings("all") - private String grandChildField; - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected B $fillValuesFrom(final C instance) { - super.$fillValuesFrom(instance); - SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); - return self(); - } - @java.lang.SuppressWarnings("all") - private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderAbstractToBuilder.GrandChild instance, final SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder b) { - b.grandChildField(instance.grandChildField); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B grandChildField(final String grandChildField) { - this.grandChildField = grandChildField; - return self(); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder(super=" + super.toString() + ", grandChildField=" + this.grandChildField + ")"; - } - } - @java.lang.SuppressWarnings("all") - private static final class GrandChildBuilderImpl extends SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder { - @java.lang.SuppressWarnings("all") - private GrandChildBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public SuperBuilderAbstractToBuilder.GrandChild build() { - return new SuperBuilderAbstractToBuilder.GrandChild(this); - } - } - @java.lang.SuppressWarnings("all") - protected GrandChild(final SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder b) { - super(b); - this.grandChildField = b.grandChildField; - } - @java.lang.SuppressWarnings("all") - public static SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder builder() { - return new SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl(); - } - @java.lang.SuppressWarnings("all") - public SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder toBuilder() { - return new SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl().$fillValuesFrom(this); - } - } - public static void test() { - GrandChild x = GrandChild.builder().grandChildField("").parentField(5).childField(2.5).build().toBuilder().build(); - } -} +public class SuperBuilderAbstractToBuilder { + public static class Parent { + int parentField; + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder> { + @java.lang.SuppressWarnings("all") + private int parentField; + @java.lang.SuppressWarnings("all") + protected B $fillValuesFrom(final C instance) { + SuperBuilderAbstractToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + @java.lang.SuppressWarnings("all") + private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderAbstractToBuilder.Parent instance, final SuperBuilderAbstractToBuilder.Parent.ParentBuilder b) { + b.parentField(instance.parentField); + } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B parentField(final int parentField) { + this.parentField = parentField; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderAbstractToBuilder.Parent.ParentBuilder(parentField=" + this.parentField + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl extends SuperBuilderAbstractToBuilder.Parent.ParentBuilder { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderAbstractToBuilder.Parent build() { + return new SuperBuilderAbstractToBuilder.Parent(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderAbstractToBuilder.Parent.ParentBuilder b) { + this.parentField = b.parentField; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderAbstractToBuilder.Parent.ParentBuilder builder() { + return new SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl(); + } + @java.lang.SuppressWarnings("all") + public SuperBuilderAbstractToBuilder.Parent.ParentBuilder toBuilder() { + return new SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl().$fillValuesFrom(this); + } + } + public static abstract class Child extends Parent { + double childField; + @java.lang.SuppressWarnings("all") + public static abstract class ChildBuilder> extends Parent.ParentBuilder { + @java.lang.SuppressWarnings("all") + private double childField; + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected B $fillValuesFrom(final C instance) { + super.$fillValuesFrom(instance); + SuperBuilderAbstractToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + @java.lang.SuppressWarnings("all") + private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderAbstractToBuilder.Child instance, final SuperBuilderAbstractToBuilder.Child.ChildBuilder b) { + b.childField(instance.childField); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.Override + @java.lang.SuppressWarnings("all") + public abstract C build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B childField(final double childField) { + this.childField = childField; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderAbstractToBuilder.Child.ChildBuilder(super=" + super.toString() + ", childField=" + this.childField + ")"; + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderAbstractToBuilder.Child.ChildBuilder b) { + super(b); + this.childField = b.childField; + } + } + public static class GrandChild extends Child { + String grandChildField; + @java.lang.SuppressWarnings("all") + public static abstract class GrandChildBuilder> extends Child.ChildBuilder { + @java.lang.SuppressWarnings("all") + private String grandChildField; + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected B $fillValuesFrom(final C instance) { + super.$fillValuesFrom(instance); + SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + @java.lang.SuppressWarnings("all") + private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderAbstractToBuilder.GrandChild instance, final SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder b) { + b.grandChildField(instance.grandChildField); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.Override + @java.lang.SuppressWarnings("all") + public abstract C build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B grandChildField(final String grandChildField) { + this.grandChildField = grandChildField; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder(super=" + super.toString() + ", grandChildField=" + this.grandChildField + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class GrandChildBuilderImpl extends SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder { + @java.lang.SuppressWarnings("all") + private GrandChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderAbstractToBuilder.GrandChild build() { + return new SuperBuilderAbstractToBuilder.GrandChild(this); + } + } + @java.lang.SuppressWarnings("all") + protected GrandChild(final SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder b) { + super(b); + this.grandChildField = b.grandChildField; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder builder() { + return new SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl(); + } + @java.lang.SuppressWarnings("all") + public SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder toBuilder() { + return new SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl().$fillValuesFrom(this); + } + } + public static void test() { + GrandChild x = GrandChild.builder().grandChildField("").parentField(5).childField(2.5).build().toBuilder().build(); + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderBasic.java b/test/transform/resource/after-delombok/SuperBuilderBasic.java index 482ead86..7fff2ef8 100644 --- a/test/transform/resource/after-delombok/SuperBuilderBasic.java +++ b/test/transform/resource/after-delombok/SuperBuilderBasic.java @@ -1,142 +1,142 @@ -import java.util.List; -public class SuperBuilderBasic { - public static class Parent { - int field1; - List items; - @java.lang.SuppressWarnings("all") - public static abstract class ParentBuilder> { - @java.lang.SuppressWarnings("all") - private int field1; - @java.lang.SuppressWarnings("all") - private java.util.ArrayList items; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B field1(final int field1) { - this.field1 = field1; - return self(); - } - @java.lang.SuppressWarnings("all") - public B item(final String item) { - if (this.items == null) this.items = new java.util.ArrayList(); - this.items.add(item); - return self(); - } - @java.lang.SuppressWarnings("all") - public B items(final java.util.Collection items) { - if (items == null) { - throw new java.lang.NullPointerException("items cannot be null"); - } - if (this.items == null) this.items = new java.util.ArrayList(); - this.items.addAll(items); - return self(); - } - @java.lang.SuppressWarnings("all") - public B clearItems() { - if (this.items != null) this.items.clear(); - return self(); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderBasic.Parent.ParentBuilder(field1=" + this.field1 + ", items=" + this.items + ")"; - } - } - @java.lang.SuppressWarnings("all") - private static final class ParentBuilderImpl extends SuperBuilderBasic.Parent.ParentBuilder { - @java.lang.SuppressWarnings("all") - private ParentBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderBasic.Parent.ParentBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public SuperBuilderBasic.Parent build() { - return new SuperBuilderBasic.Parent(this); - } - } - @java.lang.SuppressWarnings("all") - protected Parent(final SuperBuilderBasic.Parent.ParentBuilder b) { - this.field1 = b.field1; - java.util.List items; - switch (b.items == null ? 0 : b.items.size()) { - case 0: - items = java.util.Collections.emptyList(); - break; - case 1: - items = java.util.Collections.singletonList(b.items.get(0)); - break; - default: - items = java.util.Collections.unmodifiableList(new java.util.ArrayList(b.items)); - } - this.items = items; - } - @java.lang.SuppressWarnings("all") - public static SuperBuilderBasic.Parent.ParentBuilder builder() { - return new SuperBuilderBasic.Parent.ParentBuilderImpl(); - } - } - public static class Child extends SuperBuilderBasic.Parent { - double field3; - @java.lang.SuppressWarnings("all") - public static abstract class ChildBuilder> extends SuperBuilderBasic.Parent.ParentBuilder { - @java.lang.SuppressWarnings("all") - private double field3; - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B field3(final double field3) { - this.field3 = field3; - return self(); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderBasic.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; - } - } - @java.lang.SuppressWarnings("all") - private static final class ChildBuilderImpl extends SuperBuilderBasic.Child.ChildBuilder { - @java.lang.SuppressWarnings("all") - private ChildBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderBasic.Child.ChildBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public SuperBuilderBasic.Child build() { - return new SuperBuilderBasic.Child(this); - } - } - @java.lang.SuppressWarnings("all") - protected Child(final SuperBuilderBasic.Child.ChildBuilder b) { - super(b); - this.field3 = b.field3; - } - @java.lang.SuppressWarnings("all") - public static SuperBuilderBasic.Child.ChildBuilder builder() { - return new SuperBuilderBasic.Child.ChildBuilderImpl(); - } - } - public static void test() { - Child x = Child.builder().field3(0.0).field1(5).item("").build(); - } -} +import java.util.List; +public class SuperBuilderBasic { + public static class Parent { + int field1; + List items; + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder> { + @java.lang.SuppressWarnings("all") + private int field1; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList items; + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B field1(final int field1) { + this.field1 = field1; + return self(); + } + @java.lang.SuppressWarnings("all") + public B item(final String item) { + if (this.items == null) this.items = new java.util.ArrayList(); + this.items.add(item); + return self(); + } + @java.lang.SuppressWarnings("all") + public B items(final java.util.Collection items) { + if (items == null) { + throw new java.lang.NullPointerException("items cannot be null"); + } + if (this.items == null) this.items = new java.util.ArrayList(); + this.items.addAll(items); + return self(); + } + @java.lang.SuppressWarnings("all") + public B clearItems() { + if (this.items != null) this.items.clear(); + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderBasic.Parent.ParentBuilder(field1=" + this.field1 + ", items=" + this.items + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl extends SuperBuilderBasic.Parent.ParentBuilder { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderBasic.Parent.ParentBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderBasic.Parent build() { + return new SuperBuilderBasic.Parent(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderBasic.Parent.ParentBuilder b) { + this.field1 = b.field1; + java.util.List items; + switch (b.items == null ? 0 : b.items.size()) { + case 0: + items = java.util.Collections.emptyList(); + break; + case 1: + items = java.util.Collections.singletonList(b.items.get(0)); + break; + default: + items = java.util.Collections.unmodifiableList(new java.util.ArrayList(b.items)); + } + this.items = items; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderBasic.Parent.ParentBuilder builder() { + return new SuperBuilderBasic.Parent.ParentBuilderImpl(); + } + } + public static class Child extends SuperBuilderBasic.Parent { + double field3; + @java.lang.SuppressWarnings("all") + public static abstract class ChildBuilder> extends SuperBuilderBasic.Parent.ParentBuilder { + @java.lang.SuppressWarnings("all") + private double field3; + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.Override + @java.lang.SuppressWarnings("all") + public abstract C build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B field3(final double field3) { + this.field3 = field3; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderBasic.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ChildBuilderImpl extends SuperBuilderBasic.Child.ChildBuilder { + @java.lang.SuppressWarnings("all") + private ChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderBasic.Child.ChildBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderBasic.Child build() { + return new SuperBuilderBasic.Child(this); + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderBasic.Child.ChildBuilder b) { + super(b); + this.field3 = b.field3; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderBasic.Child.ChildBuilder builder() { + return new SuperBuilderBasic.Child.ChildBuilderImpl(); + } + } + public static void test() { + Child x = Child.builder().field3(0.0).field1(5).item("").build(); + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderBasicToBuilder.java b/test/transform/resource/after-delombok/SuperBuilderBasicToBuilder.java index 7c1b6ff0..14e2bbf7 100644 --- a/test/transform/resource/after-delombok/SuperBuilderBasicToBuilder.java +++ b/test/transform/resource/after-delombok/SuperBuilderBasicToBuilder.java @@ -1,216 +1,216 @@ -import java.util.List; -public class SuperBuilderBasicToBuilder { - public static class Parent { - private int field1; - int obtainViaField; - int obtainViaMethod; - String obtainViaStaticMethod; - List items; - private int method() { - return 2; - } - private static String staticMethod(Parent instance) { - return "staticMethod"; - } - @java.lang.SuppressWarnings("all") - public static abstract class ParentBuilder> { - @java.lang.SuppressWarnings("all") - private int field1; - @java.lang.SuppressWarnings("all") - private int obtainViaField; - @java.lang.SuppressWarnings("all") - private int obtainViaMethod; - @java.lang.SuppressWarnings("all") - private String obtainViaStaticMethod; - @java.lang.SuppressWarnings("all") - private java.util.ArrayList items; - @java.lang.SuppressWarnings("all") - protected B $fillValuesFrom(final C instance) { - SuperBuilderBasicToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); - return self(); - } - @java.lang.SuppressWarnings("all") - private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderBasicToBuilder.Parent instance, final SuperBuilderBasicToBuilder.Parent.ParentBuilder b) { - b.field1(instance.field1); - b.obtainViaField(instance.field1); - b.obtainViaMethod(instance.method()); - b.obtainViaStaticMethod(SuperBuilderBasicToBuilder.Parent.staticMethod(instance)); - b.items(instance.items == null ? java.util.Collections.emptyList() : instance.items); - } - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B field1(final int field1) { - this.field1 = field1; - return self(); - } - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B obtainViaField(final int obtainViaField) { - this.obtainViaField = obtainViaField; - return self(); - } - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B obtainViaMethod(final int obtainViaMethod) { - this.obtainViaMethod = obtainViaMethod; - return self(); - } - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B obtainViaStaticMethod(final String obtainViaStaticMethod) { - this.obtainViaStaticMethod = obtainViaStaticMethod; - return self(); - } - @java.lang.SuppressWarnings("all") - public B item(final String item) { - if (this.items == null) this.items = new java.util.ArrayList(); - this.items.add(item); - return self(); - } - @java.lang.SuppressWarnings("all") - public B items(final java.util.Collection items) { - if (items == null) { - throw new java.lang.NullPointerException("items cannot be null"); - } - if (this.items == null) this.items = new java.util.ArrayList(); - this.items.addAll(items); - return self(); - } - @java.lang.SuppressWarnings("all") - public B clearItems() { - if (this.items != null) this.items.clear(); - return self(); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderBasicToBuilder.Parent.ParentBuilder(field1=" + this.field1 + ", obtainViaField=" + this.obtainViaField + ", obtainViaMethod=" + this.obtainViaMethod + ", obtainViaStaticMethod=" + this.obtainViaStaticMethod + ", items=" + this.items + ")"; - } - } - @java.lang.SuppressWarnings("all") - private static final class ParentBuilderImpl extends SuperBuilderBasicToBuilder.Parent.ParentBuilder { - @java.lang.SuppressWarnings("all") - private ParentBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public SuperBuilderBasicToBuilder.Parent build() { - return new SuperBuilderBasicToBuilder.Parent(this); - } - } - @java.lang.SuppressWarnings("all") - protected Parent(final SuperBuilderBasicToBuilder.Parent.ParentBuilder b) { - 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: - items = java.util.Collections.emptyList(); - break; - case 1: - items = java.util.Collections.singletonList(b.items.get(0)); - break; - default: - items = java.util.Collections.unmodifiableList(new java.util.ArrayList(b.items)); - } - this.items = items; - } - @java.lang.SuppressWarnings("all") - public static SuperBuilderBasicToBuilder.Parent.ParentBuilder builder() { - return new SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl(); - } - @java.lang.SuppressWarnings("all") - public SuperBuilderBasicToBuilder.Parent.ParentBuilder toBuilder() { - return new SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl().$fillValuesFrom(this); - } - } - public static class Child extends Parent { - private double field3; - @java.lang.SuppressWarnings("all") - public static abstract class ChildBuilder> extends Parent.ParentBuilder { - @java.lang.SuppressWarnings("all") - private double field3; - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected B $fillValuesFrom(final C instance) { - super.$fillValuesFrom(instance); - SuperBuilderBasicToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); - return self(); - } - @java.lang.SuppressWarnings("all") - private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderBasicToBuilder.Child instance, final SuperBuilderBasicToBuilder.Child.ChildBuilder b) { - b.field3(instance.field3); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B field3(final double field3) { - this.field3 = field3; - return self(); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderBasicToBuilder.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; - } - } - @java.lang.SuppressWarnings("all") - private static final class ChildBuilderImpl extends SuperBuilderBasicToBuilder.Child.ChildBuilder { - @java.lang.SuppressWarnings("all") - private ChildBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderBasicToBuilder.Child.ChildBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public SuperBuilderBasicToBuilder.Child build() { - return new SuperBuilderBasicToBuilder.Child(this); - } - } - @java.lang.SuppressWarnings("all") - protected Child(final SuperBuilderBasicToBuilder.Child.ChildBuilder b) { - super(b); - this.field3 = b.field3; - } - @java.lang.SuppressWarnings("all") - public static SuperBuilderBasicToBuilder.Child.ChildBuilder builder() { - return new SuperBuilderBasicToBuilder.Child.ChildBuilderImpl(); - } - @java.lang.SuppressWarnings("all") - public SuperBuilderBasicToBuilder.Child.ChildBuilder toBuilder() { - return new SuperBuilderBasicToBuilder.Child.ChildBuilderImpl().$fillValuesFrom(this); - } - } - public static void test() { - Child x = Child.builder().field3(0.0).field1(5).item("").build().toBuilder().build(); - } -} +import java.util.List; +public class SuperBuilderBasicToBuilder { + public static class Parent { + private int field1; + int obtainViaField; + int obtainViaMethod; + String obtainViaStaticMethod; + List items; + private int method() { + return 2; + } + private static String staticMethod(Parent instance) { + return "staticMethod"; + } + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder> { + @java.lang.SuppressWarnings("all") + private int field1; + @java.lang.SuppressWarnings("all") + private int obtainViaField; + @java.lang.SuppressWarnings("all") + private int obtainViaMethod; + @java.lang.SuppressWarnings("all") + private String obtainViaStaticMethod; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList items; + @java.lang.SuppressWarnings("all") + protected B $fillValuesFrom(final C instance) { + SuperBuilderBasicToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + @java.lang.SuppressWarnings("all") + private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderBasicToBuilder.Parent instance, final SuperBuilderBasicToBuilder.Parent.ParentBuilder b) { + b.field1(instance.field1); + b.obtainViaField(instance.field1); + b.obtainViaMethod(instance.method()); + b.obtainViaStaticMethod(SuperBuilderBasicToBuilder.Parent.staticMethod(instance)); + b.items(instance.items == null ? java.util.Collections.emptyList() : instance.items); + } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B field1(final int field1) { + this.field1 = field1; + return self(); + } + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B obtainViaField(final int obtainViaField) { + this.obtainViaField = obtainViaField; + return self(); + } + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B obtainViaMethod(final int obtainViaMethod) { + this.obtainViaMethod = obtainViaMethod; + return self(); + } + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B obtainViaStaticMethod(final String obtainViaStaticMethod) { + this.obtainViaStaticMethod = obtainViaStaticMethod; + return self(); + } + @java.lang.SuppressWarnings("all") + public B item(final String item) { + if (this.items == null) this.items = new java.util.ArrayList(); + this.items.add(item); + return self(); + } + @java.lang.SuppressWarnings("all") + public B items(final java.util.Collection items) { + if (items == null) { + throw new java.lang.NullPointerException("items cannot be null"); + } + if (this.items == null) this.items = new java.util.ArrayList(); + this.items.addAll(items); + return self(); + } + @java.lang.SuppressWarnings("all") + public B clearItems() { + if (this.items != null) this.items.clear(); + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderBasicToBuilder.Parent.ParentBuilder(field1=" + this.field1 + ", obtainViaField=" + this.obtainViaField + ", obtainViaMethod=" + this.obtainViaMethod + ", obtainViaStaticMethod=" + this.obtainViaStaticMethod + ", items=" + this.items + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl extends SuperBuilderBasicToBuilder.Parent.ParentBuilder { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderBasicToBuilder.Parent build() { + return new SuperBuilderBasicToBuilder.Parent(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderBasicToBuilder.Parent.ParentBuilder b) { + 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: + items = java.util.Collections.emptyList(); + break; + case 1: + items = java.util.Collections.singletonList(b.items.get(0)); + break; + default: + items = java.util.Collections.unmodifiableList(new java.util.ArrayList(b.items)); + } + this.items = items; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderBasicToBuilder.Parent.ParentBuilder builder() { + return new SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl(); + } + @java.lang.SuppressWarnings("all") + public SuperBuilderBasicToBuilder.Parent.ParentBuilder toBuilder() { + return new SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl().$fillValuesFrom(this); + } + } + public static class Child extends Parent { + private double field3; + @java.lang.SuppressWarnings("all") + public static abstract class ChildBuilder> extends Parent.ParentBuilder { + @java.lang.SuppressWarnings("all") + private double field3; + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected B $fillValuesFrom(final C instance) { + super.$fillValuesFrom(instance); + SuperBuilderBasicToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + @java.lang.SuppressWarnings("all") + private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderBasicToBuilder.Child instance, final SuperBuilderBasicToBuilder.Child.ChildBuilder b) { + b.field3(instance.field3); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.Override + @java.lang.SuppressWarnings("all") + public abstract C build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B field3(final double field3) { + this.field3 = field3; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderBasicToBuilder.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ChildBuilderImpl extends SuperBuilderBasicToBuilder.Child.ChildBuilder { + @java.lang.SuppressWarnings("all") + private ChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderBasicToBuilder.Child.ChildBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderBasicToBuilder.Child build() { + return new SuperBuilderBasicToBuilder.Child(this); + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderBasicToBuilder.Child.ChildBuilder b) { + super(b); + this.field3 = b.field3; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderBasicToBuilder.Child.ChildBuilder builder() { + return new SuperBuilderBasicToBuilder.Child.ChildBuilderImpl(); + } + @java.lang.SuppressWarnings("all") + public SuperBuilderBasicToBuilder.Child.ChildBuilder toBuilder() { + return new SuperBuilderBasicToBuilder.Child.ChildBuilderImpl().$fillValuesFrom(this); + } + } + public static void test() { + Child x = Child.builder().field3(0.0).field1(5).item("").build().toBuilder().build(); + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderCustomized.java b/test/transform/resource/after-delombok/SuperBuilderCustomized.java index 7d7c4ca8..3a0bbd9b 100644 --- a/test/transform/resource/after-delombok/SuperBuilderCustomized.java +++ b/test/transform/resource/after-delombok/SuperBuilderCustomized.java @@ -1,103 +1,103 @@ -import java.util.List; -public class SuperBuilderCustomized { - public static class Parent { - public static abstract class ParentBuilder> { - @java.lang.SuppressWarnings("all") - private int field1; - public B resetToDefault() { - field1 = 0; - return self(); - } - public B field1(int field1) { - this.field1 = field1 + 1; - return self(); - } - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderCustomized.Parent.ParentBuilder(field1=" + this.field1 + ")"; - } - } - int field1; - protected Parent(ParentBuilder b) { - if (b.field1 == 0) throw new IllegalArgumentException("field1 must be != 0"); - this.field1 = b.field1; - } - public static SuperBuilderCustomized.Parent.ParentBuilder builder(int field1) { - return new SuperBuilderCustomized.Parent.ParentBuilderImpl().field1(field1); - } - @java.lang.SuppressWarnings("all") - private static final class ParentBuilderImpl extends SuperBuilderCustomized.Parent.ParentBuilder { - @java.lang.SuppressWarnings("all") - private ParentBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderCustomized.Parent.ParentBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public SuperBuilderCustomized.Parent build() { - return new SuperBuilderCustomized.Parent(this); - } - } - } - public static class Child extends Parent { - private static final class ChildBuilderImpl extends ChildBuilder { - @Override - public Child build() { - this.resetToDefault(); - return new Child(this); - } - @java.lang.SuppressWarnings("all") - private ChildBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderCustomized.Child.ChildBuilderImpl self() { - return this; - } - } - double field2; - public static ChildBuilder builder() { - return new ChildBuilderImpl().field2(10.0); - } - @java.lang.SuppressWarnings("all") - public static abstract class ChildBuilder> extends Parent.ParentBuilder { - @java.lang.SuppressWarnings("all") - private double field2; - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B field2(final double field2) { - this.field2 = field2; - return self(); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderCustomized.Child.ChildBuilder(super=" + super.toString() + ", field2=" + this.field2 + ")"; - } - } - @java.lang.SuppressWarnings("all") - protected Child(final SuperBuilderCustomized.Child.ChildBuilder b) { - super(b); - this.field2 = b.field2; - } - } - public static void test() { - Child x = Child.builder().field2(1.0).field1(5).resetToDefault().build(); - } -} +import java.util.List; +public class SuperBuilderCustomized { + public static class Parent { + public static abstract class ParentBuilder> { + @java.lang.SuppressWarnings("all") + private int field1; + public B resetToDefault() { + field1 = 0; + return self(); + } + public B field1(int field1) { + this.field1 = field1 + 1; + return self(); + } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderCustomized.Parent.ParentBuilder(field1=" + this.field1 + ")"; + } + } + int field1; + protected Parent(ParentBuilder b) { + if (b.field1 == 0) throw new IllegalArgumentException("field1 must be != 0"); + this.field1 = b.field1; + } + public static SuperBuilderCustomized.Parent.ParentBuilder builder(int field1) { + return new SuperBuilderCustomized.Parent.ParentBuilderImpl().field1(field1); + } + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl extends SuperBuilderCustomized.Parent.ParentBuilder { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderCustomized.Parent.ParentBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderCustomized.Parent build() { + return new SuperBuilderCustomized.Parent(this); + } + } + } + public static class Child extends Parent { + private static final class ChildBuilderImpl extends ChildBuilder { + @Override + public Child build() { + this.resetToDefault(); + return new Child(this); + } + @java.lang.SuppressWarnings("all") + private ChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderCustomized.Child.ChildBuilderImpl self() { + return this; + } + } + double field2; + public static ChildBuilder builder() { + return new ChildBuilderImpl().field2(10.0); + } + @java.lang.SuppressWarnings("all") + public static abstract class ChildBuilder> extends Parent.ParentBuilder { + @java.lang.SuppressWarnings("all") + private double field2; + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.Override + @java.lang.SuppressWarnings("all") + public abstract C build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B field2(final double field2) { + this.field2 = field2; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderCustomized.Child.ChildBuilder(super=" + super.toString() + ", field2=" + this.field2 + ")"; + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderCustomized.Child.ChildBuilder b) { + super(b); + this.field2 = b.field2; + } + } + public static void test() { + Child x = Child.builder().field2(1.0).field1(5).resetToDefault().build(); + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderCustomizedWithSetterPrefix.java b/test/transform/resource/after-delombok/SuperBuilderCustomizedWithSetterPrefix.java index 8cc5dfe0..cee5ac89 100644 --- a/test/transform/resource/after-delombok/SuperBuilderCustomizedWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/SuperBuilderCustomizedWithSetterPrefix.java @@ -1,50 +1,50 @@ -import java.util.List; -public class SuperBuilderCustomizedWithSetterPrefix { - public static class Parent { - public static abstract class ParentBuilder> { - @java.lang.SuppressWarnings("all") - private int field1; - public B setField1(int field1) { - this.field1 = field1 + 1; - return self(); - } - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder(field1=" + this.field1 + ")"; - } - } - int field1; - @java.lang.SuppressWarnings("all") - private static final class ParentBuilderImpl extends SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder { - @java.lang.SuppressWarnings("all") - private ParentBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public SuperBuilderCustomizedWithSetterPrefix.Parent build() { - return new SuperBuilderCustomizedWithSetterPrefix.Parent(this); - } - } - @java.lang.SuppressWarnings("all") - protected Parent(final SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder b) { - this.field1 = b.field1; - } - @java.lang.SuppressWarnings("all") - public static SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder builder() { - return new SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl(); - } - } - public static void test() { - Parent x = Parent.builder().setField1(5).build(); - } -} +import java.util.List; +public class SuperBuilderCustomizedWithSetterPrefix { + public static class Parent { + public static abstract class ParentBuilder> { + @java.lang.SuppressWarnings("all") + private int field1; + public B setField1(int field1) { + this.field1 = field1 + 1; + return self(); + } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder(field1=" + this.field1 + ")"; + } + } + int field1; + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl extends SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderCustomizedWithSetterPrefix.Parent build() { + return new SuperBuilderCustomizedWithSetterPrefix.Parent(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder b) { + this.field1 = b.field1; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder builder() { + return new SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl(); + } + } + public static void test() { + Parent x = Parent.builder().setField1(5).build(); + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderNameClashes.java b/test/transform/resource/after-delombok/SuperBuilderNameClashes.java index bd176f49..8cef4e11 100644 --- a/test/transform/resource/after-delombok/SuperBuilderNameClashes.java +++ b/test/transform/resource/after-delombok/SuperBuilderNameClashes.java @@ -1,127 +1,127 @@ -public class SuperBuilderNameClashes { - public static class GenericsClash { - @java.lang.SuppressWarnings("all") - public static abstract class GenericsClashBuilder, B2 extends SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder> { - @java.lang.SuppressWarnings("all") - protected abstract B2 self(); - @java.lang.SuppressWarnings("all") - public abstract C3 build(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder()"; - } - } - @java.lang.SuppressWarnings("all") - private static final class GenericsClashBuilderImpl extends SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder, SuperBuilderNameClashes.GenericsClash.GenericsClashBuilderImpl> { - @java.lang.SuppressWarnings("all") - private GenericsClashBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderNameClashes.GenericsClash.GenericsClashBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public SuperBuilderNameClashes.GenericsClash build() { - return new SuperBuilderNameClashes.GenericsClash(this); - } - } - @java.lang.SuppressWarnings("all") - protected GenericsClash(final SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder b) { - } - @java.lang.SuppressWarnings("all") - public static SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder builder() { - return new SuperBuilderNameClashes.GenericsClash.GenericsClashBuilderImpl(); - } - } - public static class B { - @java.lang.SuppressWarnings("all") - public static abstract class BBuilder> { - @java.lang.SuppressWarnings("all") - protected abstract B2 self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderNameClashes.B.BBuilder()"; - } - } - @java.lang.SuppressWarnings("all") - private static final class BBuilderImpl extends SuperBuilderNameClashes.B.BBuilder { - @java.lang.SuppressWarnings("all") - private BBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderNameClashes.B.BBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public SuperBuilderNameClashes.B build() { - return new SuperBuilderNameClashes.B(this); - } - } - @java.lang.SuppressWarnings("all") - protected B(final SuperBuilderNameClashes.B.BBuilder b) { - } - @java.lang.SuppressWarnings("all") - public static SuperBuilderNameClashes.B.BBuilder builder() { - return new SuperBuilderNameClashes.B.BBuilderImpl(); - } - } - public static class C2 { - } - public static class C { - C2 c2; - @java.lang.SuppressWarnings("all") - public static abstract class CBuilder> { - @java.lang.SuppressWarnings("all") - private C2 c2; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C3 build(); - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B c2(final C2 c2) { - this.c2 = c2; - return self(); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderNameClashes.C.CBuilder(c2=" + this.c2 + ")"; - } - } - @java.lang.SuppressWarnings("all") - private static final class CBuilderImpl extends SuperBuilderNameClashes.C.CBuilder { - @java.lang.SuppressWarnings("all") - private CBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderNameClashes.C.CBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public SuperBuilderNameClashes.C build() { - return new SuperBuilderNameClashes.C(this); - } - } - @java.lang.SuppressWarnings("all") - protected C(final SuperBuilderNameClashes.C.CBuilder b) { - this.c2 = b.c2; - } - @java.lang.SuppressWarnings("all") - public static SuperBuilderNameClashes.C.CBuilder builder() { - return new SuperBuilderNameClashes.C.CBuilderImpl(); - } - } -} +public class SuperBuilderNameClashes { + public static class GenericsClash { + @java.lang.SuppressWarnings("all") + public static abstract class GenericsClashBuilder, B2 extends SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder> { + @java.lang.SuppressWarnings("all") + protected abstract B2 self(); + @java.lang.SuppressWarnings("all") + public abstract C3 build(); + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder()"; + } + } + @java.lang.SuppressWarnings("all") + private static final class GenericsClashBuilderImpl extends SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder, SuperBuilderNameClashes.GenericsClash.GenericsClashBuilderImpl> { + @java.lang.SuppressWarnings("all") + private GenericsClashBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderNameClashes.GenericsClash.GenericsClashBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderNameClashes.GenericsClash build() { + return new SuperBuilderNameClashes.GenericsClash(this); + } + } + @java.lang.SuppressWarnings("all") + protected GenericsClash(final SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder b) { + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder builder() { + return new SuperBuilderNameClashes.GenericsClash.GenericsClashBuilderImpl(); + } + } + public static class B { + @java.lang.SuppressWarnings("all") + public static abstract class BBuilder> { + @java.lang.SuppressWarnings("all") + protected abstract B2 self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderNameClashes.B.BBuilder()"; + } + } + @java.lang.SuppressWarnings("all") + private static final class BBuilderImpl extends SuperBuilderNameClashes.B.BBuilder { + @java.lang.SuppressWarnings("all") + private BBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderNameClashes.B.BBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderNameClashes.B build() { + return new SuperBuilderNameClashes.B(this); + } + } + @java.lang.SuppressWarnings("all") + protected B(final SuperBuilderNameClashes.B.BBuilder b) { + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderNameClashes.B.BBuilder builder() { + return new SuperBuilderNameClashes.B.BBuilderImpl(); + } + } + public static class C2 { + } + public static class C { + C2 c2; + @java.lang.SuppressWarnings("all") + public static abstract class CBuilder> { + @java.lang.SuppressWarnings("all") + private C2 c2; + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C3 build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B c2(final C2 c2) { + this.c2 = c2; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderNameClashes.C.CBuilder(c2=" + this.c2 + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class CBuilderImpl extends SuperBuilderNameClashes.C.CBuilder { + @java.lang.SuppressWarnings("all") + private CBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderNameClashes.C.CBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderNameClashes.C build() { + return new SuperBuilderNameClashes.C(this); + } + } + @java.lang.SuppressWarnings("all") + protected C(final SuperBuilderNameClashes.C.CBuilder b) { + this.c2 = b.c2; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderNameClashes.C.CBuilder builder() { + return new SuperBuilderNameClashes.C.CBuilderImpl(); + } + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderNestedGenericTypes.java b/test/transform/resource/after-delombok/SuperBuilderNestedGenericTypes.java index ad738c01..fadc0580 100644 --- a/test/transform/resource/after-delombok/SuperBuilderNestedGenericTypes.java +++ b/test/transform/resource/after-delombok/SuperBuilderNestedGenericTypes.java @@ -1,41 +1,41 @@ -public class SuperBuilderNestedGenericTypes { - public static abstract class Generic> { - @java.lang.SuppressWarnings("all") - public static abstract class GenericBuilder, C extends SuperBuilderNestedGenericTypes.Generic, B extends SuperBuilderNestedGenericTypes.Generic.GenericBuilder> { - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderNestedGenericTypes.Generic.GenericBuilder()"; - } - } - @java.lang.SuppressWarnings("all") - protected Generic(final SuperBuilderNestedGenericTypes.Generic.GenericBuilder b) { - } - } - public static abstract class NestedGeneric> extends Generic>> { - @java.lang.SuppressWarnings("all") - public static abstract class NestedGenericBuilder, C extends SuperBuilderNestedGenericTypes.NestedGeneric, B extends SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder> extends Generic.GenericBuilder>, C, B> { - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder(super=" + super.toString() + ")"; - } - } - @java.lang.SuppressWarnings("all") - protected NestedGeneric(final SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder b) { - super(b); - } - } - public interface OtherGeneric { - } -} +public class SuperBuilderNestedGenericTypes { + public static abstract class Generic> { + @java.lang.SuppressWarnings("all") + public static abstract class GenericBuilder, C extends SuperBuilderNestedGenericTypes.Generic, B extends SuperBuilderNestedGenericTypes.Generic.GenericBuilder> { + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderNestedGenericTypes.Generic.GenericBuilder()"; + } + } + @java.lang.SuppressWarnings("all") + protected Generic(final SuperBuilderNestedGenericTypes.Generic.GenericBuilder b) { + } + } + public static abstract class NestedGeneric> extends Generic>> { + @java.lang.SuppressWarnings("all") + public static abstract class NestedGenericBuilder, C extends SuperBuilderNestedGenericTypes.NestedGeneric, B extends SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder> extends Generic.GenericBuilder>, C, B> { + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.Override + @java.lang.SuppressWarnings("all") + public abstract C build(); + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder(super=" + super.toString() + ")"; + } + } + @java.lang.SuppressWarnings("all") + protected NestedGeneric(final SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder b) { + super(b); + } + } + public interface OtherGeneric { + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderWithCustomBuilderMethod.java b/test/transform/resource/after-delombok/SuperBuilderWithCustomBuilderMethod.java index 7e9337c9..3f74963e 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithCustomBuilderMethod.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithCustomBuilderMethod.java @@ -1,141 +1,141 @@ -import java.util.List; -public class SuperBuilderWithCustomBuilderMethod { - public static class Parent { - A field1; - List items; - @java.lang.SuppressWarnings("all") - public static abstract class ParentBuilder, B extends SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder> { - @java.lang.SuppressWarnings("all") - private A field1; - @java.lang.SuppressWarnings("all") - private java.util.ArrayList items; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B field1(final A field1) { - this.field1 = field1; - return self(); - } - @java.lang.SuppressWarnings("all") - public B item(final String item) { - if (this.items == null) this.items = new java.util.ArrayList(); - this.items.add(item); - return self(); - } - @java.lang.SuppressWarnings("all") - public B items(final java.util.Collection items) { - if (items == null) { - throw new java.lang.NullPointerException("items cannot be null"); - } - if (this.items == null) this.items = new java.util.ArrayList(); - this.items.addAll(items); - return self(); - } - @java.lang.SuppressWarnings("all") - public B clearItems() { - if (this.items != null) this.items.clear(); - return self(); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder(field1=" + this.field1 + ", items=" + this.items + ")"; - } - } - @java.lang.SuppressWarnings("all") - private static final class ParentBuilderImpl extends SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder, SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl> { - @java.lang.SuppressWarnings("all") - private ParentBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public SuperBuilderWithCustomBuilderMethod.Parent build() { - return new SuperBuilderWithCustomBuilderMethod.Parent(this); - } - } - @java.lang.SuppressWarnings("all") - protected Parent(final SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder b) { - this.field1 = b.field1; - java.util.List items; - switch (b.items == null ? 0 : b.items.size()) { - case 0: - items = java.util.Collections.emptyList(); - break; - case 1: - items = java.util.Collections.singletonList(b.items.get(0)); - break; - default: - items = java.util.Collections.unmodifiableList(new java.util.ArrayList(b.items)); - } - this.items = items; - } - @java.lang.SuppressWarnings("all") - public static SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder builder() { - return new SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl(); - } - } - public static class Child extends Parent { - double field3; - public static ChildBuilder builder() { - return new ChildBuilderImpl().item("default item"); - } - @java.lang.SuppressWarnings("all") - public static abstract class ChildBuilder, B extends SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder> extends Parent.ParentBuilder { - @java.lang.SuppressWarnings("all") - private double field3; - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B field3(final double field3) { - this.field3 = field3; - return self(); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; - } - } - @java.lang.SuppressWarnings("all") - private static final class ChildBuilderImpl extends SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder, SuperBuilderWithCustomBuilderMethod.Child.ChildBuilderImpl> { - @java.lang.SuppressWarnings("all") - private ChildBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderWithCustomBuilderMethod.Child.ChildBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public SuperBuilderWithCustomBuilderMethod.Child build() { - return new SuperBuilderWithCustomBuilderMethod.Child(this); - } - } - @java.lang.SuppressWarnings("all") - protected Child(final SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder b) { - super(b); - this.field3 = b.field3; - } - } - public static void test() { - Child x = Child.builder().field3(0.0).field1(5).item("").build(); - } -} +import java.util.List; +public class SuperBuilderWithCustomBuilderMethod { + public static class Parent { + A field1; + List items; + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder, B extends SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder> { + @java.lang.SuppressWarnings("all") + private A field1; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList items; + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B field1(final A field1) { + this.field1 = field1; + return self(); + } + @java.lang.SuppressWarnings("all") + public B item(final String item) { + if (this.items == null) this.items = new java.util.ArrayList(); + this.items.add(item); + return self(); + } + @java.lang.SuppressWarnings("all") + public B items(final java.util.Collection items) { + if (items == null) { + throw new java.lang.NullPointerException("items cannot be null"); + } + if (this.items == null) this.items = new java.util.ArrayList(); + this.items.addAll(items); + return self(); + } + @java.lang.SuppressWarnings("all") + public B clearItems() { + if (this.items != null) this.items.clear(); + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder(field1=" + this.field1 + ", items=" + this.items + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl extends SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder, SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithCustomBuilderMethod.Parent build() { + return new SuperBuilderWithCustomBuilderMethod.Parent(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder b) { + this.field1 = b.field1; + java.util.List items; + switch (b.items == null ? 0 : b.items.size()) { + case 0: + items = java.util.Collections.emptyList(); + break; + case 1: + items = java.util.Collections.singletonList(b.items.get(0)); + break; + default: + items = java.util.Collections.unmodifiableList(new java.util.ArrayList(b.items)); + } + this.items = items; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder builder() { + return new SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl(); + } + } + public static class Child extends Parent { + double field3; + public static ChildBuilder builder() { + return new ChildBuilderImpl().item("default item"); + } + @java.lang.SuppressWarnings("all") + public static abstract class ChildBuilder, B extends SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder> extends Parent.ParentBuilder { + @java.lang.SuppressWarnings("all") + private double field3; + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.Override + @java.lang.SuppressWarnings("all") + public abstract C build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B field3(final double field3) { + this.field3 = field3; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ChildBuilderImpl extends SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder, SuperBuilderWithCustomBuilderMethod.Child.ChildBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithCustomBuilderMethod.Child.ChildBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithCustomBuilderMethod.Child build() { + return new SuperBuilderWithCustomBuilderMethod.Child(this); + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder b) { + super(b); + this.field3 = b.field3; + } + } + public static void test() { + Child x = Child.builder().field3(0.0).field1(5).item("").build(); + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderWithDefaults.java b/test/transform/resource/after-delombok/SuperBuilderWithDefaults.java index 40f0900b..a9d92ff9 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithDefaults.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithDefaults.java @@ -1,143 +1,143 @@ -import java.util.List; -public class SuperBuilderWithDefaults { - public static class Parent { - private long millis; - private N numberField; - @java.lang.SuppressWarnings("all") - private static long $default$millis() { - return System.currentTimeMillis(); - } - @java.lang.SuppressWarnings("all") - private static N $default$numberField() { - return null; - } - @java.lang.SuppressWarnings("all") - public static abstract class ParentBuilder, B extends SuperBuilderWithDefaults.Parent.ParentBuilder> { - @java.lang.SuppressWarnings("all") - private boolean millis$set; - @java.lang.SuppressWarnings("all") - private long millis$value; - @java.lang.SuppressWarnings("all") - private boolean numberField$set; - @java.lang.SuppressWarnings("all") - private N numberField$value; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B millis(final long millis) { - this.millis$value = millis; - millis$set = true; - return self(); - } - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B numberField(final N numberField) { - this.numberField$value = numberField; - numberField$set = true; - return self(); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderWithDefaults.Parent.ParentBuilder(millis$value=" + this.millis$value + ", numberField$value=" + this.numberField$value + ")"; - } - } - @java.lang.SuppressWarnings("all") - private static final class ParentBuilderImpl extends SuperBuilderWithDefaults.Parent.ParentBuilder, SuperBuilderWithDefaults.Parent.ParentBuilderImpl> { - @java.lang.SuppressWarnings("all") - private ParentBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderWithDefaults.Parent.ParentBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public SuperBuilderWithDefaults.Parent build() { - return new SuperBuilderWithDefaults.Parent(this); - } - } - @java.lang.SuppressWarnings("all") - protected Parent(final SuperBuilderWithDefaults.Parent.ParentBuilder b) { - if (b.millis$set) this.millis = b.millis$value; - else this.millis = SuperBuilderWithDefaults.Parent.$default$millis(); - if (b.numberField$set) this.numberField = b.numberField$value; - else this.numberField = SuperBuilderWithDefaults.Parent.$default$numberField(); - } - @java.lang.SuppressWarnings("all") - public static SuperBuilderWithDefaults.Parent.ParentBuilder builder() { - return new SuperBuilderWithDefaults.Parent.ParentBuilderImpl(); - } - } - public static class Child extends Parent { - private double doubleField; - @java.lang.SuppressWarnings("all") - private static double $default$doubleField() { - return Math.PI; - } - @java.lang.SuppressWarnings("all") - public static abstract class ChildBuilder> extends Parent.ParentBuilder { - @java.lang.SuppressWarnings("all") - private boolean doubleField$set; - @java.lang.SuppressWarnings("all") - private double doubleField$value; - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B doubleField(final double doubleField) { - this.doubleField$value = doubleField; - doubleField$set = true; - return self(); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderWithDefaults.Child.ChildBuilder(super=" + super.toString() + ", doubleField$value=" + this.doubleField$value + ")"; - } - } - @java.lang.SuppressWarnings("all") - private static final class ChildBuilderImpl extends SuperBuilderWithDefaults.Child.ChildBuilder { - @java.lang.SuppressWarnings("all") - private ChildBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderWithDefaults.Child.ChildBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public SuperBuilderWithDefaults.Child build() { - return new SuperBuilderWithDefaults.Child(this); - } - } - @java.lang.SuppressWarnings("all") - protected Child(final SuperBuilderWithDefaults.Child.ChildBuilder b) { - super(b); - if (b.doubleField$set) this.doubleField = b.doubleField$value; - else this.doubleField = SuperBuilderWithDefaults.Child.$default$doubleField(); - } - @java.lang.SuppressWarnings("all") - public static SuperBuilderWithDefaults.Child.ChildBuilder builder() { - return new SuperBuilderWithDefaults.Child.ChildBuilderImpl(); - } - } - public static void test() { - Child x = Child.builder().doubleField(0.1).numberField(5).millis(1234567890L).build(); - } -} +import java.util.List; +public class SuperBuilderWithDefaults { + public static class Parent { + private long millis; + private N numberField; + @java.lang.SuppressWarnings("all") + private static long $default$millis() { + return System.currentTimeMillis(); + } + @java.lang.SuppressWarnings("all") + private static N $default$numberField() { + return null; + } + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder, B extends SuperBuilderWithDefaults.Parent.ParentBuilder> { + @java.lang.SuppressWarnings("all") + private boolean millis$set; + @java.lang.SuppressWarnings("all") + private long millis$value; + @java.lang.SuppressWarnings("all") + private boolean numberField$set; + @java.lang.SuppressWarnings("all") + private N numberField$value; + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B millis(final long millis) { + this.millis$value = millis; + millis$set = true; + return self(); + } + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B numberField(final N numberField) { + this.numberField$value = numberField; + numberField$set = true; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithDefaults.Parent.ParentBuilder(millis$value=" + this.millis$value + ", numberField$value=" + this.numberField$value + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl extends SuperBuilderWithDefaults.Parent.ParentBuilder, SuperBuilderWithDefaults.Parent.ParentBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithDefaults.Parent.ParentBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithDefaults.Parent build() { + return new SuperBuilderWithDefaults.Parent(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderWithDefaults.Parent.ParentBuilder b) { + if (b.millis$set) this.millis = b.millis$value; + else this.millis = SuperBuilderWithDefaults.Parent.$default$millis(); + if (b.numberField$set) this.numberField = b.numberField$value; + else this.numberField = SuperBuilderWithDefaults.Parent.$default$numberField(); + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderWithDefaults.Parent.ParentBuilder builder() { + return new SuperBuilderWithDefaults.Parent.ParentBuilderImpl(); + } + } + public static class Child extends Parent { + private double doubleField; + @java.lang.SuppressWarnings("all") + private static double $default$doubleField() { + return Math.PI; + } + @java.lang.SuppressWarnings("all") + public static abstract class ChildBuilder> extends Parent.ParentBuilder { + @java.lang.SuppressWarnings("all") + private boolean doubleField$set; + @java.lang.SuppressWarnings("all") + private double doubleField$value; + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.Override + @java.lang.SuppressWarnings("all") + public abstract C build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B doubleField(final double doubleField) { + this.doubleField$value = doubleField; + doubleField$set = true; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithDefaults.Child.ChildBuilder(super=" + super.toString() + ", doubleField$value=" + this.doubleField$value + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ChildBuilderImpl extends SuperBuilderWithDefaults.Child.ChildBuilder { + @java.lang.SuppressWarnings("all") + private ChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithDefaults.Child.ChildBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithDefaults.Child build() { + return new SuperBuilderWithDefaults.Child(this); + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderWithDefaults.Child.ChildBuilder b) { + super(b); + if (b.doubleField$set) this.doubleField = b.doubleField$value; + else this.doubleField = SuperBuilderWithDefaults.Child.$default$doubleField(); + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderWithDefaults.Child.ChildBuilder builder() { + return new SuperBuilderWithDefaults.Child.ChildBuilderImpl(); + } + } + public static void test() { + Child x = Child.builder().doubleField(0.1).numberField(5).millis(1234567890L).build(); + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderWithGenerics.java b/test/transform/resource/after-delombok/SuperBuilderWithGenerics.java index 0c3d2379..017ebf31 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithGenerics.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithGenerics.java @@ -1,142 +1,142 @@ -import java.util.List; -public class SuperBuilderWithGenerics { - public static class Parent { - A field1; - List items; - @java.lang.SuppressWarnings("all") - public static abstract class ParentBuilder, B extends SuperBuilderWithGenerics.Parent.ParentBuilder> { - @java.lang.SuppressWarnings("all") - private A field1; - @java.lang.SuppressWarnings("all") - private java.util.ArrayList items; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B field1(final A field1) { - this.field1 = field1; - return self(); - } - @java.lang.SuppressWarnings("all") - public B item(final String item) { - if (this.items == null) this.items = new java.util.ArrayList(); - this.items.add(item); - return self(); - } - @java.lang.SuppressWarnings("all") - public B items(final java.util.Collection items) { - if (items == null) { - throw new java.lang.NullPointerException("items cannot be null"); - } - if (this.items == null) this.items = new java.util.ArrayList(); - this.items.addAll(items); - return self(); - } - @java.lang.SuppressWarnings("all") - public B clearItems() { - if (this.items != null) this.items.clear(); - return self(); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderWithGenerics.Parent.ParentBuilder(field1=" + this.field1 + ", items=" + this.items + ")"; - } - } - @java.lang.SuppressWarnings("all") - private static final class ParentBuilderImpl extends SuperBuilderWithGenerics.Parent.ParentBuilder, SuperBuilderWithGenerics.Parent.ParentBuilderImpl> { - @java.lang.SuppressWarnings("all") - private ParentBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderWithGenerics.Parent.ParentBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public SuperBuilderWithGenerics.Parent build() { - return new SuperBuilderWithGenerics.Parent(this); - } - } - @java.lang.SuppressWarnings("all") - protected Parent(final SuperBuilderWithGenerics.Parent.ParentBuilder b) { - this.field1 = b.field1; - java.util.List items; - switch (b.items == null ? 0 : b.items.size()) { - case 0: - items = java.util.Collections.emptyList(); - break; - case 1: - items = java.util.Collections.singletonList(b.items.get(0)); - break; - default: - items = java.util.Collections.unmodifiableList(new java.util.ArrayList(b.items)); - } - this.items = items; - } - @java.lang.SuppressWarnings("all") - public static SuperBuilderWithGenerics.Parent.ParentBuilder builder() { - return new SuperBuilderWithGenerics.Parent.ParentBuilderImpl(); - } - } - public static class Child extends Parent { - double field3; - @java.lang.SuppressWarnings("all") - public static abstract class ChildBuilder, B extends SuperBuilderWithGenerics.Child.ChildBuilder> extends Parent.ParentBuilder { - @java.lang.SuppressWarnings("all") - private double field3; - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B field3(final double field3) { - this.field3 = field3; - return self(); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderWithGenerics.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; - } - } - @java.lang.SuppressWarnings("all") - private static final class ChildBuilderImpl extends SuperBuilderWithGenerics.Child.ChildBuilder, SuperBuilderWithGenerics.Child.ChildBuilderImpl> { - @java.lang.SuppressWarnings("all") - private ChildBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderWithGenerics.Child.ChildBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public SuperBuilderWithGenerics.Child build() { - return new SuperBuilderWithGenerics.Child(this); - } - } - @java.lang.SuppressWarnings("all") - protected Child(final SuperBuilderWithGenerics.Child.ChildBuilder b) { - super(b); - this.field3 = b.field3; - } - @java.lang.SuppressWarnings("all") - public static SuperBuilderWithGenerics.Child.ChildBuilder builder() { - return new SuperBuilderWithGenerics.Child.ChildBuilderImpl(); - } - } - public static void test() { - Child x = Child.builder().field3(0.0).field1(5).item("").build(); - } -} +import java.util.List; +public class SuperBuilderWithGenerics { + public static class Parent { + A field1; + List items; + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder, B extends SuperBuilderWithGenerics.Parent.ParentBuilder> { + @java.lang.SuppressWarnings("all") + private A field1; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList items; + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B field1(final A field1) { + this.field1 = field1; + return self(); + } + @java.lang.SuppressWarnings("all") + public B item(final String item) { + if (this.items == null) this.items = new java.util.ArrayList(); + this.items.add(item); + return self(); + } + @java.lang.SuppressWarnings("all") + public B items(final java.util.Collection items) { + if (items == null) { + throw new java.lang.NullPointerException("items cannot be null"); + } + if (this.items == null) this.items = new java.util.ArrayList(); + this.items.addAll(items); + return self(); + } + @java.lang.SuppressWarnings("all") + public B clearItems() { + if (this.items != null) this.items.clear(); + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithGenerics.Parent.ParentBuilder(field1=" + this.field1 + ", items=" + this.items + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl extends SuperBuilderWithGenerics.Parent.ParentBuilder, SuperBuilderWithGenerics.Parent.ParentBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithGenerics.Parent.ParentBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithGenerics.Parent build() { + return new SuperBuilderWithGenerics.Parent(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderWithGenerics.Parent.ParentBuilder b) { + this.field1 = b.field1; + java.util.List items; + switch (b.items == null ? 0 : b.items.size()) { + case 0: + items = java.util.Collections.emptyList(); + break; + case 1: + items = java.util.Collections.singletonList(b.items.get(0)); + break; + default: + items = java.util.Collections.unmodifiableList(new java.util.ArrayList(b.items)); + } + this.items = items; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderWithGenerics.Parent.ParentBuilder builder() { + return new SuperBuilderWithGenerics.Parent.ParentBuilderImpl(); + } + } + public static class Child extends Parent { + double field3; + @java.lang.SuppressWarnings("all") + public static abstract class ChildBuilder, B extends SuperBuilderWithGenerics.Child.ChildBuilder> extends Parent.ParentBuilder { + @java.lang.SuppressWarnings("all") + private double field3; + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.Override + @java.lang.SuppressWarnings("all") + public abstract C build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B field3(final double field3) { + this.field3 = field3; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithGenerics.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ChildBuilderImpl extends SuperBuilderWithGenerics.Child.ChildBuilder, SuperBuilderWithGenerics.Child.ChildBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithGenerics.Child.ChildBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithGenerics.Child build() { + return new SuperBuilderWithGenerics.Child(this); + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderWithGenerics.Child.ChildBuilder b) { + super(b); + this.field3 = b.field3; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderWithGenerics.Child.ChildBuilder builder() { + return new SuperBuilderWithGenerics.Child.ChildBuilderImpl(); + } + } + public static void test() { + Child x = Child.builder().field3(0.0).field1(5).item("").build(); + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderWithGenerics2.java b/test/transform/resource/after-delombok/SuperBuilderWithGenerics2.java index 71e29d92..8c465b0e 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithGenerics2.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithGenerics2.java @@ -1,142 +1,142 @@ -import java.util.List; -public class SuperBuilderWithGenerics2 { - public static class Parent { - A field1; - List items; - @java.lang.SuppressWarnings("all") - public static abstract class ParentBuilder, B extends SuperBuilderWithGenerics2.Parent.ParentBuilder> { - @java.lang.SuppressWarnings("all") - private A field1; - @java.lang.SuppressWarnings("all") - private java.util.ArrayList items; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B field1(final A field1) { - this.field1 = field1; - return self(); - } - @java.lang.SuppressWarnings("all") - public B item(final String item) { - if (this.items == null) this.items = new java.util.ArrayList(); - this.items.add(item); - return self(); - } - @java.lang.SuppressWarnings("all") - public B items(final java.util.Collection items) { - if (items == null) { - throw new java.lang.NullPointerException("items cannot be null"); - } - if (this.items == null) this.items = new java.util.ArrayList(); - this.items.addAll(items); - return self(); - } - @java.lang.SuppressWarnings("all") - public B clearItems() { - if (this.items != null) this.items.clear(); - return self(); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderWithGenerics2.Parent.ParentBuilder(field1=" + this.field1 + ", items=" + this.items + ")"; - } - } - @java.lang.SuppressWarnings("all") - private static final class ParentBuilderImpl extends SuperBuilderWithGenerics2.Parent.ParentBuilder, SuperBuilderWithGenerics2.Parent.ParentBuilderImpl> { - @java.lang.SuppressWarnings("all") - private ParentBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderWithGenerics2.Parent.ParentBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public SuperBuilderWithGenerics2.Parent build() { - return new SuperBuilderWithGenerics2.Parent(this); - } - } - @java.lang.SuppressWarnings("all") - protected Parent(final SuperBuilderWithGenerics2.Parent.ParentBuilder b) { - this.field1 = b.field1; - java.util.List items; - switch (b.items == null ? 0 : b.items.size()) { - case 0: - items = java.util.Collections.emptyList(); - break; - case 1: - items = java.util.Collections.singletonList(b.items.get(0)); - break; - default: - items = java.util.Collections.unmodifiableList(new java.util.ArrayList(b.items)); - } - this.items = items; - } - @java.lang.SuppressWarnings("all") - public static SuperBuilderWithGenerics2.Parent.ParentBuilder builder() { - return new SuperBuilderWithGenerics2.Parent.ParentBuilderImpl(); - } - } - public static class Child extends Parent { - A field3; - @java.lang.SuppressWarnings("all") - public static abstract class ChildBuilder, B extends SuperBuilderWithGenerics2.Child.ChildBuilder> extends Parent.ParentBuilder { - @java.lang.SuppressWarnings("all") - private A field3; - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B field3(final A field3) { - this.field3 = field3; - return self(); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderWithGenerics2.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; - } - } - @java.lang.SuppressWarnings("all") - private static final class ChildBuilderImpl extends SuperBuilderWithGenerics2.Child.ChildBuilder, SuperBuilderWithGenerics2.Child.ChildBuilderImpl> { - @java.lang.SuppressWarnings("all") - private ChildBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderWithGenerics2.Child.ChildBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public SuperBuilderWithGenerics2.Child build() { - return new SuperBuilderWithGenerics2.Child(this); - } - } - @java.lang.SuppressWarnings("all") - protected Child(final SuperBuilderWithGenerics2.Child.ChildBuilder b) { - super(b); - this.field3 = b.field3; - } - @java.lang.SuppressWarnings("all") - public static SuperBuilderWithGenerics2.Child.ChildBuilder builder2() { - return new SuperBuilderWithGenerics2.Child.ChildBuilderImpl(); - } - } - public static void test() { - Child x = Child.builder2().field3(1).field1("value").item("").build(); - } -} +import java.util.List; +public class SuperBuilderWithGenerics2 { + public static class Parent { + A field1; + List items; + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder, B extends SuperBuilderWithGenerics2.Parent.ParentBuilder> { + @java.lang.SuppressWarnings("all") + private A field1; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList items; + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B field1(final A field1) { + this.field1 = field1; + return self(); + } + @java.lang.SuppressWarnings("all") + public B item(final String item) { + if (this.items == null) this.items = new java.util.ArrayList(); + this.items.add(item); + return self(); + } + @java.lang.SuppressWarnings("all") + public B items(final java.util.Collection items) { + if (items == null) { + throw new java.lang.NullPointerException("items cannot be null"); + } + if (this.items == null) this.items = new java.util.ArrayList(); + this.items.addAll(items); + return self(); + } + @java.lang.SuppressWarnings("all") + public B clearItems() { + if (this.items != null) this.items.clear(); + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithGenerics2.Parent.ParentBuilder(field1=" + this.field1 + ", items=" + this.items + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl extends SuperBuilderWithGenerics2.Parent.ParentBuilder, SuperBuilderWithGenerics2.Parent.ParentBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithGenerics2.Parent.ParentBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithGenerics2.Parent build() { + return new SuperBuilderWithGenerics2.Parent(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderWithGenerics2.Parent.ParentBuilder b) { + this.field1 = b.field1; + java.util.List items; + switch (b.items == null ? 0 : b.items.size()) { + case 0: + items = java.util.Collections.emptyList(); + break; + case 1: + items = java.util.Collections.singletonList(b.items.get(0)); + break; + default: + items = java.util.Collections.unmodifiableList(new java.util.ArrayList(b.items)); + } + this.items = items; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderWithGenerics2.Parent.ParentBuilder builder() { + return new SuperBuilderWithGenerics2.Parent.ParentBuilderImpl(); + } + } + public static class Child extends Parent { + A field3; + @java.lang.SuppressWarnings("all") + public static abstract class ChildBuilder, B extends SuperBuilderWithGenerics2.Child.ChildBuilder> extends Parent.ParentBuilder { + @java.lang.SuppressWarnings("all") + private A field3; + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.Override + @java.lang.SuppressWarnings("all") + public abstract C build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B field3(final A field3) { + this.field3 = field3; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithGenerics2.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ChildBuilderImpl extends SuperBuilderWithGenerics2.Child.ChildBuilder, SuperBuilderWithGenerics2.Child.ChildBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithGenerics2.Child.ChildBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithGenerics2.Child build() { + return new SuperBuilderWithGenerics2.Child(this); + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderWithGenerics2.Child.ChildBuilder b) { + super(b); + this.field3 = b.field3; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderWithGenerics2.Child.ChildBuilder builder2() { + return new SuperBuilderWithGenerics2.Child.ChildBuilderImpl(); + } + } + public static void test() { + Child x = Child.builder2().field3(1).field1("value").item("").build(); + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderWithGenericsAndToBuilder.java b/test/transform/resource/after-delombok/SuperBuilderWithGenericsAndToBuilder.java index ac65a444..25a8fda1 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithGenericsAndToBuilder.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithGenericsAndToBuilder.java @@ -1,188 +1,188 @@ -import java.util.Map; -public class SuperBuilderWithGenericsAndToBuilder { - public static class Parent { - A field1; - Map items; - @java.lang.SuppressWarnings("all") - public static abstract class ParentBuilder, B extends SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder> { - @java.lang.SuppressWarnings("all") - private A field1; - @java.lang.SuppressWarnings("all") - private java.util.ArrayList items$key; - @java.lang.SuppressWarnings("all") - private java.util.ArrayList items$value; - @java.lang.SuppressWarnings("all") - protected B $fillValuesFrom(final C instance) { - SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); - return self(); - } - @java.lang.SuppressWarnings("all") - private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithGenericsAndToBuilder.Parent instance, final SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder b) { - b.field1(instance.field1); - b.items(instance.items == null ? java.util.Collections.emptyMap() : instance.items); - } - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B field1(final A field1) { - this.field1 = field1; - return self(); - } - @java.lang.SuppressWarnings("all") - public B item(final Integer itemKey, final String itemValue) { - if (this.items$key == null) { - this.items$key = new java.util.ArrayList(); - this.items$value = new java.util.ArrayList(); - } - this.items$key.add(itemKey); - this.items$value.add(itemValue); - return self(); - } - @java.lang.SuppressWarnings("all") - public B items(final java.util.Map items) { - if (items == null) { - throw new java.lang.NullPointerException("items cannot be null"); - } - if (this.items$key == null) { - this.items$key = new java.util.ArrayList(); - this.items$value = new java.util.ArrayList(); - } - for (final java.util.Map.Entry $lombokEntry : items.entrySet()) { - this.items$key.add($lombokEntry.getKey()); - this.items$value.add($lombokEntry.getValue()); - } - return self(); - } - @java.lang.SuppressWarnings("all") - public B clearItems() { - if (this.items$key != null) { - this.items$key.clear(); - this.items$value.clear(); - } - return self(); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder(field1=" + this.field1 + ", items$key=" + this.items$key + ", items$value=" + this.items$value + ")"; - } - } - @java.lang.SuppressWarnings("all") - private static final class ParentBuilderImpl extends SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder, SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl> { - @java.lang.SuppressWarnings("all") - private ParentBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public SuperBuilderWithGenericsAndToBuilder.Parent build() { - return new SuperBuilderWithGenericsAndToBuilder.Parent(this); - } - } - @java.lang.SuppressWarnings("all") - protected Parent(final SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder b) { - this.field1 = b.field1; - java.util.Map items; - switch (b.items$key == null ? 0 : b.items$key.size()) { - case 0: - items = java.util.Collections.emptyMap(); - break; - case 1: - items = java.util.Collections.singletonMap(b.items$key.get(0), b.items$value.get(0)); - break; - default: - items = new java.util.LinkedHashMap(b.items$key.size() < 1073741824 ? 1 + b.items$key.size() + (b.items$key.size() - 3) / 3 : java.lang.Integer.MAX_VALUE); - for (int $i = 0; $i < b.items$key.size(); $i++) items.put(b.items$key.get($i), (String) b.items$value.get($i)); - items = java.util.Collections.unmodifiableMap(items); - } - this.items = items; - } - @java.lang.SuppressWarnings("all") - public static SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder builder() { - return new SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl(); - } - @java.lang.SuppressWarnings("all") - public SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder toBuilder() { - return new SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl().$fillValuesFrom(this); - } - } - public static class Child extends Parent { - double field3; - @java.lang.SuppressWarnings("all") - public static abstract class ChildBuilder, B extends SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder> extends Parent.ParentBuilder { - @java.lang.SuppressWarnings("all") - private double field3; - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected B $fillValuesFrom(final C instance) { - super.$fillValuesFrom(instance); - SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); - return self(); - } - @java.lang.SuppressWarnings("all") - private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithGenericsAndToBuilder.Child instance, final SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder b) { - b.field3(instance.field3); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B field3(final double field3) { - this.field3 = field3; - return self(); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; - } - } - @java.lang.SuppressWarnings("all") - private static final class ChildBuilderImpl extends SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder, SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl> { - @java.lang.SuppressWarnings("all") - private ChildBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public SuperBuilderWithGenericsAndToBuilder.Child build() { - return new SuperBuilderWithGenericsAndToBuilder.Child(this); - } - } - @java.lang.SuppressWarnings("all") - protected Child(final SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder b) { - super(b); - this.field3 = b.field3; - } - @java.lang.SuppressWarnings("all") - public static SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder builder() { - return new SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl(); - } - @java.lang.SuppressWarnings("all") - public SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder toBuilder() { - return new SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl().$fillValuesFrom(this); - } - } - public static void test() { - Child x = Child.builder().field3(0.0).field1(5).item(5, "").build().toBuilder().build(); - } -} +import java.util.Map; +public class SuperBuilderWithGenericsAndToBuilder { + public static class Parent { + A field1; + Map items; + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder, B extends SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder> { + @java.lang.SuppressWarnings("all") + private A field1; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList items$key; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList items$value; + @java.lang.SuppressWarnings("all") + protected B $fillValuesFrom(final C instance) { + SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + @java.lang.SuppressWarnings("all") + private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithGenericsAndToBuilder.Parent instance, final SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder b) { + b.field1(instance.field1); + b.items(instance.items == null ? java.util.Collections.emptyMap() : instance.items); + } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B field1(final A field1) { + this.field1 = field1; + return self(); + } + @java.lang.SuppressWarnings("all") + public B item(final Integer itemKey, final String itemValue) { + if (this.items$key == null) { + this.items$key = new java.util.ArrayList(); + this.items$value = new java.util.ArrayList(); + } + this.items$key.add(itemKey); + this.items$value.add(itemValue); + return self(); + } + @java.lang.SuppressWarnings("all") + public B items(final java.util.Map items) { + if (items == null) { + throw new java.lang.NullPointerException("items cannot be null"); + } + if (this.items$key == null) { + this.items$key = new java.util.ArrayList(); + this.items$value = new java.util.ArrayList(); + } + for (final java.util.Map.Entry $lombokEntry : items.entrySet()) { + this.items$key.add($lombokEntry.getKey()); + this.items$value.add($lombokEntry.getValue()); + } + return self(); + } + @java.lang.SuppressWarnings("all") + public B clearItems() { + if (this.items$key != null) { + this.items$key.clear(); + this.items$value.clear(); + } + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder(field1=" + this.field1 + ", items$key=" + this.items$key + ", items$value=" + this.items$value + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl extends SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder, SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithGenericsAndToBuilder.Parent build() { + return new SuperBuilderWithGenericsAndToBuilder.Parent(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder b) { + this.field1 = b.field1; + java.util.Map items; + switch (b.items$key == null ? 0 : b.items$key.size()) { + case 0: + items = java.util.Collections.emptyMap(); + break; + case 1: + items = java.util.Collections.singletonMap(b.items$key.get(0), b.items$value.get(0)); + break; + default: + items = new java.util.LinkedHashMap(b.items$key.size() < 1073741824 ? 1 + b.items$key.size() + (b.items$key.size() - 3) / 3 : java.lang.Integer.MAX_VALUE); + for (int $i = 0; $i < b.items$key.size(); $i++) items.put(b.items$key.get($i), (String) b.items$value.get($i)); + items = java.util.Collections.unmodifiableMap(items); + } + this.items = items; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder builder() { + return new SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl(); + } + @java.lang.SuppressWarnings("all") + public SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder toBuilder() { + return new SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl().$fillValuesFrom(this); + } + } + public static class Child extends Parent { + double field3; + @java.lang.SuppressWarnings("all") + public static abstract class ChildBuilder, B extends SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder> extends Parent.ParentBuilder { + @java.lang.SuppressWarnings("all") + private double field3; + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected B $fillValuesFrom(final C instance) { + super.$fillValuesFrom(instance); + SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + @java.lang.SuppressWarnings("all") + private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithGenericsAndToBuilder.Child instance, final SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder b) { + b.field3(instance.field3); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.Override + @java.lang.SuppressWarnings("all") + public abstract C build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B field3(final double field3) { + this.field3 = field3; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ChildBuilderImpl extends SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder, SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithGenericsAndToBuilder.Child build() { + return new SuperBuilderWithGenericsAndToBuilder.Child(this); + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder b) { + super(b); + this.field3 = b.field3; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder builder() { + return new SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl(); + } + @java.lang.SuppressWarnings("all") + public SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder toBuilder() { + return new SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl().$fillValuesFrom(this); + } + } + public static void test() { + Child x = Child.builder().field3(0.0).field1(5).item(5, "").build().toBuilder().build(); + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java b/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java index fe3e3173..a3e15e8d 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java @@ -1,130 +1,130 @@ -//version 8: -import java.util.List; -public class SuperBuilderWithNonNull { - public static class Parent { - @lombok.NonNull - final String nonNullParentField; - @java.lang.SuppressWarnings("all") - private static String $default$nonNullParentField() { - return "default"; - } - @java.lang.SuppressWarnings("all") - public static abstract class ParentBuilder> { - @java.lang.SuppressWarnings("all") - private boolean nonNullParentField$set; - @java.lang.SuppressWarnings("all") - private String nonNullParentField$value; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B nonNullParentField(@lombok.NonNull final String nonNullParentField) { - if (nonNullParentField == null) { - throw new java.lang.NullPointerException("nonNullParentField is marked non-null but is null"); - } - this.nonNullParentField$value = nonNullParentField; - nonNullParentField$set = true; - return self(); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderWithNonNull.Parent.ParentBuilder(nonNullParentField$value=" + this.nonNullParentField$value + ")"; - } - } - @java.lang.SuppressWarnings("all") - private static final class ParentBuilderImpl extends SuperBuilderWithNonNull.Parent.ParentBuilder { - @java.lang.SuppressWarnings("all") - private ParentBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderWithNonNull.Parent.ParentBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public SuperBuilderWithNonNull.Parent build() { - return new SuperBuilderWithNonNull.Parent(this); - } - } - @java.lang.SuppressWarnings("all") - protected Parent(final SuperBuilderWithNonNull.Parent.ParentBuilder b) { - if (b.nonNullParentField$set) this.nonNullParentField = b.nonNullParentField$value; - else this.nonNullParentField = SuperBuilderWithNonNull.Parent.$default$nonNullParentField(); - if (nonNullParentField == null) { - throw new java.lang.NullPointerException("nonNullParentField is marked non-null but is null"); - } - } - @java.lang.SuppressWarnings("all") - public static SuperBuilderWithNonNull.Parent.ParentBuilder builder() { - return new SuperBuilderWithNonNull.Parent.ParentBuilderImpl(); - } - } - public static class Child extends Parent { - @lombok.NonNull - String nonNullChildField; - @java.lang.SuppressWarnings("all") - public static abstract class ChildBuilder> extends Parent.ParentBuilder { - @java.lang.SuppressWarnings("all") - private String nonNullChildField; - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B nonNullChildField(@lombok.NonNull final String nonNullChildField) { - if (nonNullChildField == null) { - throw new java.lang.NullPointerException("nonNullChildField is marked non-null but is null"); - } - this.nonNullChildField = nonNullChildField; - return self(); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderWithNonNull.Child.ChildBuilder(super=" + super.toString() + ", nonNullChildField=" + this.nonNullChildField + ")"; - } - } - @java.lang.SuppressWarnings("all") - private static final class ChildBuilderImpl extends SuperBuilderWithNonNull.Child.ChildBuilder { - @java.lang.SuppressWarnings("all") - private ChildBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderWithNonNull.Child.ChildBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public SuperBuilderWithNonNull.Child build() { - return new SuperBuilderWithNonNull.Child(this); - } - } - @java.lang.SuppressWarnings("all") - protected Child(final SuperBuilderWithNonNull.Child.ChildBuilder b) { - super(b); - this.nonNullChildField = b.nonNullChildField; - if (nonNullChildField == null) { - throw new java.lang.NullPointerException("nonNullChildField is marked non-null but is null"); - } - } - @java.lang.SuppressWarnings("all") - public static SuperBuilderWithNonNull.Child.ChildBuilder builder() { - return new SuperBuilderWithNonNull.Child.ChildBuilderImpl(); - } - } - public static void test() { - Child x = Child.builder().nonNullChildField("child").nonNullParentField("parent").build(); - } -} +//version 8: +import java.util.List; +public class SuperBuilderWithNonNull { + public static class Parent { + @lombok.NonNull + final String nonNullParentField; + @java.lang.SuppressWarnings("all") + private static String $default$nonNullParentField() { + return "default"; + } + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder> { + @java.lang.SuppressWarnings("all") + private boolean nonNullParentField$set; + @java.lang.SuppressWarnings("all") + private String nonNullParentField$value; + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B nonNullParentField(@lombok.NonNull final String nonNullParentField) { + if (nonNullParentField == null) { + throw new java.lang.NullPointerException("nonNullParentField is marked non-null but is null"); + } + this.nonNullParentField$value = nonNullParentField; + nonNullParentField$set = true; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithNonNull.Parent.ParentBuilder(nonNullParentField$value=" + this.nonNullParentField$value + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl extends SuperBuilderWithNonNull.Parent.ParentBuilder { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithNonNull.Parent.ParentBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithNonNull.Parent build() { + return new SuperBuilderWithNonNull.Parent(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderWithNonNull.Parent.ParentBuilder b) { + if (b.nonNullParentField$set) this.nonNullParentField = b.nonNullParentField$value; + else this.nonNullParentField = SuperBuilderWithNonNull.Parent.$default$nonNullParentField(); + if (nonNullParentField == null) { + throw new java.lang.NullPointerException("nonNullParentField is marked non-null but is null"); + } + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderWithNonNull.Parent.ParentBuilder builder() { + return new SuperBuilderWithNonNull.Parent.ParentBuilderImpl(); + } + } + public static class Child extends Parent { + @lombok.NonNull + String nonNullChildField; + @java.lang.SuppressWarnings("all") + public static abstract class ChildBuilder> extends Parent.ParentBuilder { + @java.lang.SuppressWarnings("all") + private String nonNullChildField; + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.Override + @java.lang.SuppressWarnings("all") + public abstract C build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B nonNullChildField(@lombok.NonNull final String nonNullChildField) { + if (nonNullChildField == null) { + throw new java.lang.NullPointerException("nonNullChildField is marked non-null but is null"); + } + this.nonNullChildField = nonNullChildField; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithNonNull.Child.ChildBuilder(super=" + super.toString() + ", nonNullChildField=" + this.nonNullChildField + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ChildBuilderImpl extends SuperBuilderWithNonNull.Child.ChildBuilder { + @java.lang.SuppressWarnings("all") + private ChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithNonNull.Child.ChildBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithNonNull.Child build() { + return new SuperBuilderWithNonNull.Child(this); + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderWithNonNull.Child.ChildBuilder b) { + super(b); + this.nonNullChildField = b.nonNullChildField; + if (nonNullChildField == null) { + throw new java.lang.NullPointerException("nonNullChildField is marked non-null but is null"); + } + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderWithNonNull.Child.ChildBuilder builder() { + return new SuperBuilderWithNonNull.Child.ChildBuilderImpl(); + } + } + public static void test() { + Child x = Child.builder().nonNullChildField("child").nonNullParentField("parent").build(); + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderWithSetterPrefix.java b/test/transform/resource/after-delombok/SuperBuilderWithSetterPrefix.java index 0f007350..1490540e 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithSetterPrefix.java @@ -1,216 +1,216 @@ -import java.util.List; -public class SuperBuilderWithSetterPrefix { - public static class Parent { - private int field1; - int obtainViaField; - int obtainViaMethod; - String obtainViaStaticMethod; - List items; - private int method() { - return 2; - } - private static String staticMethod(Parent instance) { - return "staticMethod"; - } - @java.lang.SuppressWarnings("all") - public static abstract class ParentBuilder> { - @java.lang.SuppressWarnings("all") - private int field1; - @java.lang.SuppressWarnings("all") - private int obtainViaField; - @java.lang.SuppressWarnings("all") - private int obtainViaMethod; - @java.lang.SuppressWarnings("all") - private String obtainViaStaticMethod; - @java.lang.SuppressWarnings("all") - private java.util.ArrayList items; - @java.lang.SuppressWarnings("all") - protected B $fillValuesFrom(final C instance) { - SuperBuilderWithSetterPrefix.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); - return self(); - } - @java.lang.SuppressWarnings("all") - private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithSetterPrefix.Parent instance, final SuperBuilderWithSetterPrefix.Parent.ParentBuilder b) { - b.withField1(instance.field1); - b.withObtainViaField(instance.field1); - b.withObtainViaMethod(instance.method()); - b.withObtainViaStaticMethod(SuperBuilderWithSetterPrefix.Parent.staticMethod(instance)); - b.withItems(instance.items == null ? java.util.Collections.emptyList() : instance.items); - } - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B withField1(final int field1) { - this.field1 = field1; - return self(); - } - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B withObtainViaField(final int obtainViaField) { - this.obtainViaField = obtainViaField; - return self(); - } - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B withObtainViaMethod(final int obtainViaMethod) { - this.obtainViaMethod = obtainViaMethod; - return self(); - } - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B withObtainViaStaticMethod(final String obtainViaStaticMethod) { - this.obtainViaStaticMethod = obtainViaStaticMethod; - return self(); - } - @java.lang.SuppressWarnings("all") - public B withItem(final String item) { - if (this.items == null) this.items = new java.util.ArrayList(); - this.items.add(item); - return self(); - } - @java.lang.SuppressWarnings("all") - public B withItems(final java.util.Collection items) { - if (items == null) { - throw new java.lang.NullPointerException("items cannot be null"); - } - if (this.items == null) this.items = new java.util.ArrayList(); - this.items.addAll(items); - return self(); - } - @java.lang.SuppressWarnings("all") - public B clearItems() { - if (this.items != null) this.items.clear(); - return self(); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderWithSetterPrefix.Parent.ParentBuilder(field1=" + this.field1 + ", obtainViaField=" + this.obtainViaField + ", obtainViaMethod=" + this.obtainViaMethod + ", obtainViaStaticMethod=" + this.obtainViaStaticMethod + ", items=" + this.items + ")"; - } - } - @java.lang.SuppressWarnings("all") - private static final class ParentBuilderImpl extends SuperBuilderWithSetterPrefix.Parent.ParentBuilder { - @java.lang.SuppressWarnings("all") - private ParentBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public SuperBuilderWithSetterPrefix.Parent build() { - return new SuperBuilderWithSetterPrefix.Parent(this); - } - } - @java.lang.SuppressWarnings("all") - protected Parent(final SuperBuilderWithSetterPrefix.Parent.ParentBuilder b) { - 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: - items = java.util.Collections.emptyList(); - break; - case 1: - items = java.util.Collections.singletonList(b.items.get(0)); - break; - default: - items = java.util.Collections.unmodifiableList(new java.util.ArrayList(b.items)); - } - this.items = items; - } - @java.lang.SuppressWarnings("all") - public static SuperBuilderWithSetterPrefix.Parent.ParentBuilder builder() { - return new SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl(); - } - @java.lang.SuppressWarnings("all") - public SuperBuilderWithSetterPrefix.Parent.ParentBuilder toBuilder() { - return new SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl().$fillValuesFrom(this); - } - } - public static class Child extends Parent { - private double field3; - @java.lang.SuppressWarnings("all") - public static abstract class ChildBuilder> extends Parent.ParentBuilder { - @java.lang.SuppressWarnings("all") - private double field3; - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected B $fillValuesFrom(final C instance) { - super.$fillValuesFrom(instance); - SuperBuilderWithSetterPrefix.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); - return self(); - } - @java.lang.SuppressWarnings("all") - private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithSetterPrefix.Child instance, final SuperBuilderWithSetterPrefix.Child.ChildBuilder b) { - b.setField3(instance.field3); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** - * @return {@code this}. - */ - @java.lang.SuppressWarnings("all") - public B setField3(final double field3) { - this.field3 = field3; - return self(); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "SuperBuilderWithSetterPrefix.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; - } - } - @java.lang.SuppressWarnings("all") - private static final class ChildBuilderImpl extends SuperBuilderWithSetterPrefix.Child.ChildBuilder { - @java.lang.SuppressWarnings("all") - private ChildBuilderImpl() { - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - protected SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl self() { - return this; - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public SuperBuilderWithSetterPrefix.Child build() { - return new SuperBuilderWithSetterPrefix.Child(this); - } - } - @java.lang.SuppressWarnings("all") - protected Child(final SuperBuilderWithSetterPrefix.Child.ChildBuilder b) { - super(b); - this.field3 = b.field3; - } - @java.lang.SuppressWarnings("all") - public static SuperBuilderWithSetterPrefix.Child.ChildBuilder builder() { - return new SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl(); - } - @java.lang.SuppressWarnings("all") - public SuperBuilderWithSetterPrefix.Child.ChildBuilder toBuilder() { - return new SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl().$fillValuesFrom(this); - } - } - public static void test() { - Child x = Child.builder().setField3(0.0).withField1(5).withItem("").build().toBuilder().build(); - } -} +import java.util.List; +public class SuperBuilderWithSetterPrefix { + public static class Parent { + private int field1; + int obtainViaField; + int obtainViaMethod; + String obtainViaStaticMethod; + List items; + private int method() { + return 2; + } + private static String staticMethod(Parent instance) { + return "staticMethod"; + } + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder> { + @java.lang.SuppressWarnings("all") + private int field1; + @java.lang.SuppressWarnings("all") + private int obtainViaField; + @java.lang.SuppressWarnings("all") + private int obtainViaMethod; + @java.lang.SuppressWarnings("all") + private String obtainViaStaticMethod; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList items; + @java.lang.SuppressWarnings("all") + protected B $fillValuesFrom(final C instance) { + SuperBuilderWithSetterPrefix.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + @java.lang.SuppressWarnings("all") + private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithSetterPrefix.Parent instance, final SuperBuilderWithSetterPrefix.Parent.ParentBuilder b) { + b.withField1(instance.field1); + b.withObtainViaField(instance.field1); + b.withObtainViaMethod(instance.method()); + b.withObtainViaStaticMethod(SuperBuilderWithSetterPrefix.Parent.staticMethod(instance)); + b.withItems(instance.items == null ? java.util.Collections.emptyList() : instance.items); + } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B withField1(final int field1) { + this.field1 = field1; + return self(); + } + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B withObtainViaField(final int obtainViaField) { + this.obtainViaField = obtainViaField; + return self(); + } + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B withObtainViaMethod(final int obtainViaMethod) { + this.obtainViaMethod = obtainViaMethod; + return self(); + } + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B withObtainViaStaticMethod(final String obtainViaStaticMethod) { + this.obtainViaStaticMethod = obtainViaStaticMethod; + return self(); + } + @java.lang.SuppressWarnings("all") + public B withItem(final String item) { + if (this.items == null) this.items = new java.util.ArrayList(); + this.items.add(item); + return self(); + } + @java.lang.SuppressWarnings("all") + public B withItems(final java.util.Collection items) { + if (items == null) { + throw new java.lang.NullPointerException("items cannot be null"); + } + if (this.items == null) this.items = new java.util.ArrayList(); + this.items.addAll(items); + return self(); + } + @java.lang.SuppressWarnings("all") + public B clearItems() { + if (this.items != null) this.items.clear(); + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithSetterPrefix.Parent.ParentBuilder(field1=" + this.field1 + ", obtainViaField=" + this.obtainViaField + ", obtainViaMethod=" + this.obtainViaMethod + ", obtainViaStaticMethod=" + this.obtainViaStaticMethod + ", items=" + this.items + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl extends SuperBuilderWithSetterPrefix.Parent.ParentBuilder { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithSetterPrefix.Parent build() { + return new SuperBuilderWithSetterPrefix.Parent(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderWithSetterPrefix.Parent.ParentBuilder b) { + 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: + items = java.util.Collections.emptyList(); + break; + case 1: + items = java.util.Collections.singletonList(b.items.get(0)); + break; + default: + items = java.util.Collections.unmodifiableList(new java.util.ArrayList(b.items)); + } + this.items = items; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderWithSetterPrefix.Parent.ParentBuilder builder() { + return new SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl(); + } + @java.lang.SuppressWarnings("all") + public SuperBuilderWithSetterPrefix.Parent.ParentBuilder toBuilder() { + return new SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl().$fillValuesFrom(this); + } + } + public static class Child extends Parent { + private double field3; + @java.lang.SuppressWarnings("all") + public static abstract class ChildBuilder> extends Parent.ParentBuilder { + @java.lang.SuppressWarnings("all") + private double field3; + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected B $fillValuesFrom(final C instance) { + super.$fillValuesFrom(instance); + SuperBuilderWithSetterPrefix.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + @java.lang.SuppressWarnings("all") + private static void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithSetterPrefix.Child instance, final SuperBuilderWithSetterPrefix.Child.ChildBuilder b) { + b.setField3(instance.field3); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.Override + @java.lang.SuppressWarnings("all") + public abstract C build(); + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B setField3(final double field3) { + this.field3 = field3; + return self(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "SuperBuilderWithSetterPrefix.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ChildBuilderImpl extends SuperBuilderWithSetterPrefix.Child.ChildBuilder { + @java.lang.SuppressWarnings("all") + private ChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithSetterPrefix.Child build() { + return new SuperBuilderWithSetterPrefix.Child(this); + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderWithSetterPrefix.Child.ChildBuilder b) { + super(b); + this.field3 = b.field3; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderWithSetterPrefix.Child.ChildBuilder builder() { + return new SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl(); + } + @java.lang.SuppressWarnings("all") + public SuperBuilderWithSetterPrefix.Child.ChildBuilder toBuilder() { + return new SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl().$fillValuesFrom(this); + } + } + public static void test() { + Child x = Child.builder().setField3(0.0).withField1(5).withItem("").build().toBuilder().build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderAbstract.java b/test/transform/resource/after-ecj/SuperBuilderAbstract.java index 88406272..2fef9451 100644 --- a/test/transform/resource/after-ecj/SuperBuilderAbstract.java +++ b/test/transform/resource/after-ecj/SuperBuilderAbstract.java @@ -1,111 +1,111 @@ -public class SuperBuilderAbstract { - public static @lombok.experimental.SuperBuilder class Parent { - public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder> { - private @java.lang.SuppressWarnings("all") int parentField; - public ParentBuilder() { - super(); - } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B parentField(final int parentField) { - this.parentField = parentField; - return self(); - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("SuperBuilderAbstract.Parent.ParentBuilder(parentField=" + this.parentField) + ")"); - } - } - private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderAbstract.Parent.ParentBuilder { - private ParentBuilderImpl() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstract.Parent.ParentBuilderImpl self() { - return this; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstract.Parent build() { - return new SuperBuilderAbstract.Parent(this); - } - } - int parentField; - protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderAbstract.Parent.ParentBuilder b) { - super(); - this.parentField = b.parentField; - } - public static @java.lang.SuppressWarnings("all") SuperBuilderAbstract.Parent.ParentBuilder builder() { - return new SuperBuilderAbstract.Parent.ParentBuilderImpl(); - } - } - public static abstract @lombok.experimental.SuperBuilder class Child extends Parent { - public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder> extends Parent.ParentBuilder { - private @java.lang.SuppressWarnings("all") double childField; - public ChildBuilder() { - super(); - } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B childField(final double childField) { - this.childField = childField; - return self(); - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("SuperBuilderAbstract.Child.ChildBuilder(super=" + super.toString()) + ", childField=") + this.childField) + ")"); - } - } - double childField; - protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderAbstract.Child.ChildBuilder b) { - super(b); - this.childField = b.childField; - } - } - public static @lombok.experimental.SuperBuilder class GrandChild extends Child { - public static abstract @java.lang.SuppressWarnings("all") class GrandChildBuilder> extends Child.ChildBuilder { - private @java.lang.SuppressWarnings("all") String grandChildField; - public GrandChildBuilder() { - super(); - } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B grandChildField(final String grandChildField) { - this.grandChildField = grandChildField; - return self(); - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("SuperBuilderAbstract.GrandChild.GrandChildBuilder(super=" + super.toString()) + ", grandChildField=") + this.grandChildField) + ")"); - } - } - private static final @java.lang.SuppressWarnings("all") class GrandChildBuilderImpl extends SuperBuilderAbstract.GrandChild.GrandChildBuilder { - private GrandChildBuilderImpl() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl self() { - return this; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstract.GrandChild build() { - return new SuperBuilderAbstract.GrandChild(this); - } - } - String grandChildField; - protected @java.lang.SuppressWarnings("all") GrandChild(final SuperBuilderAbstract.GrandChild.GrandChildBuilder b) { - super(b); - this.grandChildField = b.grandChildField; - } - public static @java.lang.SuppressWarnings("all") SuperBuilderAbstract.GrandChild.GrandChildBuilder builder() { - return new SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl(); - } - } - public SuperBuilderAbstract() { - super(); - } - public static void test() { - GrandChild x = GrandChild.builder().grandChildField("").parentField(5).childField(2.5).build(); - } -} +public class SuperBuilderAbstract { + public static @lombok.experimental.SuperBuilder class Parent { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder> { + private @java.lang.SuppressWarnings("all") int parentField; + public ParentBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B parentField(final int parentField) { + this.parentField = parentField; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("SuperBuilderAbstract.Parent.ParentBuilder(parentField=" + this.parentField) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderAbstract.Parent.ParentBuilder { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstract.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstract.Parent build() { + return new SuperBuilderAbstract.Parent(this); + } + } + int parentField; + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderAbstract.Parent.ParentBuilder b) { + super(); + this.parentField = b.parentField; + } + public static @java.lang.SuppressWarnings("all") SuperBuilderAbstract.Parent.ParentBuilder builder() { + return new SuperBuilderAbstract.Parent.ParentBuilderImpl(); + } + } + public static abstract @lombok.experimental.SuperBuilder class Child extends Parent { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder> extends Parent.ParentBuilder { + private @java.lang.SuppressWarnings("all") double childField; + public ChildBuilder() { + super(); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B childField(final double childField) { + this.childField = childField; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderAbstract.Child.ChildBuilder(super=" + super.toString()) + ", childField=") + this.childField) + ")"); + } + } + double childField; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderAbstract.Child.ChildBuilder b) { + super(b); + this.childField = b.childField; + } + } + public static @lombok.experimental.SuperBuilder class GrandChild extends Child { + public static abstract @java.lang.SuppressWarnings("all") class GrandChildBuilder> extends Child.ChildBuilder { + private @java.lang.SuppressWarnings("all") String grandChildField; + public GrandChildBuilder() { + super(); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B grandChildField(final String grandChildField) { + this.grandChildField = grandChildField; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderAbstract.GrandChild.GrandChildBuilder(super=" + super.toString()) + ", grandChildField=") + this.grandChildField) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class GrandChildBuilderImpl extends SuperBuilderAbstract.GrandChild.GrandChildBuilder { + private GrandChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstract.GrandChild build() { + return new SuperBuilderAbstract.GrandChild(this); + } + } + String grandChildField; + protected @java.lang.SuppressWarnings("all") GrandChild(final SuperBuilderAbstract.GrandChild.GrandChildBuilder b) { + super(b); + this.grandChildField = b.grandChildField; + } + public static @java.lang.SuppressWarnings("all") SuperBuilderAbstract.GrandChild.GrandChildBuilder builder() { + return new SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl(); + } + } + public SuperBuilderAbstract() { + super(); + } + public static void test() { + GrandChild x = GrandChild.builder().grandChildField("").parentField(5).childField(2.5).build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderAbstractToBuilder.java b/test/transform/resource/after-ecj/SuperBuilderAbstractToBuilder.java index d1ce4fa9..2d2cd422 100644 --- a/test/transform/resource/after-ecj/SuperBuilderAbstractToBuilder.java +++ b/test/transform/resource/after-ecj/SuperBuilderAbstractToBuilder.java @@ -1,140 +1,140 @@ -public class SuperBuilderAbstractToBuilder { - public static @lombok.experimental.SuperBuilder(toBuilder = true) class Parent { - public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder> { - private @java.lang.SuppressWarnings("all") int parentField; - public ParentBuilder() { - super(); - } - protected @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { - SuperBuilderAbstractToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); - return self(); - } - private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderAbstractToBuilder.Parent instance, final SuperBuilderAbstractToBuilder.Parent.ParentBuilder b) { - b.parentField(instance.parentField); - } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B parentField(final int parentField) { - this.parentField = parentField; - return self(); - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("SuperBuilderAbstractToBuilder.Parent.ParentBuilder(parentField=" + this.parentField) + ")"); - } - } - private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderAbstractToBuilder.Parent.ParentBuilder { - private ParentBuilderImpl() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl self() { - return this; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.Parent build() { - return new SuperBuilderAbstractToBuilder.Parent(this); - } - } - int parentField; - protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderAbstractToBuilder.Parent.ParentBuilder b) { - super(); - this.parentField = b.parentField; - } - public @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.Parent.ParentBuilder toBuilder() { - return new SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl().$fillValuesFrom(this); - } - public static @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.Parent.ParentBuilder builder() { - return new SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl(); - } - } - public static abstract @lombok.experimental.SuperBuilder(toBuilder = true) class Child extends Parent { - public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder> extends Parent.ParentBuilder { - private @java.lang.SuppressWarnings("all") double childField; - public ChildBuilder() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { - super.$fillValuesFrom(instance); - SuperBuilderAbstractToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); - return self(); - } - private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderAbstractToBuilder.Child instance, final SuperBuilderAbstractToBuilder.Child.ChildBuilder b) { - b.childField(instance.childField); - } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B childField(final double childField) { - this.childField = childField; - return self(); - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("SuperBuilderAbstractToBuilder.Child.ChildBuilder(super=" + super.toString()) + ", childField=") + this.childField) + ")"); - } - } - double childField; - protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderAbstractToBuilder.Child.ChildBuilder b) { - super(b); - this.childField = b.childField; - } - } - public static @lombok.experimental.SuperBuilder(toBuilder = true) class GrandChild extends Child { - public static abstract @java.lang.SuppressWarnings("all") class GrandChildBuilder> extends Child.ChildBuilder { - private @java.lang.SuppressWarnings("all") String grandChildField; - public GrandChildBuilder() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { - super.$fillValuesFrom(instance); - SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); - return self(); - } - private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderAbstractToBuilder.GrandChild instance, final SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder b) { - b.grandChildField(instance.grandChildField); - } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B grandChildField(final String grandChildField) { - this.grandChildField = grandChildField; - return self(); - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder(super=" + super.toString()) + ", grandChildField=") + this.grandChildField) + ")"); - } - } - private static final @java.lang.SuppressWarnings("all") class GrandChildBuilderImpl extends SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder { - private GrandChildBuilderImpl() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl self() { - return this; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.GrandChild build() { - return new SuperBuilderAbstractToBuilder.GrandChild(this); - } - } - String grandChildField; - protected @java.lang.SuppressWarnings("all") GrandChild(final SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder b) { - super(b); - this.grandChildField = b.grandChildField; - } - public @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder toBuilder() { - return new SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl().$fillValuesFrom(this); - } - public static @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder builder() { - return new SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl(); - } - } - public SuperBuilderAbstractToBuilder() { - super(); - } - public static void test() { - GrandChild x = GrandChild.builder().grandChildField("").parentField(5).childField(2.5).build().toBuilder().build(); - } -} +public class SuperBuilderAbstractToBuilder { + public static @lombok.experimental.SuperBuilder(toBuilder = true) class Parent { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder> { + private @java.lang.SuppressWarnings("all") int parentField; + public ParentBuilder() { + super(); + } + protected @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { + SuperBuilderAbstractToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderAbstractToBuilder.Parent instance, final SuperBuilderAbstractToBuilder.Parent.ParentBuilder b) { + b.parentField(instance.parentField); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B parentField(final int parentField) { + this.parentField = parentField; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("SuperBuilderAbstractToBuilder.Parent.ParentBuilder(parentField=" + this.parentField) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderAbstractToBuilder.Parent.ParentBuilder { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.Parent build() { + return new SuperBuilderAbstractToBuilder.Parent(this); + } + } + int parentField; + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderAbstractToBuilder.Parent.ParentBuilder b) { + super(); + this.parentField = b.parentField; + } + public @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.Parent.ParentBuilder toBuilder() { + return new SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl().$fillValuesFrom(this); + } + public static @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.Parent.ParentBuilder builder() { + return new SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl(); + } + } + public static abstract @lombok.experimental.SuperBuilder(toBuilder = true) class Child extends Parent { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder> extends Parent.ParentBuilder { + private @java.lang.SuppressWarnings("all") double childField; + public ChildBuilder() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { + super.$fillValuesFrom(instance); + SuperBuilderAbstractToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderAbstractToBuilder.Child instance, final SuperBuilderAbstractToBuilder.Child.ChildBuilder b) { + b.childField(instance.childField); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B childField(final double childField) { + this.childField = childField; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderAbstractToBuilder.Child.ChildBuilder(super=" + super.toString()) + ", childField=") + this.childField) + ")"); + } + } + double childField; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderAbstractToBuilder.Child.ChildBuilder b) { + super(b); + this.childField = b.childField; + } + } + public static @lombok.experimental.SuperBuilder(toBuilder = true) class GrandChild extends Child { + public static abstract @java.lang.SuppressWarnings("all") class GrandChildBuilder> extends Child.ChildBuilder { + private @java.lang.SuppressWarnings("all") String grandChildField; + public GrandChildBuilder() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { + super.$fillValuesFrom(instance); + SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderAbstractToBuilder.GrandChild instance, final SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder b) { + b.grandChildField(instance.grandChildField); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B grandChildField(final String grandChildField) { + this.grandChildField = grandChildField; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder(super=" + super.toString()) + ", grandChildField=") + this.grandChildField) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class GrandChildBuilderImpl extends SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder { + private GrandChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.GrandChild build() { + return new SuperBuilderAbstractToBuilder.GrandChild(this); + } + } + String grandChildField; + protected @java.lang.SuppressWarnings("all") GrandChild(final SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder b) { + super(b); + this.grandChildField = b.grandChildField; + } + public @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder toBuilder() { + return new SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl().$fillValuesFrom(this); + } + public static @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder builder() { + return new SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl(); + } + } + public SuperBuilderAbstractToBuilder() { + super(); + } + public static void test() { + GrandChild x = GrandChild.builder().grandChildField("").parentField(5).childField(2.5).build().toBuilder().build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderBasic.java b/test/transform/resource/after-ecj/SuperBuilderBasic.java index b5e835d4..844206d0 100644 --- a/test/transform/resource/after-ecj/SuperBuilderBasic.java +++ b/test/transform/resource/after-ecj/SuperBuilderBasic.java @@ -1,122 +1,122 @@ -import java.util.List; -public class SuperBuilderBasic { - public static @lombok.experimental.SuperBuilder class Parent { - public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder> { - private @java.lang.SuppressWarnings("all") int field1; - private @java.lang.SuppressWarnings("all") java.util.ArrayList items; - public ParentBuilder() { - super(); - } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B field1(final int field1) { - this.field1 = field1; - return self(); - } - public @java.lang.SuppressWarnings("all") B item(final String item) { - if ((this.items == null)) - this.items = new java.util.ArrayList(); - this.items.add(item); - return self(); - } - public @java.lang.SuppressWarnings("all") B items(final java.util.Collection items) { - if ((items == null)) - { - throw new java.lang.NullPointerException("items cannot be null"); - } - if ((this.items == null)) - this.items = new java.util.ArrayList(); - this.items.addAll(items); - return self(); - } - public @java.lang.SuppressWarnings("all") B clearItems() { - if ((this.items != null)) - this.items.clear(); - return self(); - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("SuperBuilderBasic.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")"); - } - } - private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderBasic.Parent.ParentBuilder { - private ParentBuilderImpl() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasic.Parent.ParentBuilderImpl self() { - return this; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasic.Parent build() { - return new SuperBuilderBasic.Parent(this); - } - } - int field1; - @lombok.Singular List items; - protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderBasic.Parent.ParentBuilder b) { - super(); - this.field1 = b.field1; - java.util.List items; - switch (((b.items == null) ? 0 : b.items.size())) { - case 0 : - items = java.util.Collections.emptyList(); - break; - case 1 : - items = java.util.Collections.singletonList(b.items.get(0)); - break; - default : - items = java.util.Collections.unmodifiableList(new java.util.ArrayList(b.items)); - } - this.items = items; - } - public static @java.lang.SuppressWarnings("all") SuperBuilderBasic.Parent.ParentBuilder builder() { - return new SuperBuilderBasic.Parent.ParentBuilderImpl(); - } - } - public static @lombok.experimental.SuperBuilder class Child extends SuperBuilderBasic.Parent { - public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder> extends SuperBuilderBasic.Parent.ParentBuilder { - private @java.lang.SuppressWarnings("all") double field3; - public ChildBuilder() { - super(); - } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B field3(final double field3) { - this.field3 = field3; - return self(); - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("SuperBuilderBasic.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); - } - } - private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderBasic.Child.ChildBuilder { - private ChildBuilderImpl() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasic.Child.ChildBuilderImpl self() { - return this; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasic.Child build() { - return new SuperBuilderBasic.Child(this); - } - } - double field3; - protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderBasic.Child.ChildBuilder b) { - super(b); - this.field3 = b.field3; - } - public static @java.lang.SuppressWarnings("all") SuperBuilderBasic.Child.ChildBuilder builder() { - return new SuperBuilderBasic.Child.ChildBuilderImpl(); - } - } - public SuperBuilderBasic() { - super(); - } - public static void test() { - Child x = Child.builder().field3(0.0).field1(5).item("").build(); - } -} +import java.util.List; +public class SuperBuilderBasic { + public static @lombok.experimental.SuperBuilder class Parent { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder> { + private @java.lang.SuppressWarnings("all") int field1; + private @java.lang.SuppressWarnings("all") java.util.ArrayList items; + public ParentBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field1(final int field1) { + this.field1 = field1; + return self(); + } + public @java.lang.SuppressWarnings("all") B item(final String item) { + if ((this.items == null)) + this.items = new java.util.ArrayList(); + this.items.add(item); + return self(); + } + public @java.lang.SuppressWarnings("all") B items(final java.util.Collection items) { + if ((items == null)) + { + throw new java.lang.NullPointerException("items cannot be null"); + } + if ((this.items == null)) + this.items = new java.util.ArrayList(); + this.items.addAll(items); + return self(); + } + public @java.lang.SuppressWarnings("all") B clearItems() { + if ((this.items != null)) + this.items.clear(); + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderBasic.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderBasic.Parent.ParentBuilder { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasic.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasic.Parent build() { + return new SuperBuilderBasic.Parent(this); + } + } + int field1; + @lombok.Singular List items; + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderBasic.Parent.ParentBuilder b) { + super(); + this.field1 = b.field1; + java.util.List items; + switch (((b.items == null) ? 0 : b.items.size())) { + case 0 : + items = java.util.Collections.emptyList(); + break; + case 1 : + items = java.util.Collections.singletonList(b.items.get(0)); + break; + default : + items = java.util.Collections.unmodifiableList(new java.util.ArrayList(b.items)); + } + this.items = items; + } + public static @java.lang.SuppressWarnings("all") SuperBuilderBasic.Parent.ParentBuilder builder() { + return new SuperBuilderBasic.Parent.ParentBuilderImpl(); + } + } + public static @lombok.experimental.SuperBuilder class Child extends SuperBuilderBasic.Parent { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder> extends SuperBuilderBasic.Parent.ParentBuilder { + private @java.lang.SuppressWarnings("all") double field3; + public ChildBuilder() { + super(); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field3(final double field3) { + this.field3 = field3; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderBasic.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderBasic.Child.ChildBuilder { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasic.Child.ChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasic.Child build() { + return new SuperBuilderBasic.Child(this); + } + } + double field3; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderBasic.Child.ChildBuilder b) { + super(b); + this.field3 = b.field3; + } + public static @java.lang.SuppressWarnings("all") SuperBuilderBasic.Child.ChildBuilder builder() { + return new SuperBuilderBasic.Child.ChildBuilderImpl(); + } + } + public SuperBuilderBasic() { + super(); + } + public static void test() { + Child x = Child.builder().field3(0.0).field1(5).item("").build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderBasicToBuilder.java b/test/transform/resource/after-ecj/SuperBuilderBasicToBuilder.java index f6d298e1..70b54c16 100644 --- a/test/transform/resource/after-ecj/SuperBuilderBasicToBuilder.java +++ b/test/transform/resource/after-ecj/SuperBuilderBasicToBuilder.java @@ -1,183 +1,183 @@ -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) { - SuperBuilderBasicToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); - return self(); - } - private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderBasicToBuilder.Parent instance, final SuperBuilderBasicToBuilder.Parent.ParentBuilder b) { - b.field1(instance.field1); - b.obtainViaField(instance.field1); - b.obtainViaMethod(instance.method()); - b.obtainViaStaticMethod(SuperBuilderBasicToBuilder.Parent.staticMethod(instance)); - b.items(((instance.items == null) ? java.util.Collections.emptyList() : instance.items)); - } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B field1(final int field1) { - this.field1 = field1; - return self(); - } - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B obtainViaField(final int obtainViaField) { - this.obtainViaField = obtainViaField; - return self(); - } - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B obtainViaMethod(final int obtainViaMethod) { - this.obtainViaMethod = obtainViaMethod; - return self(); - } - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B obtainViaStaticMethod(final String obtainViaStaticMethod) { - this.obtainViaStaticMethod = obtainViaStaticMethod; - return self(); - } - public @java.lang.SuppressWarnings("all") B item(final String item) { - if ((this.items == null)) - this.items = new java.util.ArrayList(); - this.items.add(item); - return self(); - } - public @java.lang.SuppressWarnings("all") B items(final java.util.Collection items) { - if ((items == null)) - { - throw new java.lang.NullPointerException("items cannot be null"); - } - if ((this.items == null)) - this.items = new java.util.ArrayList(); - this.items.addAll(items); - return self(); - } - public @java.lang.SuppressWarnings("all") B clearItems() { - if ((this.items != null)) - this.items.clear(); - return self(); - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - 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 SuperBuilderBasicToBuilder.Parent.ParentBuilder { - private ParentBuilderImpl() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl self() { - return this; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Parent build() { - return new SuperBuilderBasicToBuilder.Parent(this); - } - } - 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 items; - private int method() { - return 2; - } - private static String staticMethod(Parent instance) { - return "staticMethod"; - } - protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderBasicToBuilder.Parent.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 : - items = java.util.Collections.emptyList(); - break; - case 1 : - items = java.util.Collections.singletonList(b.items.get(0)); - break; - default : - items = java.util.Collections.unmodifiableList(new java.util.ArrayList(b.items)); - } - this.items = items; - } - public @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Parent.ParentBuilder toBuilder() { - return new SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl().$fillValuesFrom(this); - } - public static @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Parent.ParentBuilder builder() { - return new SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl(); - } - } - public static @lombok.experimental.SuperBuilder(toBuilder = true) class Child extends Parent { - public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder> extends Parent.ParentBuilder { - private @java.lang.SuppressWarnings("all") double field3; - public ChildBuilder() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { - super.$fillValuesFrom(instance); - SuperBuilderBasicToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); - return self(); - } - private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderBasicToBuilder.Child instance, final SuperBuilderBasicToBuilder.Child.ChildBuilder b) { - b.field3(instance.field3); - } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B field3(final double field3) { - this.field3 = field3; - return self(); - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("SuperBuilderBasicToBuilder.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); - } - } - private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderBasicToBuilder.Child.ChildBuilder { - private ChildBuilderImpl() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Child.ChildBuilderImpl self() { - return this; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Child build() { - return new SuperBuilderBasicToBuilder.Child(this); - } - } - private double field3; - protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderBasicToBuilder.Child.ChildBuilder b) { - super(b); - this.field3 = b.field3; - } - public @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Child.ChildBuilder toBuilder() { - return new SuperBuilderBasicToBuilder.Child.ChildBuilderImpl().$fillValuesFrom(this); - } - public static @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Child.ChildBuilder builder() { - return new SuperBuilderBasicToBuilder.Child.ChildBuilderImpl(); - } - } - public SuperBuilderBasicToBuilder() { - super(); - } - public static void test() { - Child x = Child.builder().field3(0.0).field1(5).item("").build().toBuilder().build(); - } -} +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) { + SuperBuilderBasicToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderBasicToBuilder.Parent instance, final SuperBuilderBasicToBuilder.Parent.ParentBuilder b) { + b.field1(instance.field1); + b.obtainViaField(instance.field1); + b.obtainViaMethod(instance.method()); + b.obtainViaStaticMethod(SuperBuilderBasicToBuilder.Parent.staticMethod(instance)); + b.items(((instance.items == null) ? java.util.Collections.emptyList() : instance.items)); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field1(final int field1) { + this.field1 = field1; + return self(); + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B obtainViaField(final int obtainViaField) { + this.obtainViaField = obtainViaField; + return self(); + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B obtainViaMethod(final int obtainViaMethod) { + this.obtainViaMethod = obtainViaMethod; + return self(); + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B obtainViaStaticMethod(final String obtainViaStaticMethod) { + this.obtainViaStaticMethod = obtainViaStaticMethod; + return self(); + } + public @java.lang.SuppressWarnings("all") B item(final String item) { + if ((this.items == null)) + this.items = new java.util.ArrayList(); + this.items.add(item); + return self(); + } + public @java.lang.SuppressWarnings("all") B items(final java.util.Collection items) { + if ((items == null)) + { + throw new java.lang.NullPointerException("items cannot be null"); + } + if ((this.items == null)) + this.items = new java.util.ArrayList(); + this.items.addAll(items); + return self(); + } + public @java.lang.SuppressWarnings("all") B clearItems() { + if ((this.items != null)) + this.items.clear(); + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + 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 SuperBuilderBasicToBuilder.Parent.ParentBuilder { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Parent build() { + return new SuperBuilderBasicToBuilder.Parent(this); + } + } + 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 items; + private int method() { + return 2; + } + private static String staticMethod(Parent instance) { + return "staticMethod"; + } + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderBasicToBuilder.Parent.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 : + items = java.util.Collections.emptyList(); + break; + case 1 : + items = java.util.Collections.singletonList(b.items.get(0)); + break; + default : + items = java.util.Collections.unmodifiableList(new java.util.ArrayList(b.items)); + } + this.items = items; + } + public @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Parent.ParentBuilder toBuilder() { + return new SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl().$fillValuesFrom(this); + } + public static @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Parent.ParentBuilder builder() { + return new SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl(); + } + } + public static @lombok.experimental.SuperBuilder(toBuilder = true) class Child extends Parent { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder> extends Parent.ParentBuilder { + private @java.lang.SuppressWarnings("all") double field3; + public ChildBuilder() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { + super.$fillValuesFrom(instance); + SuperBuilderBasicToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderBasicToBuilder.Child instance, final SuperBuilderBasicToBuilder.Child.ChildBuilder b) { + b.field3(instance.field3); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field3(final double field3) { + this.field3 = field3; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderBasicToBuilder.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderBasicToBuilder.Child.ChildBuilder { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Child.ChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Child build() { + return new SuperBuilderBasicToBuilder.Child(this); + } + } + private double field3; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderBasicToBuilder.Child.ChildBuilder b) { + super(b); + this.field3 = b.field3; + } + public @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Child.ChildBuilder toBuilder() { + return new SuperBuilderBasicToBuilder.Child.ChildBuilderImpl().$fillValuesFrom(this); + } + public static @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Child.ChildBuilder builder() { + return new SuperBuilderBasicToBuilder.Child.ChildBuilderImpl(); + } + } + public SuperBuilderBasicToBuilder() { + super(); + } + public static void test() { + Child x = Child.builder().field3(0.0).field1(5).item("").build().toBuilder().build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderCustomized.java b/test/transform/resource/after-ecj/SuperBuilderCustomized.java index c9619602..1fb41367 100644 --- a/test/transform/resource/after-ecj/SuperBuilderCustomized.java +++ b/test/transform/resource/after-ecj/SuperBuilderCustomized.java @@ -1,91 +1,91 @@ -import java.util.List; -public class SuperBuilderCustomized { - public static @lombok.experimental.SuperBuilder class Parent { - public static abstract class ParentBuilder> { - private @java.lang.SuppressWarnings("all") int field1; - public ParentBuilder() { - super(); - } - public B resetToDefault() { - field1 = 0; - return self(); - } - public B field1(int field1) { - this.field1 = (field1 + 1); - return self(); - } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("SuperBuilderCustomized.Parent.ParentBuilder(field1=" + this.field1) + ")"); - } - } - private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderCustomized.Parent.ParentBuilder { - private ParentBuilderImpl() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomized.Parent.ParentBuilderImpl self() { - return this; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomized.Parent build() { - return new SuperBuilderCustomized.Parent(this); - } - } - int field1; - protected Parent(ParentBuilder b) { - super(); - if ((b.field1 == 0)) - throw new IllegalArgumentException("field1 must be != 0"); - this.field1 = b.field1; - } - public static SuperBuilderCustomized.Parent.ParentBuilder builder(int field1) { - return new SuperBuilderCustomized.Parent.ParentBuilderImpl().field1(field1); - } - } - public static @lombok.experimental.SuperBuilder class Child extends Parent { - private static final class ChildBuilderImpl extends ChildBuilder { - private ChildBuilderImpl() { - super(); - } - public @Override Child build() { - this.resetToDefault(); - return new Child(this); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomized.Child.ChildBuilderImpl self() { - return this; - } - } - public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder> extends Parent.ParentBuilder { - private @java.lang.SuppressWarnings("all") double field2; - public ChildBuilder() { - super(); - } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B field2(final double field2) { - this.field2 = field2; - return self(); - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("SuperBuilderCustomized.Child.ChildBuilder(super=" + super.toString()) + ", field2=") + this.field2) + ")"); - } - } - double field2; - public static ChildBuilder builder() { - return new ChildBuilderImpl().field2(10.0); - } - protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderCustomized.Child.ChildBuilder b) { - super(b); - this.field2 = b.field2; - } - } - public SuperBuilderCustomized() { - super(); - } - public static void test() { - Child x = Child.builder().field2(1.0).field1(5).resetToDefault().build(); - } -} +import java.util.List; +public class SuperBuilderCustomized { + public static @lombok.experimental.SuperBuilder class Parent { + public static abstract class ParentBuilder> { + private @java.lang.SuppressWarnings("all") int field1; + public ParentBuilder() { + super(); + } + public B resetToDefault() { + field1 = 0; + return self(); + } + public B field1(int field1) { + this.field1 = (field1 + 1); + return self(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("SuperBuilderCustomized.Parent.ParentBuilder(field1=" + this.field1) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderCustomized.Parent.ParentBuilder { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomized.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomized.Parent build() { + return new SuperBuilderCustomized.Parent(this); + } + } + int field1; + protected Parent(ParentBuilder b) { + super(); + if ((b.field1 == 0)) + throw new IllegalArgumentException("field1 must be != 0"); + this.field1 = b.field1; + } + public static SuperBuilderCustomized.Parent.ParentBuilder builder(int field1) { + return new SuperBuilderCustomized.Parent.ParentBuilderImpl().field1(field1); + } + } + public static @lombok.experimental.SuperBuilder class Child extends Parent { + private static final class ChildBuilderImpl extends ChildBuilder { + private ChildBuilderImpl() { + super(); + } + public @Override Child build() { + this.resetToDefault(); + return new Child(this); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomized.Child.ChildBuilderImpl self() { + return this; + } + } + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder> extends Parent.ParentBuilder { + private @java.lang.SuppressWarnings("all") double field2; + public ChildBuilder() { + super(); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field2(final double field2) { + this.field2 = field2; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderCustomized.Child.ChildBuilder(super=" + super.toString()) + ", field2=") + this.field2) + ")"); + } + } + double field2; + public static ChildBuilder builder() { + return new ChildBuilderImpl().field2(10.0); + } + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderCustomized.Child.ChildBuilder b) { + super(b); + this.field2 = b.field2; + } + } + public SuperBuilderCustomized() { + super(); + } + public static void test() { + Child x = Child.builder().field2(1.0).field1(5).resetToDefault().build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderCustomizedWithSetterPrefix.java b/test/transform/resource/after-ecj/SuperBuilderCustomizedWithSetterPrefix.java index 283bacd4..142181ec 100644 --- a/test/transform/resource/after-ecj/SuperBuilderCustomizedWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/SuperBuilderCustomizedWithSetterPrefix.java @@ -1,45 +1,45 @@ -import java.util.List; -public class SuperBuilderCustomizedWithSetterPrefix { - public static @lombok.experimental.SuperBuilder(setterPrefix = "set") class Parent { - public static abstract class ParentBuilder> { - private @java.lang.SuppressWarnings("all") int field1; - public ParentBuilder() { - super(); - } - public B setField1(int field1) { - this.field1 = (field1 + 1); - return self(); - } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder(field1=" + this.field1) + ")"); - } - } - private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder { - private ParentBuilderImpl() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl self() { - return this; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomizedWithSetterPrefix.Parent build() { - return new SuperBuilderCustomizedWithSetterPrefix.Parent(this); - } - } - int field1; - protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder b) { - super(); - this.field1 = b.field1; - } - public static @java.lang.SuppressWarnings("all") SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder builder() { - return new SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl(); - } - } - public SuperBuilderCustomizedWithSetterPrefix() { - super(); - } - public static void test() { - Parent x = Parent.builder().setField1(5).build(); - } -} +import java.util.List; +public class SuperBuilderCustomizedWithSetterPrefix { + public static @lombok.experimental.SuperBuilder(setterPrefix = "set") class Parent { + public static abstract class ParentBuilder> { + private @java.lang.SuppressWarnings("all") int field1; + public ParentBuilder() { + super(); + } + public B setField1(int field1) { + this.field1 = (field1 + 1); + return self(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder(field1=" + this.field1) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomizedWithSetterPrefix.Parent build() { + return new SuperBuilderCustomizedWithSetterPrefix.Parent(this); + } + } + int field1; + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder b) { + super(); + this.field1 = b.field1; + } + public static @java.lang.SuppressWarnings("all") SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder builder() { + return new SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl(); + } + } + public SuperBuilderCustomizedWithSetterPrefix() { + super(); + } + public static void test() { + Parent x = Parent.builder().setField1(5).build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderNestedGenericTypes.java b/test/transform/resource/after-ecj/SuperBuilderNestedGenericTypes.java index e511b276..0c51d4ee 100644 --- a/test/transform/resource/after-ecj/SuperBuilderNestedGenericTypes.java +++ b/test/transform/resource/after-ecj/SuperBuilderNestedGenericTypes.java @@ -1,37 +1,37 @@ -public class SuperBuilderNestedGenericTypes { - public static abstract @lombok.experimental.SuperBuilder class Generic> { - public static abstract @java.lang.SuppressWarnings("all") class GenericBuilder, C extends SuperBuilderNestedGenericTypes.Generic, B extends SuperBuilderNestedGenericTypes.Generic.GenericBuilder> { - public GenericBuilder() { - super(); - } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return "SuperBuilderNestedGenericTypes.Generic.GenericBuilder()"; - } - } - protected @java.lang.SuppressWarnings("all") Generic(final SuperBuilderNestedGenericTypes.Generic.GenericBuilder b) { - super(); - } - } - public static abstract @lombok.experimental.SuperBuilder class NestedGeneric> extends Generic>> { - public static abstract @java.lang.SuppressWarnings("all") class NestedGenericBuilder, C extends SuperBuilderNestedGenericTypes.NestedGeneric, B extends SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder> extends Generic.GenericBuilder>, C, B> { - public NestedGenericBuilder() { - super(); - } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder(super=" + super.toString()) + ")"); - } - } - protected @java.lang.SuppressWarnings("all") NestedGeneric(final SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder b) { - super(b); - } - } - public interface OtherGeneric { - } - public SuperBuilderNestedGenericTypes() { - super(); - } +public class SuperBuilderNestedGenericTypes { + public static abstract @lombok.experimental.SuperBuilder class Generic> { + public static abstract @java.lang.SuppressWarnings("all") class GenericBuilder, C extends SuperBuilderNestedGenericTypes.Generic, B extends SuperBuilderNestedGenericTypes.Generic.GenericBuilder> { + public GenericBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return "SuperBuilderNestedGenericTypes.Generic.GenericBuilder()"; + } + } + protected @java.lang.SuppressWarnings("all") Generic(final SuperBuilderNestedGenericTypes.Generic.GenericBuilder b) { + super(); + } + } + public static abstract @lombok.experimental.SuperBuilder class NestedGeneric> extends Generic>> { + public static abstract @java.lang.SuppressWarnings("all") class NestedGenericBuilder, C extends SuperBuilderNestedGenericTypes.NestedGeneric, B extends SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder> extends Generic.GenericBuilder>, C, B> { + public NestedGenericBuilder() { + super(); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder(super=" + super.toString()) + ")"); + } + } + protected @java.lang.SuppressWarnings("all") NestedGeneric(final SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder b) { + super(b); + } + } + public interface OtherGeneric { + } + public SuperBuilderNestedGenericTypes() { + super(); + } } \ No newline at end of file diff --git a/test/transform/resource/after-ecj/SuperBuilderWithCustomBuilderMethod.java b/test/transform/resource/after-ecj/SuperBuilderWithCustomBuilderMethod.java index 5438f576..93b78c3d 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithCustomBuilderMethod.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithCustomBuilderMethod.java @@ -1,122 +1,122 @@ -import java.util.List; -public class SuperBuilderWithCustomBuilderMethod { - public static @lombok.experimental.SuperBuilder class Parent { - public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder, B extends SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder> { - private @java.lang.SuppressWarnings("all") A field1; - private @java.lang.SuppressWarnings("all") java.util.ArrayList items; - public ParentBuilder() { - super(); - } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B field1(final A field1) { - this.field1 = field1; - return self(); - } - public @java.lang.SuppressWarnings("all") B item(final String item) { - if ((this.items == null)) - this.items = new java.util.ArrayList(); - this.items.add(item); - return self(); - } - public @java.lang.SuppressWarnings("all") B items(final java.util.Collection items) { - if ((items == null)) - { - throw new java.lang.NullPointerException("items cannot be null"); - } - if ((this.items == null)) - this.items = new java.util.ArrayList(); - this.items.addAll(items); - return self(); - } - public @java.lang.SuppressWarnings("all") B clearItems() { - if ((this.items != null)) - this.items.clear(); - return self(); - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")"); - } - } - private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder, SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl> { - private ParentBuilderImpl() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl self() { - return this; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithCustomBuilderMethod.Parent build() { - return new SuperBuilderWithCustomBuilderMethod.Parent(this); - } - } - A field1; - @lombok.Singular List items; - protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder b) { - super(); - this.field1 = b.field1; - java.util.List items; - switch (((b.items == null) ? 0 : b.items.size())) { - case 0 : - items = java.util.Collections.emptyList(); - break; - case 1 : - items = java.util.Collections.singletonList(b.items.get(0)); - break; - default : - items = java.util.Collections.unmodifiableList(new java.util.ArrayList(b.items)); - } - this.items = items; - } - public static @java.lang.SuppressWarnings("all") SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder builder() { - return new SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl(); - } - } - public static @lombok.experimental.SuperBuilder class Child extends Parent { - public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder, B extends SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder> extends Parent.ParentBuilder { - private @java.lang.SuppressWarnings("all") double field3; - public ChildBuilder() { - super(); - } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B field3(final double field3) { - this.field3 = field3; - return self(); - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); - } - } - private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder, SuperBuilderWithCustomBuilderMethod.Child.ChildBuilderImpl> { - private ChildBuilderImpl() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithCustomBuilderMethod.Child.ChildBuilderImpl self() { - return this; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithCustomBuilderMethod.Child build() { - return new SuperBuilderWithCustomBuilderMethod.Child(this); - } - } - double field3; - public static ChildBuilder builder() { - return new ChildBuilderImpl().item("default item"); - } - protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder b) { - super(b); - this.field3 = b.field3; - } - } - public SuperBuilderWithCustomBuilderMethod() { - super(); - } - public static void test() { - Child x = Child.builder().field3(0.0).field1(5).item("").build(); - } -} +import java.util.List; +public class SuperBuilderWithCustomBuilderMethod { + public static @lombok.experimental.SuperBuilder class Parent { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder, B extends SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder> { + private @java.lang.SuppressWarnings("all") A field1; + private @java.lang.SuppressWarnings("all") java.util.ArrayList items; + public ParentBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field1(final A field1) { + this.field1 = field1; + return self(); + } + public @java.lang.SuppressWarnings("all") B item(final String item) { + if ((this.items == null)) + this.items = new java.util.ArrayList(); + this.items.add(item); + return self(); + } + public @java.lang.SuppressWarnings("all") B items(final java.util.Collection items) { + if ((items == null)) + { + throw new java.lang.NullPointerException("items cannot be null"); + } + if ((this.items == null)) + this.items = new java.util.ArrayList(); + this.items.addAll(items); + return self(); + } + public @java.lang.SuppressWarnings("all") B clearItems() { + if ((this.items != null)) + this.items.clear(); + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder, SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithCustomBuilderMethod.Parent build() { + return new SuperBuilderWithCustomBuilderMethod.Parent(this); + } + } + A field1; + @lombok.Singular List items; + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder b) { + super(); + this.field1 = b.field1; + java.util.List items; + switch (((b.items == null) ? 0 : b.items.size())) { + case 0 : + items = java.util.Collections.emptyList(); + break; + case 1 : + items = java.util.Collections.singletonList(b.items.get(0)); + break; + default : + items = java.util.Collections.unmodifiableList(new java.util.ArrayList(b.items)); + } + this.items = items; + } + public static @java.lang.SuppressWarnings("all") SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder builder() { + return new SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl(); + } + } + public static @lombok.experimental.SuperBuilder class Child extends Parent { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder, B extends SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder> extends Parent.ParentBuilder { + private @java.lang.SuppressWarnings("all") double field3; + public ChildBuilder() { + super(); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field3(final double field3) { + this.field3 = field3; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder, SuperBuilderWithCustomBuilderMethod.Child.ChildBuilderImpl> { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithCustomBuilderMethod.Child.ChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithCustomBuilderMethod.Child build() { + return new SuperBuilderWithCustomBuilderMethod.Child(this); + } + } + double field3; + public static ChildBuilder builder() { + return new ChildBuilderImpl().item("default item"); + } + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder b) { + super(b); + this.field3 = b.field3; + } + } + public SuperBuilderWithCustomBuilderMethod() { + super(); + } + public static void test() { + Child x = Child.builder().field3(0.0).field1(5).item("").build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderWithDefaults.java b/test/transform/resource/after-ecj/SuperBuilderWithDefaults.java index 72079b2f..7c5a344a 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithDefaults.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithDefaults.java @@ -1,121 +1,121 @@ -import java.util.List; -public class SuperBuilderWithDefaults { - public static @lombok.experimental.SuperBuilder class Parent { - public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder, B extends SuperBuilderWithDefaults.Parent.ParentBuilder> { - private @java.lang.SuppressWarnings("all") long millis$value; - private @java.lang.SuppressWarnings("all") boolean millis$set; - private @java.lang.SuppressWarnings("all") N numberField$value; - private @java.lang.SuppressWarnings("all") boolean numberField$set; - public ParentBuilder() { - super(); - } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B millis(final long millis) { - this.millis$value = millis; - millis$set = true; - return self(); - } - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B numberField(final N numberField) { - this.numberField$value = numberField; - numberField$set = true; - return self(); - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("SuperBuilderWithDefaults.Parent.ParentBuilder(millis$value=" + this.millis$value) + ", numberField$value=") + this.numberField$value) + ")"); - } - } - private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderWithDefaults.Parent.ParentBuilder, SuperBuilderWithDefaults.Parent.ParentBuilderImpl> { - private ParentBuilderImpl() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Parent.ParentBuilderImpl self() { - return this; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Parent build() { - return new SuperBuilderWithDefaults.Parent(this); - } - } - private @lombok.Builder.Default long millis; - private @lombok.Builder.Default N numberField; - private static @java.lang.SuppressWarnings("all") long $default$millis() { - return System.currentTimeMillis(); - } - private static @java.lang.SuppressWarnings("all") N $default$numberField() { - return null; - } - protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithDefaults.Parent.ParentBuilder b) { - super(); - if (b.millis$set) - this.millis = b.millis$value; - else - this.millis = SuperBuilderWithDefaults.Parent.$default$millis(); - if (b.numberField$set) - this.numberField = b.numberField$value; - else - this.numberField = SuperBuilderWithDefaults.Parent.$default$numberField(); - } - public static @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Parent.ParentBuilder builder() { - return new SuperBuilderWithDefaults.Parent.ParentBuilderImpl(); - } - } - public static @lombok.experimental.SuperBuilder class Child extends Parent { - public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder> extends Parent.ParentBuilder { - private @java.lang.SuppressWarnings("all") double doubleField$value; - private @java.lang.SuppressWarnings("all") boolean doubleField$set; - public ChildBuilder() { - super(); - } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B doubleField(final double doubleField) { - this.doubleField$value = doubleField; - doubleField$set = true; - return self(); - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("SuperBuilderWithDefaults.Child.ChildBuilder(super=" + super.toString()) + ", doubleField$value=") + this.doubleField$value) + ")"); - } - } - private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderWithDefaults.Child.ChildBuilder { - private ChildBuilderImpl() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Child.ChildBuilderImpl self() { - return this; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Child build() { - return new SuperBuilderWithDefaults.Child(this); - } - } - private @lombok.Builder.Default double doubleField; - private static @java.lang.SuppressWarnings("all") double $default$doubleField() { - return Math.PI; - } - protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithDefaults.Child.ChildBuilder b) { - super(b); - if (b.doubleField$set) - this.doubleField = b.doubleField$value; - else - this.doubleField = SuperBuilderWithDefaults.Child.$default$doubleField(); - } - public static @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Child.ChildBuilder builder() { - return new SuperBuilderWithDefaults.Child.ChildBuilderImpl(); - } - } - public SuperBuilderWithDefaults() { - super(); - } - public static void test() { - Child x = Child.builder().doubleField(0.1).numberField(5).millis(1234567890L).build(); - } -} +import java.util.List; +public class SuperBuilderWithDefaults { + public static @lombok.experimental.SuperBuilder class Parent { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder, B extends SuperBuilderWithDefaults.Parent.ParentBuilder> { + private @java.lang.SuppressWarnings("all") long millis$value; + private @java.lang.SuppressWarnings("all") boolean millis$set; + private @java.lang.SuppressWarnings("all") N numberField$value; + private @java.lang.SuppressWarnings("all") boolean numberField$set; + public ParentBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B millis(final long millis) { + this.millis$value = millis; + millis$set = true; + return self(); + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B numberField(final N numberField) { + this.numberField$value = numberField; + numberField$set = true; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithDefaults.Parent.ParentBuilder(millis$value=" + this.millis$value) + ", numberField$value=") + this.numberField$value) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderWithDefaults.Parent.ParentBuilder, SuperBuilderWithDefaults.Parent.ParentBuilderImpl> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Parent build() { + return new SuperBuilderWithDefaults.Parent(this); + } + } + private @lombok.Builder.Default long millis; + private @lombok.Builder.Default N numberField; + private static @java.lang.SuppressWarnings("all") long $default$millis() { + return System.currentTimeMillis(); + } + private static @java.lang.SuppressWarnings("all") N $default$numberField() { + return null; + } + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithDefaults.Parent.ParentBuilder b) { + super(); + if (b.millis$set) + this.millis = b.millis$value; + else + this.millis = SuperBuilderWithDefaults.Parent.$default$millis(); + if (b.numberField$set) + this.numberField = b.numberField$value; + else + this.numberField = SuperBuilderWithDefaults.Parent.$default$numberField(); + } + public static @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Parent.ParentBuilder builder() { + return new SuperBuilderWithDefaults.Parent.ParentBuilderImpl(); + } + } + public static @lombok.experimental.SuperBuilder class Child extends Parent { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder> extends Parent.ParentBuilder { + private @java.lang.SuppressWarnings("all") double doubleField$value; + private @java.lang.SuppressWarnings("all") boolean doubleField$set; + public ChildBuilder() { + super(); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B doubleField(final double doubleField) { + this.doubleField$value = doubleField; + doubleField$set = true; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithDefaults.Child.ChildBuilder(super=" + super.toString()) + ", doubleField$value=") + this.doubleField$value) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderWithDefaults.Child.ChildBuilder { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Child.ChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Child build() { + return new SuperBuilderWithDefaults.Child(this); + } + } + private @lombok.Builder.Default double doubleField; + private static @java.lang.SuppressWarnings("all") double $default$doubleField() { + return Math.PI; + } + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithDefaults.Child.ChildBuilder b) { + super(b); + if (b.doubleField$set) + this.doubleField = b.doubleField$value; + else + this.doubleField = SuperBuilderWithDefaults.Child.$default$doubleField(); + } + public static @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Child.ChildBuilder builder() { + return new SuperBuilderWithDefaults.Child.ChildBuilderImpl(); + } + } + public SuperBuilderWithDefaults() { + super(); + } + public static void test() { + Child x = Child.builder().doubleField(0.1).numberField(5).millis(1234567890L).build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderWithGenerics.java b/test/transform/resource/after-ecj/SuperBuilderWithGenerics.java index bc9db55f..db989687 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithGenerics.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithGenerics.java @@ -1,122 +1,122 @@ -import java.util.List; -public class SuperBuilderWithGenerics { - public static @lombok.experimental.SuperBuilder class Parent { - public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder, B extends SuperBuilderWithGenerics.Parent.ParentBuilder> { - private @java.lang.SuppressWarnings("all") A field1; - private @java.lang.SuppressWarnings("all") java.util.ArrayList items; - public ParentBuilder() { - super(); - } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B field1(final A field1) { - this.field1 = field1; - return self(); - } - public @java.lang.SuppressWarnings("all") B item(final String item) { - if ((this.items == null)) - this.items = new java.util.ArrayList(); - this.items.add(item); - return self(); - } - public @java.lang.SuppressWarnings("all") B items(final java.util.Collection items) { - if ((items == null)) - { - throw new java.lang.NullPointerException("items cannot be null"); - } - if ((this.items == null)) - this.items = new java.util.ArrayList(); - this.items.addAll(items); - return self(); - } - public @java.lang.SuppressWarnings("all") B clearItems() { - if ((this.items != null)) - this.items.clear(); - return self(); - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("SuperBuilderWithGenerics.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")"); - } - } - private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderWithGenerics.Parent.ParentBuilder, SuperBuilderWithGenerics.Parent.ParentBuilderImpl> { - private ParentBuilderImpl() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Parent.ParentBuilderImpl self() { - return this; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Parent build() { - return new SuperBuilderWithGenerics.Parent(this); - } - } - A field1; - @lombok.Singular List items; - protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithGenerics.Parent.ParentBuilder b) { - super(); - this.field1 = b.field1; - java.util.List items; - switch (((b.items == null) ? 0 : b.items.size())) { - case 0 : - items = java.util.Collections.emptyList(); - break; - case 1 : - items = java.util.Collections.singletonList(b.items.get(0)); - break; - default : - items = java.util.Collections.unmodifiableList(new java.util.ArrayList(b.items)); - } - this.items = items; - } - public static @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Parent.ParentBuilder builder() { - return new SuperBuilderWithGenerics.Parent.ParentBuilderImpl(); - } - } - public static @lombok.experimental.SuperBuilder class Child extends Parent { - public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder, B extends SuperBuilderWithGenerics.Child.ChildBuilder> extends Parent.ParentBuilder { - private @java.lang.SuppressWarnings("all") double field3; - public ChildBuilder() { - super(); - } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B field3(final double field3) { - this.field3 = field3; - return self(); - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("SuperBuilderWithGenerics.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); - } - } - private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderWithGenerics.Child.ChildBuilder, SuperBuilderWithGenerics.Child.ChildBuilderImpl> { - private ChildBuilderImpl() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Child.ChildBuilderImpl self() { - return this; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Child build() { - return new SuperBuilderWithGenerics.Child(this); - } - } - double field3; - protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithGenerics.Child.ChildBuilder b) { - super(b); - this.field3 = b.field3; - } - public static @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Child.ChildBuilder builder() { - return new SuperBuilderWithGenerics.Child.ChildBuilderImpl(); - } - } - public SuperBuilderWithGenerics() { - super(); - } - public static void test() { - Child x = Child.builder().field3(0.0).field1(5).item("").build(); - } -} +import java.util.List; +public class SuperBuilderWithGenerics { + public static @lombok.experimental.SuperBuilder class Parent { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder, B extends SuperBuilderWithGenerics.Parent.ParentBuilder> { + private @java.lang.SuppressWarnings("all") A field1; + private @java.lang.SuppressWarnings("all") java.util.ArrayList items; + public ParentBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field1(final A field1) { + this.field1 = field1; + return self(); + } + public @java.lang.SuppressWarnings("all") B item(final String item) { + if ((this.items == null)) + this.items = new java.util.ArrayList(); + this.items.add(item); + return self(); + } + public @java.lang.SuppressWarnings("all") B items(final java.util.Collection items) { + if ((items == null)) + { + throw new java.lang.NullPointerException("items cannot be null"); + } + if ((this.items == null)) + this.items = new java.util.ArrayList(); + this.items.addAll(items); + return self(); + } + public @java.lang.SuppressWarnings("all") B clearItems() { + if ((this.items != null)) + this.items.clear(); + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithGenerics.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderWithGenerics.Parent.ParentBuilder, SuperBuilderWithGenerics.Parent.ParentBuilderImpl> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Parent build() { + return new SuperBuilderWithGenerics.Parent(this); + } + } + A field1; + @lombok.Singular List items; + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithGenerics.Parent.ParentBuilder b) { + super(); + this.field1 = b.field1; + java.util.List items; + switch (((b.items == null) ? 0 : b.items.size())) { + case 0 : + items = java.util.Collections.emptyList(); + break; + case 1 : + items = java.util.Collections.singletonList(b.items.get(0)); + break; + default : + items = java.util.Collections.unmodifiableList(new java.util.ArrayList(b.items)); + } + this.items = items; + } + public static @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Parent.ParentBuilder builder() { + return new SuperBuilderWithGenerics.Parent.ParentBuilderImpl(); + } + } + public static @lombok.experimental.SuperBuilder class Child extends Parent { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder, B extends SuperBuilderWithGenerics.Child.ChildBuilder> extends Parent.ParentBuilder { + private @java.lang.SuppressWarnings("all") double field3; + public ChildBuilder() { + super(); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field3(final double field3) { + this.field3 = field3; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithGenerics.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderWithGenerics.Child.ChildBuilder, SuperBuilderWithGenerics.Child.ChildBuilderImpl> { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Child.ChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Child build() { + return new SuperBuilderWithGenerics.Child(this); + } + } + double field3; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithGenerics.Child.ChildBuilder b) { + super(b); + this.field3 = b.field3; + } + public static @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Child.ChildBuilder builder() { + return new SuperBuilderWithGenerics.Child.ChildBuilderImpl(); + } + } + public SuperBuilderWithGenerics() { + super(); + } + public static void test() { + Child x = Child.builder().field3(0.0).field1(5).item("").build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderWithGenerics2.java b/test/transform/resource/after-ecj/SuperBuilderWithGenerics2.java index 07d10798..96e681f4 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithGenerics2.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithGenerics2.java @@ -1,122 +1,122 @@ -import java.util.List; -public class SuperBuilderWithGenerics2 { - public static @lombok.experimental.SuperBuilder class Parent { - public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder, B extends SuperBuilderWithGenerics2.Parent.ParentBuilder> { - private @java.lang.SuppressWarnings("all") A field1; - private @java.lang.SuppressWarnings("all") java.util.ArrayList items; - public ParentBuilder() { - super(); - } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B field1(final A field1) { - this.field1 = field1; - return self(); - } - public @java.lang.SuppressWarnings("all") B item(final String item) { - if ((this.items == null)) - this.items = new java.util.ArrayList(); - this.items.add(item); - return self(); - } - public @java.lang.SuppressWarnings("all") B items(final java.util.Collection items) { - if ((items == null)) - { - throw new java.lang.NullPointerException("items cannot be null"); - } - if ((this.items == null)) - this.items = new java.util.ArrayList(); - this.items.addAll(items); - return self(); - } - public @java.lang.SuppressWarnings("all") B clearItems() { - if ((this.items != null)) - this.items.clear(); - return self(); - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("SuperBuilderWithGenerics2.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")"); - } - } - private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderWithGenerics2.Parent.ParentBuilder, SuperBuilderWithGenerics2.Parent.ParentBuilderImpl> { - private ParentBuilderImpl() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Parent.ParentBuilderImpl self() { - return this; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Parent build() { - return new SuperBuilderWithGenerics2.Parent(this); - } - } - A field1; - @lombok.Singular List items; - protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithGenerics2.Parent.ParentBuilder b) { - super(); - this.field1 = b.field1; - java.util.List items; - switch (((b.items == null) ? 0 : b.items.size())) { - case 0 : - items = java.util.Collections.emptyList(); - break; - case 1 : - items = java.util.Collections.singletonList(b.items.get(0)); - break; - default : - items = java.util.Collections.unmodifiableList(new java.util.ArrayList(b.items)); - } - this.items = items; - } - public static @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Parent.ParentBuilder builder() { - return new SuperBuilderWithGenerics2.Parent.ParentBuilderImpl(); - } - } - public static @lombok.experimental.SuperBuilder(builderMethodName = "builder2") class Child extends Parent { - public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder, B extends SuperBuilderWithGenerics2.Child.ChildBuilder> extends Parent.ParentBuilder { - private @java.lang.SuppressWarnings("all") A field3; - public ChildBuilder() { - super(); - } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B field3(final A field3) { - this.field3 = field3; - return self(); - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("SuperBuilderWithGenerics2.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); - } - } - private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderWithGenerics2.Child.ChildBuilder, SuperBuilderWithGenerics2.Child.ChildBuilderImpl> { - private ChildBuilderImpl() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Child.ChildBuilderImpl self() { - return this; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Child build() { - return new SuperBuilderWithGenerics2.Child(this); - } - } - A field3; - protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithGenerics2.Child.ChildBuilder b) { - super(b); - this.field3 = b.field3; - } - public static @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Child.ChildBuilder builder2() { - return new SuperBuilderWithGenerics2.Child.ChildBuilderImpl(); - } - } - public SuperBuilderWithGenerics2() { - super(); - } - public static void test() { - Child x = Child.builder2().field3(1).field1("value").item("").build(); - } -} +import java.util.List; +public class SuperBuilderWithGenerics2 { + public static @lombok.experimental.SuperBuilder class Parent { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder, B extends SuperBuilderWithGenerics2.Parent.ParentBuilder> { + private @java.lang.SuppressWarnings("all") A field1; + private @java.lang.SuppressWarnings("all") java.util.ArrayList items; + public ParentBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field1(final A field1) { + this.field1 = field1; + return self(); + } + public @java.lang.SuppressWarnings("all") B item(final String item) { + if ((this.items == null)) + this.items = new java.util.ArrayList(); + this.items.add(item); + return self(); + } + public @java.lang.SuppressWarnings("all") B items(final java.util.Collection items) { + if ((items == null)) + { + throw new java.lang.NullPointerException("items cannot be null"); + } + if ((this.items == null)) + this.items = new java.util.ArrayList(); + this.items.addAll(items); + return self(); + } + public @java.lang.SuppressWarnings("all") B clearItems() { + if ((this.items != null)) + this.items.clear(); + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithGenerics2.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderWithGenerics2.Parent.ParentBuilder, SuperBuilderWithGenerics2.Parent.ParentBuilderImpl> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Parent build() { + return new SuperBuilderWithGenerics2.Parent(this); + } + } + A field1; + @lombok.Singular List items; + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithGenerics2.Parent.ParentBuilder b) { + super(); + this.field1 = b.field1; + java.util.List items; + switch (((b.items == null) ? 0 : b.items.size())) { + case 0 : + items = java.util.Collections.emptyList(); + break; + case 1 : + items = java.util.Collections.singletonList(b.items.get(0)); + break; + default : + items = java.util.Collections.unmodifiableList(new java.util.ArrayList(b.items)); + } + this.items = items; + } + public static @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Parent.ParentBuilder builder() { + return new SuperBuilderWithGenerics2.Parent.ParentBuilderImpl(); + } + } + public static @lombok.experimental.SuperBuilder(builderMethodName = "builder2") class Child extends Parent { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder, B extends SuperBuilderWithGenerics2.Child.ChildBuilder> extends Parent.ParentBuilder { + private @java.lang.SuppressWarnings("all") A field3; + public ChildBuilder() { + super(); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field3(final A field3) { + this.field3 = field3; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithGenerics2.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderWithGenerics2.Child.ChildBuilder, SuperBuilderWithGenerics2.Child.ChildBuilderImpl> { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Child.ChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Child build() { + return new SuperBuilderWithGenerics2.Child(this); + } + } + A field3; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithGenerics2.Child.ChildBuilder b) { + super(b); + this.field3 = b.field3; + } + public static @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Child.ChildBuilder builder2() { + return new SuperBuilderWithGenerics2.Child.ChildBuilderImpl(); + } + } + public SuperBuilderWithGenerics2() { + super(); + } + public static void test() { + Child x = Child.builder2().field3(1).field1("value").item("").build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderWithGenericsAndToBuilder.java b/test/transform/resource/after-ecj/SuperBuilderWithGenericsAndToBuilder.java index c1eb42fd..be819a2f 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithGenericsAndToBuilder.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithGenericsAndToBuilder.java @@ -1,162 +1,162 @@ -import java.util.Map; -public class SuperBuilderWithGenericsAndToBuilder { - public static @lombok.experimental.SuperBuilder(toBuilder = true) class Parent { - public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder, B extends SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder> { - private @java.lang.SuppressWarnings("all") A field1; - private @java.lang.SuppressWarnings("all") java.util.ArrayList items$key; - private @java.lang.SuppressWarnings("all") java.util.ArrayList items$value; - public ParentBuilder() { - super(); - } - protected @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { - SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); - return self(); - } - private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithGenericsAndToBuilder.Parent instance, final SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder b) { - b.field1(instance.field1); - b.items(((instance.items == null) ? java.util.Collections.emptyMap() : instance.items)); - } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B field1(final A field1) { - this.field1 = field1; - return self(); - } - public @java.lang.SuppressWarnings("all") B item(final Integer itemKey, final String itemValue) { - if ((this.items$key == null)) - { - this.items$key = new java.util.ArrayList(); - this.items$value = new java.util.ArrayList(); - } - this.items$key.add(itemKey); - this.items$value.add(itemValue); - return self(); - } - public @java.lang.SuppressWarnings("all") B items(final java.util.Map items) { - if ((items == null)) - { - throw new java.lang.NullPointerException("items cannot be null"); - } - if ((this.items$key == null)) - { - this.items$key = new java.util.ArrayList(); - this.items$value = new java.util.ArrayList(); - } - for (java.util.Map.Entry $lombokEntry : items.entrySet()) - { - this.items$key.add($lombokEntry.getKey()); - this.items$value.add($lombokEntry.getValue()); - } - return self(); - } - public @java.lang.SuppressWarnings("all") B clearItems() { - if ((this.items$key != null)) - { - this.items$key.clear(); - this.items$value.clear(); - } - return self(); - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((((("SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder(field1=" + this.field1) + ", items$key=") + this.items$key) + ", items$value=") + this.items$value) + ")"); - } - } - private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder, SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl> { - private ParentBuilderImpl() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl self() { - return this; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Parent build() { - return new SuperBuilderWithGenericsAndToBuilder.Parent(this); - } - } - A field1; - @lombok.Singular Map items; - protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder b) { - super(); - this.field1 = b.field1; - java.util.Map items; - switch (((b.items$key == null) ? 0 : b.items$key.size())) { - case 0 : - items = java.util.Collections.emptyMap(); - break; - case 1 : - items = java.util.Collections.singletonMap(b.items$key.get(0), b.items$value.get(0)); - break; - default : - items = new java.util.LinkedHashMap(((b.items$key.size() < 0x40000000) ? ((1 + b.items$key.size()) + ((b.items$key.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE)); - for (int $i = 0;; ($i < b.items$key.size()); $i ++) - items.put(b.items$key.get($i), b.items$value.get($i)); - items = java.util.Collections.unmodifiableMap(items); - } - this.items = items; - } - public @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder toBuilder() { - return new SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl().$fillValuesFrom(this); - } - public static @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder builder() { - return new SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl(); - } - } - public static @lombok.experimental.SuperBuilder(toBuilder = true) class Child extends Parent { - public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder, B extends SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder> extends Parent.ParentBuilder { - private @java.lang.SuppressWarnings("all") double field3; - public ChildBuilder() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { - super.$fillValuesFrom(instance); - SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); - return self(); - } - private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithGenericsAndToBuilder.Child instance, final SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder b) { - b.field3(instance.field3); - } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B field3(final double field3) { - this.field3 = field3; - return self(); - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); - } - } - private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder, SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl> { - private ChildBuilderImpl() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl self() { - return this; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Child build() { - return new SuperBuilderWithGenericsAndToBuilder.Child(this); - } - } - double field3; - protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder b) { - super(b); - this.field3 = b.field3; - } - public @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder toBuilder() { - return new SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl().$fillValuesFrom(this); - } - public static @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder builder() { - return new SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl(); - } - } - public SuperBuilderWithGenericsAndToBuilder() { - super(); - } - public static void test() { - Child x = Child.builder().field3(0.0).field1(5).item(5, "").build().toBuilder().build(); - } -} +import java.util.Map; +public class SuperBuilderWithGenericsAndToBuilder { + public static @lombok.experimental.SuperBuilder(toBuilder = true) class Parent { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder, B extends SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder> { + private @java.lang.SuppressWarnings("all") A field1; + private @java.lang.SuppressWarnings("all") java.util.ArrayList items$key; + private @java.lang.SuppressWarnings("all") java.util.ArrayList items$value; + public ParentBuilder() { + super(); + } + protected @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { + SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithGenericsAndToBuilder.Parent instance, final SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder b) { + b.field1(instance.field1); + b.items(((instance.items == null) ? java.util.Collections.emptyMap() : instance.items)); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field1(final A field1) { + this.field1 = field1; + return self(); + } + public @java.lang.SuppressWarnings("all") B item(final Integer itemKey, final String itemValue) { + if ((this.items$key == null)) + { + this.items$key = new java.util.ArrayList(); + this.items$value = new java.util.ArrayList(); + } + this.items$key.add(itemKey); + this.items$value.add(itemValue); + return self(); + } + public @java.lang.SuppressWarnings("all") B items(final java.util.Map items) { + if ((items == null)) + { + throw new java.lang.NullPointerException("items cannot be null"); + } + if ((this.items$key == null)) + { + this.items$key = new java.util.ArrayList(); + this.items$value = new java.util.ArrayList(); + } + for (java.util.Map.Entry $lombokEntry : items.entrySet()) + { + this.items$key.add($lombokEntry.getKey()); + this.items$value.add($lombokEntry.getValue()); + } + return self(); + } + public @java.lang.SuppressWarnings("all") B clearItems() { + if ((this.items$key != null)) + { + this.items$key.clear(); + this.items$value.clear(); + } + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder(field1=" + this.field1) + ", items$key=") + this.items$key) + ", items$value=") + this.items$value) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder, SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Parent build() { + return new SuperBuilderWithGenericsAndToBuilder.Parent(this); + } + } + A field1; + @lombok.Singular Map items; + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder b) { + super(); + this.field1 = b.field1; + java.util.Map items; + switch (((b.items$key == null) ? 0 : b.items$key.size())) { + case 0 : + items = java.util.Collections.emptyMap(); + break; + case 1 : + items = java.util.Collections.singletonMap(b.items$key.get(0), b.items$value.get(0)); + break; + default : + items = new java.util.LinkedHashMap(((b.items$key.size() < 0x40000000) ? ((1 + b.items$key.size()) + ((b.items$key.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE)); + for (int $i = 0;; ($i < b.items$key.size()); $i ++) + items.put(b.items$key.get($i), b.items$value.get($i)); + items = java.util.Collections.unmodifiableMap(items); + } + this.items = items; + } + public @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder toBuilder() { + return new SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl().$fillValuesFrom(this); + } + public static @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder builder() { + return new SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl(); + } + } + public static @lombok.experimental.SuperBuilder(toBuilder = true) class Child extends Parent { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder, B extends SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder> extends Parent.ParentBuilder { + private @java.lang.SuppressWarnings("all") double field3; + public ChildBuilder() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { + super.$fillValuesFrom(instance); + SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithGenericsAndToBuilder.Child instance, final SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder b) { + b.field3(instance.field3); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field3(final double field3) { + this.field3 = field3; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder, SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl> { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Child build() { + return new SuperBuilderWithGenericsAndToBuilder.Child(this); + } + } + double field3; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder b) { + super(b); + this.field3 = b.field3; + } + public @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder toBuilder() { + return new SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl().$fillValuesFrom(this); + } + public static @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder builder() { + return new SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl(); + } + } + public SuperBuilderWithGenericsAndToBuilder() { + super(); + } + public static void test() { + Child x = Child.builder().field3(0.0).field1(5).item(5, "").build().toBuilder().build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderWithNonNull.java b/test/transform/resource/after-ecj/SuperBuilderWithNonNull.java index b9c96a38..28504f29 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithNonNull.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithNonNull.java @@ -1,111 +1,111 @@ -import java.util.List; -public class SuperBuilderWithNonNull { - public static @lombok.experimental.SuperBuilder class Parent { - public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder> { - private @java.lang.SuppressWarnings("all") String nonNullParentField$value; - private @java.lang.SuppressWarnings("all") boolean nonNullParentField$set; - public ParentBuilder() { - super(); - } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B nonNullParentField(final @lombok.NonNull String nonNullParentField) { - if ((nonNullParentField == null)) - { - throw new java.lang.NullPointerException("nonNullParentField is marked non-null but is null"); - } - this.nonNullParentField$value = nonNullParentField; - nonNullParentField$set = true; - return self(); - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (("SuperBuilderWithNonNull.Parent.ParentBuilder(nonNullParentField$value=" + this.nonNullParentField$value) + ")"); - } - } - private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderWithNonNull.Parent.ParentBuilder { - private ParentBuilderImpl() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Parent.ParentBuilderImpl self() { - return this; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Parent build() { - return new SuperBuilderWithNonNull.Parent(this); - } - } - final @lombok.NonNull @lombok.Builder.Default String nonNullParentField; - private static @java.lang.SuppressWarnings("all") String $default$nonNullParentField() { - return "default"; - } - protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithNonNull.Parent.ParentBuilder b) { - super(); - if (b.nonNullParentField$set) - this.nonNullParentField = b.nonNullParentField$value; - else - this.nonNullParentField = SuperBuilderWithNonNull.Parent.$default$nonNullParentField(); - if ((nonNullParentField == null)) - { - throw new java.lang.NullPointerException("nonNullParentField is marked non-null but is null"); - } - } - public static @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Parent.ParentBuilder builder() { - return new SuperBuilderWithNonNull.Parent.ParentBuilderImpl(); - } - } - public static @lombok.experimental.SuperBuilder class Child extends Parent { - public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder> extends Parent.ParentBuilder { - private @java.lang.SuppressWarnings("all") String nonNullChildField; - public ChildBuilder() { - super(); - } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B nonNullChildField(final @lombok.NonNull String nonNullChildField) { - if ((nonNullChildField == null)) - { - throw new java.lang.NullPointerException("nonNullChildField is marked non-null but is null"); - } - this.nonNullChildField = nonNullChildField; - return self(); - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("SuperBuilderWithNonNull.Child.ChildBuilder(super=" + super.toString()) + ", nonNullChildField=") + this.nonNullChildField) + ")"); - } - } - private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderWithNonNull.Child.ChildBuilder { - private ChildBuilderImpl() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Child.ChildBuilderImpl self() { - return this; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Child build() { - return new SuperBuilderWithNonNull.Child(this); - } - } - @lombok.NonNull String nonNullChildField; - protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithNonNull.Child.ChildBuilder b) { - super(b); - this.nonNullChildField = b.nonNullChildField; - if ((nonNullChildField == null)) - { - throw new java.lang.NullPointerException("nonNullChildField is marked non-null but is null"); - } - } - public static @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Child.ChildBuilder builder() { - return new SuperBuilderWithNonNull.Child.ChildBuilderImpl(); - } - } - public SuperBuilderWithNonNull() { - super(); - } - public static void test() { - Child x = Child.builder().nonNullChildField("child").nonNullParentField("parent").build(); - } -} +import java.util.List; +public class SuperBuilderWithNonNull { + public static @lombok.experimental.SuperBuilder class Parent { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder> { + private @java.lang.SuppressWarnings("all") String nonNullParentField$value; + private @java.lang.SuppressWarnings("all") boolean nonNullParentField$set; + public ParentBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B nonNullParentField(final @lombok.NonNull String nonNullParentField) { + if ((nonNullParentField == null)) + { + throw new java.lang.NullPointerException("nonNullParentField is marked non-null but is null"); + } + this.nonNullParentField$value = nonNullParentField; + nonNullParentField$set = true; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("SuperBuilderWithNonNull.Parent.ParentBuilder(nonNullParentField$value=" + this.nonNullParentField$value) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderWithNonNull.Parent.ParentBuilder { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Parent build() { + return new SuperBuilderWithNonNull.Parent(this); + } + } + final @lombok.NonNull @lombok.Builder.Default String nonNullParentField; + private static @java.lang.SuppressWarnings("all") String $default$nonNullParentField() { + return "default"; + } + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithNonNull.Parent.ParentBuilder b) { + super(); + if (b.nonNullParentField$set) + this.nonNullParentField = b.nonNullParentField$value; + else + this.nonNullParentField = SuperBuilderWithNonNull.Parent.$default$nonNullParentField(); + if ((nonNullParentField == null)) + { + throw new java.lang.NullPointerException("nonNullParentField is marked non-null but is null"); + } + } + public static @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Parent.ParentBuilder builder() { + return new SuperBuilderWithNonNull.Parent.ParentBuilderImpl(); + } + } + public static @lombok.experimental.SuperBuilder class Child extends Parent { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder> extends Parent.ParentBuilder { + private @java.lang.SuppressWarnings("all") String nonNullChildField; + public ChildBuilder() { + super(); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B nonNullChildField(final @lombok.NonNull String nonNullChildField) { + if ((nonNullChildField == null)) + { + throw new java.lang.NullPointerException("nonNullChildField is marked non-null but is null"); + } + this.nonNullChildField = nonNullChildField; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithNonNull.Child.ChildBuilder(super=" + super.toString()) + ", nonNullChildField=") + this.nonNullChildField) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderWithNonNull.Child.ChildBuilder { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Child.ChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Child build() { + return new SuperBuilderWithNonNull.Child(this); + } + } + @lombok.NonNull String nonNullChildField; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithNonNull.Child.ChildBuilder b) { + super(b); + this.nonNullChildField = b.nonNullChildField; + if ((nonNullChildField == null)) + { + throw new java.lang.NullPointerException("nonNullChildField is marked non-null but is null"); + } + } + public static @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Child.ChildBuilder builder() { + return new SuperBuilderWithNonNull.Child.ChildBuilderImpl(); + } + } + public SuperBuilderWithNonNull() { + super(); + } + public static void test() { + Child x = Child.builder().nonNullChildField("child").nonNullParentField("parent").build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderWithSetterPrefix.java b/test/transform/resource/after-ecj/SuperBuilderWithSetterPrefix.java index 0edb6608..38a0a55b 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithSetterPrefix.java @@ -1,183 +1,183 @@ -import java.util.List; -public class SuperBuilderWithSetterPrefix { - public static @lombok.experimental.SuperBuilder(toBuilder = true,setterPrefix = "with") 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) { - SuperBuilderWithSetterPrefix.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); - return self(); - } - private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithSetterPrefix.Parent instance, final SuperBuilderWithSetterPrefix.Parent.ParentBuilder b) { - b.withField1(instance.field1); - b.withObtainViaField(instance.field1); - b.withObtainViaMethod(instance.method()); - b.withObtainViaStaticMethod(SuperBuilderWithSetterPrefix.Parent.staticMethod(instance)); - b.withItems(((instance.items == null) ? java.util.Collections.emptyList() : instance.items)); - } - protected abstract @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.SuppressWarnings("all") C build(); - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B withField1(final int field1) { - this.field1 = field1; - return self(); - } - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B withObtainViaField(final int obtainViaField) { - this.obtainViaField = obtainViaField; - return self(); - } - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B withObtainViaMethod(final int obtainViaMethod) { - this.obtainViaMethod = obtainViaMethod; - return self(); - } - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B withObtainViaStaticMethod(final String obtainViaStaticMethod) { - this.obtainViaStaticMethod = obtainViaStaticMethod; - return self(); - } - public @java.lang.SuppressWarnings("all") B withItem(final String item) { - if ((this.items == null)) - this.items = new java.util.ArrayList(); - this.items.add(item); - return self(); - } - public @java.lang.SuppressWarnings("all") B withItems(final java.util.Collection items) { - if ((items == null)) - { - throw new java.lang.NullPointerException("items cannot be null"); - } - if ((this.items == null)) - this.items = new java.util.ArrayList(); - this.items.addAll(items); - return self(); - } - public @java.lang.SuppressWarnings("all") B clearItems() { - if ((this.items != null)) - this.items.clear(); - return self(); - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((((((((("SuperBuilderWithSetterPrefix.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 SuperBuilderWithSetterPrefix.Parent.ParentBuilder { - private ParentBuilderImpl() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl self() { - return this; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Parent build() { - return new SuperBuilderWithSetterPrefix.Parent(this); - } - } - 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 items; - private int method() { - return 2; - } - private static String staticMethod(Parent instance) { - return "staticMethod"; - } - protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithSetterPrefix.Parent.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 : - items = java.util.Collections.emptyList(); - break; - case 1 : - items = java.util.Collections.singletonList(b.items.get(0)); - break; - default : - items = java.util.Collections.unmodifiableList(new java.util.ArrayList(b.items)); - } - this.items = items; - } - public @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Parent.ParentBuilder toBuilder() { - return new SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl().$fillValuesFrom(this); - } - public static @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Parent.ParentBuilder builder() { - return new SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl(); - } - } - public static @lombok.experimental.SuperBuilder(toBuilder = true,setterPrefix = "set") class Child extends Parent { - public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder> extends Parent.ParentBuilder { - private @java.lang.SuppressWarnings("all") double field3; - public ChildBuilder() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { - super.$fillValuesFrom(instance); - SuperBuilderWithSetterPrefix.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); - return self(); - } - private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithSetterPrefix.Child instance, final SuperBuilderWithSetterPrefix.Child.ChildBuilder b) { - b.setField3(instance.field3); - } - protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); - public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); - /** - * @return {@code this}. - */ - public @java.lang.SuppressWarnings("all") B setField3(final double field3) { - this.field3 = field3; - return self(); - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("SuperBuilderWithSetterPrefix.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); - } - } - private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderWithSetterPrefix.Child.ChildBuilder { - private ChildBuilderImpl() { - super(); - } - protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl self() { - return this; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Child build() { - return new SuperBuilderWithSetterPrefix.Child(this); - } - } - private double field3; - protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithSetterPrefix.Child.ChildBuilder b) { - super(b); - this.field3 = b.field3; - } - public @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Child.ChildBuilder toBuilder() { - return new SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl().$fillValuesFrom(this); - } - public static @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Child.ChildBuilder builder() { - return new SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl(); - } - } - public SuperBuilderWithSetterPrefix() { - super(); - } - public static void test() { - Child x = Child.builder().setField3(0.0).withField1(5).withItem("").build().toBuilder().build(); - } -} +import java.util.List; +public class SuperBuilderWithSetterPrefix { + public static @lombok.experimental.SuperBuilder(toBuilder = true,setterPrefix = "with") 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) { + SuperBuilderWithSetterPrefix.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithSetterPrefix.Parent instance, final SuperBuilderWithSetterPrefix.Parent.ParentBuilder b) { + b.withField1(instance.field1); + b.withObtainViaField(instance.field1); + b.withObtainViaMethod(instance.method()); + b.withObtainViaStaticMethod(SuperBuilderWithSetterPrefix.Parent.staticMethod(instance)); + b.withItems(((instance.items == null) ? java.util.Collections.emptyList() : instance.items)); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B withField1(final int field1) { + this.field1 = field1; + return self(); + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B withObtainViaField(final int obtainViaField) { + this.obtainViaField = obtainViaField; + return self(); + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B withObtainViaMethod(final int obtainViaMethod) { + this.obtainViaMethod = obtainViaMethod; + return self(); + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B withObtainViaStaticMethod(final String obtainViaStaticMethod) { + this.obtainViaStaticMethod = obtainViaStaticMethod; + return self(); + } + public @java.lang.SuppressWarnings("all") B withItem(final String item) { + if ((this.items == null)) + this.items = new java.util.ArrayList(); + this.items.add(item); + return self(); + } + public @java.lang.SuppressWarnings("all") B withItems(final java.util.Collection items) { + if ((items == null)) + { + throw new java.lang.NullPointerException("items cannot be null"); + } + if ((this.items == null)) + this.items = new java.util.ArrayList(); + this.items.addAll(items); + return self(); + } + public @java.lang.SuppressWarnings("all") B clearItems() { + if ((this.items != null)) + this.items.clear(); + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((((((("SuperBuilderWithSetterPrefix.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 SuperBuilderWithSetterPrefix.Parent.ParentBuilder { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Parent build() { + return new SuperBuilderWithSetterPrefix.Parent(this); + } + } + 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 items; + private int method() { + return 2; + } + private static String staticMethod(Parent instance) { + return "staticMethod"; + } + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithSetterPrefix.Parent.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 : + items = java.util.Collections.emptyList(); + break; + case 1 : + items = java.util.Collections.singletonList(b.items.get(0)); + break; + default : + items = java.util.Collections.unmodifiableList(new java.util.ArrayList(b.items)); + } + this.items = items; + } + public @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Parent.ParentBuilder toBuilder() { + return new SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl().$fillValuesFrom(this); + } + public static @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Parent.ParentBuilder builder() { + return new SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl(); + } + } + public static @lombok.experimental.SuperBuilder(toBuilder = true,setterPrefix = "set") class Child extends Parent { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder> extends Parent.ParentBuilder { + private @java.lang.SuppressWarnings("all") double field3; + public ChildBuilder() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { + super.$fillValuesFrom(instance); + SuperBuilderWithSetterPrefix.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithSetterPrefix.Child instance, final SuperBuilderWithSetterPrefix.Child.ChildBuilder b) { + b.setField3(instance.field3); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B setField3(final double field3) { + this.field3 = field3; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithSetterPrefix.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderWithSetterPrefix.Child.ChildBuilder { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Child build() { + return new SuperBuilderWithSetterPrefix.Child(this); + } + } + private double field3; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithSetterPrefix.Child.ChildBuilder b) { + super(b); + this.field3 = b.field3; + } + public @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Child.ChildBuilder toBuilder() { + return new SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl().$fillValuesFrom(this); + } + public static @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Child.ChildBuilder builder() { + return new SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl(); + } + } + public SuperBuilderWithSetterPrefix() { + super(); + } + public static void test() { + Child x = Child.builder().setField3(0.0).withField1(5).withItem("").build().toBuilder().build(); + } +} diff --git a/test/transform/resource/after-ecj/ValueCallSuper.java b/test/transform/resource/after-ecj/ValueCallSuper.java index 2fef08ab..72422a4a 100644 --- a/test/transform/resource/after-ecj/ValueCallSuper.java +++ b/test/transform/resource/after-ecj/ValueCallSuper.java @@ -1,32 +1,32 @@ -class ValueParent { - ValueParent() { - super(); - } -} -final @lombok.Value class ValueCallSuper extends ValueParent { - public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { - if ((o == this)) - return true; - if ((! (o instanceof ValueCallSuper))) - return false; - final ValueCallSuper other = (ValueCallSuper) o; - if ((! other.canEqual((java.lang.Object) this))) - return false; - if ((! super.equals(o))) - return false; - return true; - } - protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { - return (other instanceof ValueCallSuper); - } - public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { - final int result = super.hashCode(); - return result; - } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return "ValueCallSuper()"; - } - public @java.lang.SuppressWarnings("all") ValueCallSuper() { - super(); - } -} +class ValueParent { + ValueParent() { + super(); + } +} +final @lombok.Value class ValueCallSuper extends ValueParent { + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof ValueCallSuper))) + return false; + final ValueCallSuper other = (ValueCallSuper) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + if ((! super.equals(o))) + return false; + return true; + } + protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof ValueCallSuper); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + final int result = super.hashCode(); + return result; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return "ValueCallSuper()"; + } + public @java.lang.SuppressWarnings("all") ValueCallSuper() { + super(); + } +} diff --git a/test/transform/resource/before/ValueCallSuper.java b/test/transform/resource/before/ValueCallSuper.java index e236b404..bf561998 100644 --- a/test/transform/resource/before/ValueCallSuper.java +++ b/test/transform/resource/before/ValueCallSuper.java @@ -1,7 +1,7 @@ -//CONF: lombok.equalsAndHashCode.callSuper = call - -class ValueParent { -} -@lombok.Value -class ValueCallSuper extends ValueParent { -} +//CONF: lombok.equalsAndHashCode.callSuper = call + +class ValueParent { +} +@lombok.Value +class ValueCallSuper extends ValueParent { +} -- cgit