diff options
Diffstat (limited to 'test/transform/resource/after-delombok')
16 files changed, 2155 insertions, 2155 deletions
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<C extends JacksonizedSuperBuilderSimple.Parent, B extends JacksonizedSuperBuilderSimple.Parent.ParentBuilder<C, B>> {
- @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<JacksonizedSuperBuilderSimple.Parent, JacksonizedSuperBuilderSimple.Parent.ParentBuilderImpl> {
- @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<C extends JacksonizedSuperBuilderSimple.Parent, B extends JacksonizedSuperBuilderSimple.Parent.ParentBuilder<C, B>> { + @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<JacksonizedSuperBuilderSimple.Parent, JacksonizedSuperBuilderSimple.Parent.ParentBuilderImpl> { + @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<C extends SuperBuilderAbstract.Parent, B extends SuperBuilderAbstract.Parent.ParentBuilder<C, B>> {
- @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<SuperBuilderAbstract.Parent, SuperBuilderAbstract.Parent.ParentBuilderImpl> {
- @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<C extends SuperBuilderAbstract.Child, B extends SuperBuilderAbstract.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> {
- @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<C extends SuperBuilderAbstract.GrandChild, B extends SuperBuilderAbstract.GrandChild.GrandChildBuilder<C, B>> extends Child.ChildBuilder<C, B> {
- @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<SuperBuilderAbstract.GrandChild, SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl> {
- @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<C extends SuperBuilderAbstract.Parent, B extends SuperBuilderAbstract.Parent.ParentBuilder<C, B>> { + @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<SuperBuilderAbstract.Parent, SuperBuilderAbstract.Parent.ParentBuilderImpl> { + @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<C extends SuperBuilderAbstract.Child, B extends SuperBuilderAbstract.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { + @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<C extends SuperBuilderAbstract.GrandChild, B extends SuperBuilderAbstract.GrandChild.GrandChildBuilder<C, B>> extends Child.ChildBuilder<C, B> { + @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<SuperBuilderAbstract.GrandChild, SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl> { + @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<C extends SuperBuilderAbstractToBuilder.Parent, B extends SuperBuilderAbstractToBuilder.Parent.ParentBuilder<C, B>> {
- @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<SuperBuilderAbstractToBuilder.Parent, SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl> {
- @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<C extends SuperBuilderAbstractToBuilder.Child, B extends SuperBuilderAbstractToBuilder.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> {
- @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<C extends SuperBuilderAbstractToBuilder.GrandChild, B extends SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<C, B>> extends Child.ChildBuilder<C, B> {
- @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<SuperBuilderAbstractToBuilder.GrandChild, SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl> {
- @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<C extends SuperBuilderAbstractToBuilder.Parent, B extends SuperBuilderAbstractToBuilder.Parent.ParentBuilder<C, B>> { + @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<SuperBuilderAbstractToBuilder.Parent, SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl> { + @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<C extends SuperBuilderAbstractToBuilder.Child, B extends SuperBuilderAbstractToBuilder.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { + @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<C extends SuperBuilderAbstractToBuilder.GrandChild, B extends SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<C, B>> extends Child.ChildBuilder<C, B> { + @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<SuperBuilderAbstractToBuilder.GrandChild, SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl> { + @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<String> items;
- @java.lang.SuppressWarnings("all")
- public static abstract class ParentBuilder<C extends SuperBuilderBasic.Parent, B extends SuperBuilderBasic.Parent.ParentBuilder<C, B>> {
- @java.lang.SuppressWarnings("all")
- private int field1;
- @java.lang.SuppressWarnings("all")
- private java.util.ArrayList<String> 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<String>();
- this.items.add(item);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B items(final java.util.Collection<? extends String> items) {
- if (items == null) {
- throw new java.lang.NullPointerException("items cannot be null");
- }
- if (this.items == null) this.items = new java.util.ArrayList<String>();
- 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<SuperBuilderBasic.Parent, SuperBuilderBasic.Parent.ParentBuilderImpl> {
- @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<String> 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<String>(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<C extends SuperBuilderBasic.Child, B extends SuperBuilderBasic.Child.ChildBuilder<C, B>> extends SuperBuilderBasic.Parent.ParentBuilder<C, B> {
- @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<SuperBuilderBasic.Child, SuperBuilderBasic.Child.ChildBuilderImpl> {
- @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<String> items; + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder<C extends SuperBuilderBasic.Parent, B extends SuperBuilderBasic.Parent.ParentBuilder<C, B>> { + @java.lang.SuppressWarnings("all") + private int field1; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<String> 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<String>(); + this.items.add(item); + return self(); + } + @java.lang.SuppressWarnings("all") + public B items(final java.util.Collection<? extends String> items) { + if (items == null) { + throw new java.lang.NullPointerException("items cannot be null"); + } + if (this.items == null) this.items = new java.util.ArrayList<String>(); + 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<SuperBuilderBasic.Parent, SuperBuilderBasic.Parent.ParentBuilderImpl> { + @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<String> 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<String>(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<C extends SuperBuilderBasic.Child, B extends SuperBuilderBasic.Child.ChildBuilder<C, B>> extends SuperBuilderBasic.Parent.ParentBuilder<C, B> { + @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<SuperBuilderBasic.Child, SuperBuilderBasic.Child.ChildBuilderImpl> { + @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<String> items;
- private int method() {
- return 2;
- }
- private static String staticMethod(Parent instance) {
- return "staticMethod";
- }
- @java.lang.SuppressWarnings("all")
- public static abstract class ParentBuilder<C extends SuperBuilderBasicToBuilder.Parent, B extends SuperBuilderBasicToBuilder.Parent.ParentBuilder<C, B>> {
- @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<String> 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<String>();
- this.items.add(item);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B items(final java.util.Collection<? extends String> items) {
- if (items == null) {
- throw new java.lang.NullPointerException("items cannot be null");
- }
- if (this.items == null) this.items = new java.util.ArrayList<String>();
- 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<SuperBuilderBasicToBuilder.Parent, SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl> {
- @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<String> 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<String>(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<C extends SuperBuilderBasicToBuilder.Child, B extends SuperBuilderBasicToBuilder.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> {
- @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<SuperBuilderBasicToBuilder.Child, SuperBuilderBasicToBuilder.Child.ChildBuilderImpl> {
- @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<String> items; + private int method() { + return 2; + } + private static String staticMethod(Parent instance) { + return "staticMethod"; + } + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder<C extends SuperBuilderBasicToBuilder.Parent, B extends SuperBuilderBasicToBuilder.Parent.ParentBuilder<C, B>> { + @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<String> 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<String>(); + this.items.add(item); + return self(); + } + @java.lang.SuppressWarnings("all") + public B items(final java.util.Collection<? extends String> items) { + if (items == null) { + throw new java.lang.NullPointerException("items cannot be null"); + } + if (this.items == null) this.items = new java.util.ArrayList<String>(); + 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<SuperBuilderBasicToBuilder.Parent, SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl> { + @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<String> 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<String>(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<C extends SuperBuilderBasicToBuilder.Child, B extends SuperBuilderBasicToBuilder.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { + @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<SuperBuilderBasicToBuilder.Child, SuperBuilderBasicToBuilder.Child.ChildBuilderImpl> { + @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<C extends Parent, B extends ParentBuilder<C, B>> {
- @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<SuperBuilderCustomized.Parent, SuperBuilderCustomized.Parent.ParentBuilderImpl> {
- @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<Child, ChildBuilderImpl> {
- @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<C extends SuperBuilderCustomized.Child, B extends SuperBuilderCustomized.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> {
- @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<C extends Parent, B extends ParentBuilder<C, B>> { + @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<SuperBuilderCustomized.Parent, SuperBuilderCustomized.Parent.ParentBuilderImpl> { + @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<Child, ChildBuilderImpl> { + @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<C extends SuperBuilderCustomized.Child, B extends SuperBuilderCustomized.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { + @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<C extends Parent, B extends ParentBuilder<C, B>> {
- @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<SuperBuilderCustomizedWithSetterPrefix.Parent, SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl> {
- @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<C extends Parent, B extends ParentBuilder<C, B>> { + @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<SuperBuilderCustomizedWithSetterPrefix.Parent, SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl> { + @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<B, C, C2> {
- @java.lang.SuppressWarnings("all")
- public static abstract class GenericsClashBuilder<B, C, C2, C3 extends SuperBuilderNameClashes.GenericsClash<B, C, C2>, B2 extends SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder<B, C, C2, C3, B2>> {
- @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<B, C, C2> extends SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder<B, C, C2, SuperBuilderNameClashes.GenericsClash<B, C, C2>, SuperBuilderNameClashes.GenericsClash.GenericsClashBuilderImpl<B, C, C2>> {
- @java.lang.SuppressWarnings("all")
- private GenericsClashBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderNameClashes.GenericsClash.GenericsClashBuilderImpl<B, C, C2> self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderNameClashes.GenericsClash<B, C, C2> build() {
- return new SuperBuilderNameClashes.GenericsClash<B, C, C2>(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected GenericsClash(final SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder<B, C, C2, ?, ?> b) {
- }
- @java.lang.SuppressWarnings("all")
- public static <B, C, C2> SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder<B, C, C2, ?, ?> builder() {
- return new SuperBuilderNameClashes.GenericsClash.GenericsClashBuilderImpl<B, C, C2>();
- }
- }
- public static class B {
- @java.lang.SuppressWarnings("all")
- public static abstract class BBuilder<C extends SuperBuilderNameClashes.B, B2 extends SuperBuilderNameClashes.B.BBuilder<C, B2>> {
- @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<SuperBuilderNameClashes.B, SuperBuilderNameClashes.B.BBuilderImpl> {
- @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<C3 extends SuperBuilderNameClashes.C, B extends SuperBuilderNameClashes.C.CBuilder<C3, B>> {
- @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<SuperBuilderNameClashes.C, SuperBuilderNameClashes.C.CBuilderImpl> {
- @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<B, C, C2> { + @java.lang.SuppressWarnings("all") + public static abstract class GenericsClashBuilder<B, C, C2, C3 extends SuperBuilderNameClashes.GenericsClash<B, C, C2>, B2 extends SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder<B, C, C2, C3, B2>> { + @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<B, C, C2> extends SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder<B, C, C2, SuperBuilderNameClashes.GenericsClash<B, C, C2>, SuperBuilderNameClashes.GenericsClash.GenericsClashBuilderImpl<B, C, C2>> { + @java.lang.SuppressWarnings("all") + private GenericsClashBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderNameClashes.GenericsClash.GenericsClashBuilderImpl<B, C, C2> self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderNameClashes.GenericsClash<B, C, C2> build() { + return new SuperBuilderNameClashes.GenericsClash<B, C, C2>(this); + } + } + @java.lang.SuppressWarnings("all") + protected GenericsClash(final SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder<B, C, C2, ?, ?> b) { + } + @java.lang.SuppressWarnings("all") + public static <B, C, C2> SuperBuilderNameClashes.GenericsClash.GenericsClashBuilder<B, C, C2, ?, ?> builder() { + return new SuperBuilderNameClashes.GenericsClash.GenericsClashBuilderImpl<B, C, C2>(); + } + } + public static class B { + @java.lang.SuppressWarnings("all") + public static abstract class BBuilder<C extends SuperBuilderNameClashes.B, B2 extends SuperBuilderNameClashes.B.BBuilder<C, B2>> { + @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<SuperBuilderNameClashes.B, SuperBuilderNameClashes.B.BBuilderImpl> { + @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<C3 extends SuperBuilderNameClashes.C, B extends SuperBuilderNameClashes.C.CBuilder<C3, B>> { + @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<SuperBuilderNameClashes.C, SuperBuilderNameClashes.C.CBuilderImpl> { + @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<T extends Generic<?>> {
- @java.lang.SuppressWarnings("all")
- public static abstract class GenericBuilder<T extends Generic<?>, C extends SuperBuilderNestedGenericTypes.Generic<T>, B extends SuperBuilderNestedGenericTypes.Generic.GenericBuilder<T, C, B>> {
- @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<T, ?, ?> b) {
- }
- }
- public static abstract class NestedGeneric<T extends OtherGeneric<?>> extends Generic<NestedGeneric<? extends OtherGeneric<?>>> {
- @java.lang.SuppressWarnings("all")
- public static abstract class NestedGenericBuilder<T extends OtherGeneric<?>, C extends SuperBuilderNestedGenericTypes.NestedGeneric<T>, B extends SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder<T, C, B>> extends Generic.GenericBuilder<NestedGeneric<? extends OtherGeneric<?>>, 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<T, ?, ?> b) {
- super(b);
- }
- }
- public interface OtherGeneric<T> {
- }
-}
+public class SuperBuilderNestedGenericTypes { + public static abstract class Generic<T extends Generic<?>> { + @java.lang.SuppressWarnings("all") + public static abstract class GenericBuilder<T extends Generic<?>, C extends SuperBuilderNestedGenericTypes.Generic<T>, B extends SuperBuilderNestedGenericTypes.Generic.GenericBuilder<T, C, B>> { + @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<T, ?, ?> b) { + } + } + public static abstract class NestedGeneric<T extends OtherGeneric<?>> extends Generic<NestedGeneric<? extends OtherGeneric<?>>> { + @java.lang.SuppressWarnings("all") + public static abstract class NestedGenericBuilder<T extends OtherGeneric<?>, C extends SuperBuilderNestedGenericTypes.NestedGeneric<T>, B extends SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder<T, C, B>> extends Generic.GenericBuilder<NestedGeneric<? extends OtherGeneric<?>>, 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<T, ?, ?> b) { + super(b); + } + } + public interface OtherGeneric<T> { + } +} 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> {
- A field1;
- List<String> items;
- @java.lang.SuppressWarnings("all")
- public static abstract class ParentBuilder<A, C extends SuperBuilderWithCustomBuilderMethod.Parent<A>, B extends SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, C, B>> {
- @java.lang.SuppressWarnings("all")
- private A field1;
- @java.lang.SuppressWarnings("all")
- private java.util.ArrayList<String> 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<String>();
- this.items.add(item);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B items(final java.util.Collection<? extends String> items) {
- if (items == null) {
- throw new java.lang.NullPointerException("items cannot be null");
- }
- if (this.items == null) this.items = new java.util.ArrayList<String>();
- 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<A> extends SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, SuperBuilderWithCustomBuilderMethod.Parent<A>, SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl<A>> {
- @java.lang.SuppressWarnings("all")
- private ParentBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl<A> self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithCustomBuilderMethod.Parent<A> build() {
- return new SuperBuilderWithCustomBuilderMethod.Parent<A>(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Parent(final SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, ?, ?> b) {
- this.field1 = b.field1;
- java.util.List<String> 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<String>(b.items));
- }
- this.items = items;
- }
- @java.lang.SuppressWarnings("all")
- public static <A> SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, ?, ?> builder() {
- return new SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl<A>();
- }
- }
- public static class Child<A> extends Parent<A> {
- double field3;
- public static <A> ChildBuilder<A, ?, ?> builder() {
- return new ChildBuilderImpl<A>().item("default item");
- }
- @java.lang.SuppressWarnings("all")
- public static abstract class ChildBuilder<A, C extends SuperBuilderWithCustomBuilderMethod.Child<A>, B extends SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder<A, C, B>> extends Parent.ParentBuilder<A, C, B> {
- @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<A> extends SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder<A, SuperBuilderWithCustomBuilderMethod.Child<A>, SuperBuilderWithCustomBuilderMethod.Child.ChildBuilderImpl<A>> {
- @java.lang.SuppressWarnings("all")
- private ChildBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderWithCustomBuilderMethod.Child.ChildBuilderImpl<A> self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithCustomBuilderMethod.Child<A> build() {
- return new SuperBuilderWithCustomBuilderMethod.Child<A>(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Child(final SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder<A, ?, ?> b) {
- super(b);
- this.field3 = b.field3;
- }
- }
- public static void test() {
- Child<Integer> x = Child.<Integer>builder().field3(0.0).field1(5).item("").build();
- }
-}
+import java.util.List; +public class SuperBuilderWithCustomBuilderMethod { + public static class Parent<A> { + A field1; + List<String> items; + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder<A, C extends SuperBuilderWithCustomBuilderMethod.Parent<A>, B extends SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, C, B>> { + @java.lang.SuppressWarnings("all") + private A field1; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<String> 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<String>(); + this.items.add(item); + return self(); + } + @java.lang.SuppressWarnings("all") + public B items(final java.util.Collection<? extends String> items) { + if (items == null) { + throw new java.lang.NullPointerException("items cannot be null"); + } + if (this.items == null) this.items = new java.util.ArrayList<String>(); + 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<A> extends SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, SuperBuilderWithCustomBuilderMethod.Parent<A>, SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl<A>> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl<A> self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithCustomBuilderMethod.Parent<A> build() { + return new SuperBuilderWithCustomBuilderMethod.Parent<A>(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, ?, ?> b) { + this.field1 = b.field1; + java.util.List<String> 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<String>(b.items)); + } + this.items = items; + } + @java.lang.SuppressWarnings("all") + public static <A> SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, ?, ?> builder() { + return new SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl<A>(); + } + } + public static class Child<A> extends Parent<A> { + double field3; + public static <A> ChildBuilder<A, ?, ?> builder() { + return new ChildBuilderImpl<A>().item("default item"); + } + @java.lang.SuppressWarnings("all") + public static abstract class ChildBuilder<A, C extends SuperBuilderWithCustomBuilderMethod.Child<A>, B extends SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder<A, C, B>> extends Parent.ParentBuilder<A, C, B> { + @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<A> extends SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder<A, SuperBuilderWithCustomBuilderMethod.Child<A>, SuperBuilderWithCustomBuilderMethod.Child.ChildBuilderImpl<A>> { + @java.lang.SuppressWarnings("all") + private ChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithCustomBuilderMethod.Child.ChildBuilderImpl<A> self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithCustomBuilderMethod.Child<A> build() { + return new SuperBuilderWithCustomBuilderMethod.Child<A>(this); + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder<A, ?, ?> b) { + super(b); + this.field3 = b.field3; + } + } + public static void test() { + Child<Integer> x = Child.<Integer>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<N extends Number> {
- private long millis;
- private N numberField;
- @java.lang.SuppressWarnings("all")
- private static <N extends Number> long $default$millis() {
- return System.currentTimeMillis();
- }
- @java.lang.SuppressWarnings("all")
- private static <N extends Number> N $default$numberField() {
- return null;
- }
- @java.lang.SuppressWarnings("all")
- public static abstract class ParentBuilder<N extends Number, C extends SuperBuilderWithDefaults.Parent<N>, B extends SuperBuilderWithDefaults.Parent.ParentBuilder<N, C, B>> {
- @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<N extends Number> extends SuperBuilderWithDefaults.Parent.ParentBuilder<N, SuperBuilderWithDefaults.Parent<N>, SuperBuilderWithDefaults.Parent.ParentBuilderImpl<N>> {
- @java.lang.SuppressWarnings("all")
- private ParentBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderWithDefaults.Parent.ParentBuilderImpl<N> self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithDefaults.Parent<N> build() {
- return new SuperBuilderWithDefaults.Parent<N>(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Parent(final SuperBuilderWithDefaults.Parent.ParentBuilder<N, ?, ?> b) {
- if (b.millis$set) this.millis = b.millis$value;
- else this.millis = SuperBuilderWithDefaults.Parent.<N>$default$millis();
- if (b.numberField$set) this.numberField = b.numberField$value;
- else this.numberField = SuperBuilderWithDefaults.Parent.<N>$default$numberField();
- }
- @java.lang.SuppressWarnings("all")
- public static <N extends Number> SuperBuilderWithDefaults.Parent.ParentBuilder<N, ?, ?> builder() {
- return new SuperBuilderWithDefaults.Parent.ParentBuilderImpl<N>();
- }
- }
- public static class Child extends Parent<Integer> {
- private double doubleField;
- @java.lang.SuppressWarnings("all")
- private static double $default$doubleField() {
- return Math.PI;
- }
- @java.lang.SuppressWarnings("all")
- public static abstract class ChildBuilder<C extends SuperBuilderWithDefaults.Child, B extends SuperBuilderWithDefaults.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<Integer, C, B> {
- @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<SuperBuilderWithDefaults.Child, SuperBuilderWithDefaults.Child.ChildBuilderImpl> {
- @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<N extends Number> { + private long millis; + private N numberField; + @java.lang.SuppressWarnings("all") + private static <N extends Number> long $default$millis() { + return System.currentTimeMillis(); + } + @java.lang.SuppressWarnings("all") + private static <N extends Number> N $default$numberField() { + return null; + } + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder<N extends Number, C extends SuperBuilderWithDefaults.Parent<N>, B extends SuperBuilderWithDefaults.Parent.ParentBuilder<N, C, B>> { + @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<N extends Number> extends SuperBuilderWithDefaults.Parent.ParentBuilder<N, SuperBuilderWithDefaults.Parent<N>, SuperBuilderWithDefaults.Parent.ParentBuilderImpl<N>> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithDefaults.Parent.ParentBuilderImpl<N> self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithDefaults.Parent<N> build() { + return new SuperBuilderWithDefaults.Parent<N>(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderWithDefaults.Parent.ParentBuilder<N, ?, ?> b) { + if (b.millis$set) this.millis = b.millis$value; + else this.millis = SuperBuilderWithDefaults.Parent.<N>$default$millis(); + if (b.numberField$set) this.numberField = b.numberField$value; + else this.numberField = SuperBuilderWithDefaults.Parent.<N>$default$numberField(); + } + @java.lang.SuppressWarnings("all") + public static <N extends Number> SuperBuilderWithDefaults.Parent.ParentBuilder<N, ?, ?> builder() { + return new SuperBuilderWithDefaults.Parent.ParentBuilderImpl<N>(); + } + } + public static class Child extends Parent<Integer> { + private double doubleField; + @java.lang.SuppressWarnings("all") + private static double $default$doubleField() { + return Math.PI; + } + @java.lang.SuppressWarnings("all") + public static abstract class ChildBuilder<C extends SuperBuilderWithDefaults.Child, B extends SuperBuilderWithDefaults.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<Integer, C, B> { + @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<SuperBuilderWithDefaults.Child, SuperBuilderWithDefaults.Child.ChildBuilderImpl> { + @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> {
- A field1;
- List<String> items;
- @java.lang.SuppressWarnings("all")
- public static abstract class ParentBuilder<A, C extends SuperBuilderWithGenerics.Parent<A>, B extends SuperBuilderWithGenerics.Parent.ParentBuilder<A, C, B>> {
- @java.lang.SuppressWarnings("all")
- private A field1;
- @java.lang.SuppressWarnings("all")
- private java.util.ArrayList<String> 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<String>();
- this.items.add(item);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B items(final java.util.Collection<? extends String> items) {
- if (items == null) {
- throw new java.lang.NullPointerException("items cannot be null");
- }
- if (this.items == null) this.items = new java.util.ArrayList<String>();
- 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<A> extends SuperBuilderWithGenerics.Parent.ParentBuilder<A, SuperBuilderWithGenerics.Parent<A>, SuperBuilderWithGenerics.Parent.ParentBuilderImpl<A>> {
- @java.lang.SuppressWarnings("all")
- private ParentBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderWithGenerics.Parent.ParentBuilderImpl<A> self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithGenerics.Parent<A> build() {
- return new SuperBuilderWithGenerics.Parent<A>(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Parent(final SuperBuilderWithGenerics.Parent.ParentBuilder<A, ?, ?> b) {
- this.field1 = b.field1;
- java.util.List<String> 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<String>(b.items));
- }
- this.items = items;
- }
- @java.lang.SuppressWarnings("all")
- public static <A> SuperBuilderWithGenerics.Parent.ParentBuilder<A, ?, ?> builder() {
- return new SuperBuilderWithGenerics.Parent.ParentBuilderImpl<A>();
- }
- }
- public static class Child<A> extends Parent<A> {
- double field3;
- @java.lang.SuppressWarnings("all")
- public static abstract class ChildBuilder<A, C extends SuperBuilderWithGenerics.Child<A>, B extends SuperBuilderWithGenerics.Child.ChildBuilder<A, C, B>> extends Parent.ParentBuilder<A, C, B> {
- @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<A> extends SuperBuilderWithGenerics.Child.ChildBuilder<A, SuperBuilderWithGenerics.Child<A>, SuperBuilderWithGenerics.Child.ChildBuilderImpl<A>> {
- @java.lang.SuppressWarnings("all")
- private ChildBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderWithGenerics.Child.ChildBuilderImpl<A> self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithGenerics.Child<A> build() {
- return new SuperBuilderWithGenerics.Child<A>(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Child(final SuperBuilderWithGenerics.Child.ChildBuilder<A, ?, ?> b) {
- super(b);
- this.field3 = b.field3;
- }
- @java.lang.SuppressWarnings("all")
- public static <A> SuperBuilderWithGenerics.Child.ChildBuilder<A, ?, ?> builder() {
- return new SuperBuilderWithGenerics.Child.ChildBuilderImpl<A>();
- }
- }
- public static void test() {
- Child<Integer> x = Child.<Integer>builder().field3(0.0).field1(5).item("").build();
- }
-}
+import java.util.List; +public class SuperBuilderWithGenerics { + public static class Parent<A> { + A field1; + List<String> items; + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder<A, C extends SuperBuilderWithGenerics.Parent<A>, B extends SuperBuilderWithGenerics.Parent.ParentBuilder<A, C, B>> { + @java.lang.SuppressWarnings("all") + private A field1; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<String> 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<String>(); + this.items.add(item); + return self(); + } + @java.lang.SuppressWarnings("all") + public B items(final java.util.Collection<? extends String> items) { + if (items == null) { + throw new java.lang.NullPointerException("items cannot be null"); + } + if (this.items == null) this.items = new java.util.ArrayList<String>(); + 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<A> extends SuperBuilderWithGenerics.Parent.ParentBuilder<A, SuperBuilderWithGenerics.Parent<A>, SuperBuilderWithGenerics.Parent.ParentBuilderImpl<A>> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithGenerics.Parent.ParentBuilderImpl<A> self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithGenerics.Parent<A> build() { + return new SuperBuilderWithGenerics.Parent<A>(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderWithGenerics.Parent.ParentBuilder<A, ?, ?> b) { + this.field1 = b.field1; + java.util.List<String> 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<String>(b.items)); + } + this.items = items; + } + @java.lang.SuppressWarnings("all") + public static <A> SuperBuilderWithGenerics.Parent.ParentBuilder<A, ?, ?> builder() { + return new SuperBuilderWithGenerics.Parent.ParentBuilderImpl<A>(); + } + } + public static class Child<A> extends Parent<A> { + double field3; + @java.lang.SuppressWarnings("all") + public static abstract class ChildBuilder<A, C extends SuperBuilderWithGenerics.Child<A>, B extends SuperBuilderWithGenerics.Child.ChildBuilder<A, C, B>> extends Parent.ParentBuilder<A, C, B> { + @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<A> extends SuperBuilderWithGenerics.Child.ChildBuilder<A, SuperBuilderWithGenerics.Child<A>, SuperBuilderWithGenerics.Child.ChildBuilderImpl<A>> { + @java.lang.SuppressWarnings("all") + private ChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithGenerics.Child.ChildBuilderImpl<A> self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithGenerics.Child<A> build() { + return new SuperBuilderWithGenerics.Child<A>(this); + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderWithGenerics.Child.ChildBuilder<A, ?, ?> b) { + super(b); + this.field3 = b.field3; + } + @java.lang.SuppressWarnings("all") + public static <A> SuperBuilderWithGenerics.Child.ChildBuilder<A, ?, ?> builder() { + return new SuperBuilderWithGenerics.Child.ChildBuilderImpl<A>(); + } + } + public static void test() { + Child<Integer> x = Child.<Integer>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> {
- A field1;
- List<String> items;
- @java.lang.SuppressWarnings("all")
- public static abstract class ParentBuilder<A, C extends SuperBuilderWithGenerics2.Parent<A>, B extends SuperBuilderWithGenerics2.Parent.ParentBuilder<A, C, B>> {
- @java.lang.SuppressWarnings("all")
- private A field1;
- @java.lang.SuppressWarnings("all")
- private java.util.ArrayList<String> 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<String>();
- this.items.add(item);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B items(final java.util.Collection<? extends String> items) {
- if (items == null) {
- throw new java.lang.NullPointerException("items cannot be null");
- }
- if (this.items == null) this.items = new java.util.ArrayList<String>();
- 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<A> extends SuperBuilderWithGenerics2.Parent.ParentBuilder<A, SuperBuilderWithGenerics2.Parent<A>, SuperBuilderWithGenerics2.Parent.ParentBuilderImpl<A>> {
- @java.lang.SuppressWarnings("all")
- private ParentBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderWithGenerics2.Parent.ParentBuilderImpl<A> self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithGenerics2.Parent<A> build() {
- return new SuperBuilderWithGenerics2.Parent<A>(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Parent(final SuperBuilderWithGenerics2.Parent.ParentBuilder<A, ?, ?> b) {
- this.field1 = b.field1;
- java.util.List<String> 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<String>(b.items));
- }
- this.items = items;
- }
- @java.lang.SuppressWarnings("all")
- public static <A> SuperBuilderWithGenerics2.Parent.ParentBuilder<A, ?, ?> builder() {
- return new SuperBuilderWithGenerics2.Parent.ParentBuilderImpl<A>();
- }
- }
- public static class Child<A> extends Parent<String> {
- A field3;
- @java.lang.SuppressWarnings("all")
- public static abstract class ChildBuilder<A, C extends SuperBuilderWithGenerics2.Child<A>, B extends SuperBuilderWithGenerics2.Child.ChildBuilder<A, C, B>> extends Parent.ParentBuilder<String, C, B> {
- @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<A> extends SuperBuilderWithGenerics2.Child.ChildBuilder<A, SuperBuilderWithGenerics2.Child<A>, SuperBuilderWithGenerics2.Child.ChildBuilderImpl<A>> {
- @java.lang.SuppressWarnings("all")
- private ChildBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderWithGenerics2.Child.ChildBuilderImpl<A> self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithGenerics2.Child<A> build() {
- return new SuperBuilderWithGenerics2.Child<A>(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Child(final SuperBuilderWithGenerics2.Child.ChildBuilder<A, ?, ?> b) {
- super(b);
- this.field3 = b.field3;
- }
- @java.lang.SuppressWarnings("all")
- public static <A> SuperBuilderWithGenerics2.Child.ChildBuilder<A, ?, ?> builder2() {
- return new SuperBuilderWithGenerics2.Child.ChildBuilderImpl<A>();
- }
- }
- public static void test() {
- Child<Integer> x = Child.<Integer>builder2().field3(1).field1("value").item("").build();
- }
-}
+import java.util.List; +public class SuperBuilderWithGenerics2 { + public static class Parent<A> { + A field1; + List<String> items; + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder<A, C extends SuperBuilderWithGenerics2.Parent<A>, B extends SuperBuilderWithGenerics2.Parent.ParentBuilder<A, C, B>> { + @java.lang.SuppressWarnings("all") + private A field1; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<String> 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<String>(); + this.items.add(item); + return self(); + } + @java.lang.SuppressWarnings("all") + public B items(final java.util.Collection<? extends String> items) { + if (items == null) { + throw new java.lang.NullPointerException("items cannot be null"); + } + if (this.items == null) this.items = new java.util.ArrayList<String>(); + 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<A> extends SuperBuilderWithGenerics2.Parent.ParentBuilder<A, SuperBuilderWithGenerics2.Parent<A>, SuperBuilderWithGenerics2.Parent.ParentBuilderImpl<A>> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithGenerics2.Parent.ParentBuilderImpl<A> self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithGenerics2.Parent<A> build() { + return new SuperBuilderWithGenerics2.Parent<A>(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderWithGenerics2.Parent.ParentBuilder<A, ?, ?> b) { + this.field1 = b.field1; + java.util.List<String> 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<String>(b.items)); + } + this.items = items; + } + @java.lang.SuppressWarnings("all") + public static <A> SuperBuilderWithGenerics2.Parent.ParentBuilder<A, ?, ?> builder() { + return new SuperBuilderWithGenerics2.Parent.ParentBuilderImpl<A>(); + } + } + public static class Child<A> extends Parent<String> { + A field3; + @java.lang.SuppressWarnings("all") + public static abstract class ChildBuilder<A, C extends SuperBuilderWithGenerics2.Child<A>, B extends SuperBuilderWithGenerics2.Child.ChildBuilder<A, C, B>> extends Parent.ParentBuilder<String, C, B> { + @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<A> extends SuperBuilderWithGenerics2.Child.ChildBuilder<A, SuperBuilderWithGenerics2.Child<A>, SuperBuilderWithGenerics2.Child.ChildBuilderImpl<A>> { + @java.lang.SuppressWarnings("all") + private ChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithGenerics2.Child.ChildBuilderImpl<A> self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithGenerics2.Child<A> build() { + return new SuperBuilderWithGenerics2.Child<A>(this); + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderWithGenerics2.Child.ChildBuilder<A, ?, ?> b) { + super(b); + this.field3 = b.field3; + } + @java.lang.SuppressWarnings("all") + public static <A> SuperBuilderWithGenerics2.Child.ChildBuilder<A, ?, ?> builder2() { + return new SuperBuilderWithGenerics2.Child.ChildBuilderImpl<A>(); + } + } + public static void test() { + Child<Integer> x = Child.<Integer>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> {
- A field1;
- Map<Integer, String> items;
- @java.lang.SuppressWarnings("all")
- public static abstract class ParentBuilder<A, C extends SuperBuilderWithGenericsAndToBuilder.Parent<A>, B extends SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, C, B>> {
- @java.lang.SuppressWarnings("all")
- private A field1;
- @java.lang.SuppressWarnings("all")
- private java.util.ArrayList<Integer> items$key;
- @java.lang.SuppressWarnings("all")
- private java.util.ArrayList<String> 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 <A> void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithGenericsAndToBuilder.Parent<A> instance, final SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> 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<Integer>();
- this.items$value = new java.util.ArrayList<String>();
- }
- this.items$key.add(itemKey);
- this.items$value.add(itemValue);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B items(final java.util.Map<? extends Integer, ? extends String> 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<Integer>();
- this.items$value = new java.util.ArrayList<String>();
- }
- for (final java.util.Map.Entry<? extends Integer, ? extends String> $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<A> extends SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, SuperBuilderWithGenericsAndToBuilder.Parent<A>, SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A>> {
- @java.lang.SuppressWarnings("all")
- private ParentBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A> self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithGenericsAndToBuilder.Parent<A> build() {
- return new SuperBuilderWithGenericsAndToBuilder.Parent<A>(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Parent(final SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> b) {
- this.field1 = b.field1;
- java.util.Map<Integer, String> 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<Integer, String>(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 <A> SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> builder() {
- return new SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A>();
- }
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> toBuilder() {
- return new SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A>().$fillValuesFrom(this);
- }
- }
- public static class Child<A> extends Parent<A> {
- double field3;
- @java.lang.SuppressWarnings("all")
- public static abstract class ChildBuilder<A, C extends SuperBuilderWithGenericsAndToBuilder.Child<A>, B extends SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, C, B>> extends Parent.ParentBuilder<A, C, B> {
- @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 <A> void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithGenericsAndToBuilder.Child<A> instance, final SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> 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<A> extends SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, SuperBuilderWithGenericsAndToBuilder.Child<A>, SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A>> {
- @java.lang.SuppressWarnings("all")
- private ChildBuilderImpl() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- protected SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A> self() {
- return this;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithGenericsAndToBuilder.Child<A> build() {
- return new SuperBuilderWithGenericsAndToBuilder.Child<A>(this);
- }
- }
- @java.lang.SuppressWarnings("all")
- protected Child(final SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> b) {
- super(b);
- this.field3 = b.field3;
- }
- @java.lang.SuppressWarnings("all")
- public static <A> SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> builder() {
- return new SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A>();
- }
- @java.lang.SuppressWarnings("all")
- public SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> toBuilder() {
- return new SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A>().$fillValuesFrom(this);
- }
- }
- public static void test() {
- Child<Integer> x = Child.<Integer>builder().field3(0.0).field1(5).item(5, "").build().toBuilder().build();
- }
-}
+import java.util.Map; +public class SuperBuilderWithGenericsAndToBuilder { + public static class Parent<A> { + A field1; + Map<Integer, String> items; + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder<A, C extends SuperBuilderWithGenericsAndToBuilder.Parent<A>, B extends SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, C, B>> { + @java.lang.SuppressWarnings("all") + private A field1; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<Integer> items$key; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<String> 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 <A> void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithGenericsAndToBuilder.Parent<A> instance, final SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> 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<Integer>(); + this.items$value = new java.util.ArrayList<String>(); + } + this.items$key.add(itemKey); + this.items$value.add(itemValue); + return self(); + } + @java.lang.SuppressWarnings("all") + public B items(final java.util.Map<? extends Integer, ? extends String> 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<Integer>(); + this.items$value = new java.util.ArrayList<String>(); + } + for (final java.util.Map.Entry<? extends Integer, ? extends String> $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<A> extends SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, SuperBuilderWithGenericsAndToBuilder.Parent<A>, SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A>> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A> self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithGenericsAndToBuilder.Parent<A> build() { + return new SuperBuilderWithGenericsAndToBuilder.Parent<A>(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> b) { + this.field1 = b.field1; + java.util.Map<Integer, String> 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<Integer, String>(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 <A> SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> builder() { + return new SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A>(); + } + @java.lang.SuppressWarnings("all") + public SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> toBuilder() { + return new SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A>().$fillValuesFrom(this); + } + } + public static class Child<A> extends Parent<A> { + double field3; + @java.lang.SuppressWarnings("all") + public static abstract class ChildBuilder<A, C extends SuperBuilderWithGenericsAndToBuilder.Child<A>, B extends SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, C, B>> extends Parent.ParentBuilder<A, C, B> { + @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 <A> void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithGenericsAndToBuilder.Child<A> instance, final SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> 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<A> extends SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, SuperBuilderWithGenericsAndToBuilder.Child<A>, SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A>> { + @java.lang.SuppressWarnings("all") + private ChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A> self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithGenericsAndToBuilder.Child<A> build() { + return new SuperBuilderWithGenericsAndToBuilder.Child<A>(this); + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> b) { + super(b); + this.field3 = b.field3; + } + @java.lang.SuppressWarnings("all") + public static <A> SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> builder() { + return new SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A>(); + } + @java.lang.SuppressWarnings("all") + public SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> toBuilder() { + return new SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A>().$fillValuesFrom(this); + } + } + public static void test() { + Child<Integer> x = Child.<Integer>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<C extends SuperBuilderWithNonNull.Parent, B extends SuperBuilderWithNonNull.Parent.ParentBuilder<C, B>> {
- @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<SuperBuilderWithNonNull.Parent, SuperBuilderWithNonNull.Parent.ParentBuilderImpl> {
- @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<C extends SuperBuilderWithNonNull.Child, B extends SuperBuilderWithNonNull.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> {
- @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<SuperBuilderWithNonNull.Child, SuperBuilderWithNonNull.Child.ChildBuilderImpl> {
- @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<C extends SuperBuilderWithNonNull.Parent, B extends SuperBuilderWithNonNull.Parent.ParentBuilder<C, B>> { + @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<SuperBuilderWithNonNull.Parent, SuperBuilderWithNonNull.Parent.ParentBuilderImpl> { + @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<C extends SuperBuilderWithNonNull.Child, B extends SuperBuilderWithNonNull.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { + @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<SuperBuilderWithNonNull.Child, SuperBuilderWithNonNull.Child.ChildBuilderImpl> { + @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<String> items;
- private int method() {
- return 2;
- }
- private static String staticMethod(Parent instance) {
- return "staticMethod";
- }
- @java.lang.SuppressWarnings("all")
- public static abstract class ParentBuilder<C extends SuperBuilderWithSetterPrefix.Parent, B extends SuperBuilderWithSetterPrefix.Parent.ParentBuilder<C, B>> {
- @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<String> 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<String>();
- this.items.add(item);
- return self();
- }
- @java.lang.SuppressWarnings("all")
- public B withItems(final java.util.Collection<? extends String> items) {
- if (items == null) {
- throw new java.lang.NullPointerException("items cannot be null");
- }
- if (this.items == null) this.items = new java.util.ArrayList<String>();
- 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<SuperBuilderWithSetterPrefix.Parent, SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl> {
- @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<String> 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<String>(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<C extends SuperBuilderWithSetterPrefix.Child, B extends SuperBuilderWithSetterPrefix.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> {
- @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<SuperBuilderWithSetterPrefix.Child, SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl> {
- @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<String> items; + private int method() { + return 2; + } + private static String staticMethod(Parent instance) { + return "staticMethod"; + } + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder<C extends SuperBuilderWithSetterPrefix.Parent, B extends SuperBuilderWithSetterPrefix.Parent.ParentBuilder<C, B>> { + @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<String> 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<String>(); + this.items.add(item); + return self(); + } + @java.lang.SuppressWarnings("all") + public B withItems(final java.util.Collection<? extends String> items) { + if (items == null) { + throw new java.lang.NullPointerException("items cannot be null"); + } + if (this.items == null) this.items = new java.util.ArrayList<String>(); + 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<SuperBuilderWithSetterPrefix.Parent, SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl> { + @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<String> 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<String>(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<C extends SuperBuilderWithSetterPrefix.Child, B extends SuperBuilderWithSetterPrefix.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { + @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<SuperBuilderWithSetterPrefix.Child, SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl> { + @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(); + } +} |