diff options
Diffstat (limited to 'test/transform/resource')
87 files changed, 3929 insertions, 3906 deletions
diff --git a/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypes.java b/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypes.java index f6fa22de..7568d812 100644 --- a/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypes.java +++ b/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypes.java @@ -1,3 +1,4 @@ +//version 8: import java.lang.annotation.ElementType; import java.lang.annotation.Target; import java.util.Set; diff --git a/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypesWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypesWithSetterPrefix.java index 6dbbeee4..d58caf4d 100644 --- a/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypesWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypesWithSetterPrefix.java @@ -1,3 +1,4 @@ +//version 8: import java.lang.annotation.ElementType; import java.lang.annotation.Target; import java.util.Set; diff --git a/test/transform/resource/after-delombok/BuilderSingularNullBehavior2.java b/test/transform/resource/after-delombok/BuilderSingularNullBehavior2.java index e70877bf..5f605de4 100644 --- a/test/transform/resource/after-delombok/BuilderSingularNullBehavior2.java +++ b/test/transform/resource/after-delombok/BuilderSingularNullBehavior2.java @@ -1,3 +1,4 @@ +//version 8: springframework dep is too new to run on j6 import java.util.List; class BuilderSingularNullBehavior2 { private List<String> locations; diff --git a/test/transform/resource/after-delombok/CheckerFrameworkBasic.java b/test/transform/resource/after-delombok/CheckerFrameworkBasic.java index f7f38b29..2beafc4c 100644 --- a/test/transform/resource/after-delombok/CheckerFrameworkBasic.java +++ b/test/transform/resource/after-delombok/CheckerFrameworkBasic.java @@ -1,3 +1,4 @@ +//version 8: class CheckerFrameworkBasic { private final int x; private final int y; diff --git a/test/transform/resource/after-delombok/CheckerFrameworkSuperBuilder.java b/test/transform/resource/after-delombok/CheckerFrameworkSuperBuilder.java index e1ac7c00..8dcdaf10 100644 --- a/test/transform/resource/after-delombok/CheckerFrameworkSuperBuilder.java +++ b/test/transform/resource/after-delombok/CheckerFrameworkSuperBuilder.java @@ -1,3 +1,4 @@ +//version 8: import java.util.List; class CheckerFrameworkSuperBuilder { public static class Parent { diff --git a/test/transform/resource/after-delombok/EqualsAndHashCodeAnnotated.java b/test/transform/resource/after-delombok/EqualsAndHashCodeAnnotated.java index 64b6f4d3..d99fc71c 100644 --- a/test/transform/resource/after-delombok/EqualsAndHashCodeAnnotated.java +++ b/test/transform/resource/after-delombok/EqualsAndHashCodeAnnotated.java @@ -1,3 +1,4 @@ +//version 8: import java.lang.annotation.*; class EqualsAndHashCodeAnnotated { diff --git a/test/transform/resource/after-delombok/ExtensionMethodFunctional.java b/test/transform/resource/after-delombok/ExtensionMethodFunctional.java index fb58eb91..2b82a957 100644 --- a/test/transform/resource/after-delombok/ExtensionMethodFunctional.java +++ b/test/transform/resource/after-delombok/ExtensionMethodFunctional.java @@ -1,3 +1,4 @@ +// version 8: import java.util.function.Consumer; import java.util.function.Function; import java.util.List; @@ -10,7 +11,7 @@ class ExtensionMethodFunctional { test = ExtensionMethodFunctional.Extensions.map(test, s -> ExtensionMethodFunctional.Extensions.reverse(s)); ExtensionMethodFunctional.Extensions.consume(test, s -> System.out.println("1: " + s), s -> System.out.println("2: " + s)); ExtensionMethodFunctional.Extensions.consume(test, System.out::println, System.out::println); - ExtensionMethodFunctional.Extensions.toList(Stream.of("a", "b", "c").map(String::toUpperCase)); + ExtensionMethodFunctional.Extensions.toList1(Stream.of("a", "b", "c").map(String::toUpperCase)); List<Integer> i2 = ExtensionMethodFunctional.Extensions.toList2(Stream.of("a", "b", "c").map(String::toUpperCase)); } @@ -30,7 +31,7 @@ class ExtensionMethodFunctional { } } - public static <T> List<T> toList(Stream<T> stream) { + public static <T> List<T> toList1(Stream<T> stream) { return (List<T>) stream.collect(Collectors.toList()); } diff --git a/test/transform/resource/after-delombok/GetterLazyArguments.java b/test/transform/resource/after-delombok/GetterLazyArguments.java index a8a422c0..604513cd 100644 --- a/test/transform/resource/after-delombok/GetterLazyArguments.java +++ b/test/transform/resource/after-delombok/GetterLazyArguments.java @@ -1,3 +1,4 @@ +// version 8: class GetterLazyArguments { static String fun() { return null; diff --git a/test/transform/resource/after-delombok/JacksonBuilderSingular.java b/test/transform/resource/after-delombok/JacksonBuilderSingular.java index feaa6832..b2bbfa5a 100644 --- a/test/transform/resource/after-delombok/JacksonBuilderSingular.java +++ b/test/transform/resource/after-delombok/JacksonBuilderSingular.java @@ -1,3 +1,4 @@ +//version 8: Jackson deps are at least Java7+. import java.util.List; import java.util.Map; import com.fasterxml.jackson.annotation.JsonAnySetter; diff --git a/test/transform/resource/after-delombok/JacksonJsonProperty.java b/test/transform/resource/after-delombok/JacksonJsonProperty.java index 14e50447..7bb17dfd 100644 --- a/test/transform/resource/after-delombok/JacksonJsonProperty.java +++ b/test/transform/resource/after-delombok/JacksonJsonProperty.java @@ -1,3 +1,4 @@ +//version 8: Jackson deps are at least Java7+. import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.Nulls; diff --git a/test/transform/resource/after-delombok/JacksonizedBuilderComplex.java b/test/transform/resource/after-delombok/JacksonizedBuilderComplex.java index 5abfda63..ed0ca9e7 100644 --- a/test/transform/resource/after-delombok/JacksonizedBuilderComplex.java +++ b/test/transform/resource/after-delombok/JacksonizedBuilderComplex.java @@ -1,3 +1,4 @@ +//version 8: Jackson deps are at least Java7+. //CONF: lombok.builder.className = Test*Name import java.util.List; @com.fasterxml.jackson.databind.annotation.JsonDeserialize(builder = JacksonizedBuilderComplex.TestVoidName.class) diff --git a/test/transform/resource/after-delombok/JacksonizedBuilderSimple.java b/test/transform/resource/after-delombok/JacksonizedBuilderSimple.java index 550163b9..cb8390d2 100644 --- a/test/transform/resource/after-delombok/JacksonizedBuilderSimple.java +++ b/test/transform/resource/after-delombok/JacksonizedBuilderSimple.java @@ -1,3 +1,4 @@ +//version 8: Jackson deps are at least Java7+. import java.util.List; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @JsonIgnoreProperties(ignoreUnknown = true) diff --git a/test/transform/resource/after-delombok/JacksonizedSuperBuilderSimple.java b/test/transform/resource/after-delombok/JacksonizedSuperBuilderSimple.java index a5765934..88a51f41 100644 --- a/test/transform/resource/after-delombok/JacksonizedSuperBuilderSimple.java +++ b/test/transform/resource/after-delombok/JacksonizedSuperBuilderSimple.java @@ -1,58 +1,59 @@ -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/LoggerLog4j2.java b/test/transform/resource/after-delombok/LoggerLog4j2.java index b32c7722..cba516f2 100644 --- a/test/transform/resource/after-delombok/LoggerLog4j2.java +++ b/test/transform/resource/after-delombok/LoggerLog4j2.java @@ -1,3 +1,4 @@ +//version 8: class LoggerLog4j2 { @java.lang.SuppressWarnings("all") private static final org.apache.logging.log4j.Logger log = org.apache.logging.log4j.LogManager.getLogger(LoggerLog4j2.class); diff --git a/test/transform/resource/after-delombok/LoggerSlf4jInvalidTopic.java b/test/transform/resource/after-delombok/LoggerSlf4jInvalidTopic.java deleted file mode 100644 index 86e6ae2c..00000000 --- a/test/transform/resource/after-delombok/LoggerSlf4jInvalidTopic.java +++ /dev/null @@ -1,5 +0,0 @@ -import lombok.extern.slf4j.Slf4j; - -@Slf4j(topic = 42) -class LoggerSlf4jWithIntegerTopic { -}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/NonNullTypeUse.java b/test/transform/resource/after-delombok/NonNullTypeUse.java index 7c438501..b80a6da8 100644 --- a/test/transform/resource/after-delombok/NonNullTypeUse.java +++ b/test/transform/resource/after-delombok/NonNullTypeUse.java @@ -1,3 +1,4 @@ +//version 8: import lombok.NonNull; class NonNullTypeUse { void test1(@NonNull String[][][] args) { diff --git a/test/transform/resource/after-delombok/NullLibrary1.java b/test/transform/resource/after-delombok/NullLibrary1.java index e19c535d..e299be3d 100644 --- a/test/transform/resource/after-delombok/NullLibrary1.java +++ b/test/transform/resource/after-delombok/NullLibrary1.java @@ -1,3 +1,4 @@ +//version 8: public class NullLibrary1 { String foo; @java.lang.Override diff --git a/test/transform/resource/after-delombok/NullLibrary2.java b/test/transform/resource/after-delombok/NullLibrary2.java index 5087e4ee..fec143c2 100644 --- a/test/transform/resource/after-delombok/NullLibrary2.java +++ b/test/transform/resource/after-delombok/NullLibrary2.java @@ -1,3 +1,4 @@ +//version 8: springframework dep is too new to run on j6 public class NullLibrary2 { String foo; @java.lang.Override 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..add6f841 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.<String>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/SuperBuilderSingularAnnotatedTypes.java b/test/transform/resource/after-delombok/SuperBuilderSingularAnnotatedTypes.java index f6e0f024..ad51816a 100644 --- a/test/transform/resource/after-delombok/SuperBuilderSingularAnnotatedTypes.java +++ b/test/transform/resource/after-delombok/SuperBuilderSingularAnnotatedTypes.java @@ -1,3 +1,4 @@ +//version 8: import java.lang.annotation.ElementType; import java.lang.annotation.Target; import java.util.Set; diff --git a/test/transform/resource/after-delombok/SuperBuilderWithCustomBuilderMethod.java b/test/transform/resource/after-delombok/SuperBuilderWithCustomBuilderMethod.java index 7e9337c9..9237a148 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithCustomBuilderMethod.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithCustomBuilderMethod.java @@ -1,141 +1,142 @@ -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();
- }
-}
+//version 8: Javac 6 will error out due to `ChildBuilder` not existing before properly running lombok. Giving j6 support status, not worth fixing. +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..28c48db3 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.<Integer, String>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..88db8511 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.<String>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(); + } +} diff --git a/test/transform/resource/after-delombok/TypeUseAnnotations.java b/test/transform/resource/after-delombok/TypeUseAnnotations.java index fbf32577..37c24c53 100644 --- a/test/transform/resource/after-delombok/TypeUseAnnotations.java +++ b/test/transform/resource/after-delombok/TypeUseAnnotations.java @@ -1,3 +1,4 @@ +//version 8: import java.lang.annotation.ElementType; import java.lang.annotation.Target; import java.util.List; diff --git a/test/transform/resource/after-delombok/ValDelegateMethodReference.java b/test/transform/resource/after-delombok/ValDelegateMethodReference.java index 186e2aaa..c62edd66 100644 --- a/test/transform/resource/after-delombok/ValDelegateMethodReference.java +++ b/test/transform/resource/after-delombok/ValDelegateMethodReference.java @@ -1,3 +1,4 @@ +//version 8: import java.util.function.Function; public class ValDelegateMethodReference { diff --git a/test/transform/resource/after-delombok/ValWeirdTypes.java b/test/transform/resource/after-delombok/ValWeirdTypes.java index bc18fdac..b3ecfc49 100644 --- a/test/transform/resource/after-delombok/ValWeirdTypes.java +++ b/test/transform/resource/after-delombok/ValWeirdTypes.java @@ -1,3 +1,4 @@ +// version 8: In java6/7, lub types worked differently, so, the `arraysAsList` method has a slightly different inferred type there. import java.math.BigDecimal; import java.util.*; public class ValWeirdTypes<Z> { diff --git a/test/transform/resource/after-delombok/WithByNullAnnos.java b/test/transform/resource/after-delombok/WithByNullAnnos.java index cdaed973..04d64f16 100644 --- a/test/transform/resource/after-delombok/WithByNullAnnos.java +++ b/test/transform/resource/after-delombok/WithByNullAnnos.java @@ -1,3 +1,4 @@ +//version 8: import java.util.List; public class WithByNullAnnos { final List<String> test; diff --git a/test/transform/resource/after-delombok/WithByTypes.java b/test/transform/resource/after-delombok/WithByTypes.java index e5e2fb07..f1f1ef5f 100644 --- a/test/transform/resource/after-delombok/WithByTypes.java +++ b/test/transform/resource/after-delombok/WithByTypes.java @@ -1,3 +1,4 @@ +//version 8: public class WithByTypes<T> { private final int a; private final long b; diff --git a/test/transform/resource/after-delombok/WithPlain.java b/test/transform/resource/after-delombok/WithPlain.java index 547c6fb9..6a1c46e6 100644 --- a/test/transform/resource/after-delombok/WithPlain.java +++ b/test/transform/resource/after-delombok/WithPlain.java @@ -1,3 +1,4 @@ +//version 8: springframework dep is too new to run on j6 class WithPlain { int i; final int foo; diff --git a/test/transform/resource/after-ecj/BuilderSingularNullBehavior2.java b/test/transform/resource/after-ecj/BuilderSingularNullBehavior2.java index cf4bd91b..e1adccb5 100644 --- a/test/transform/resource/after-ecj/BuilderSingularNullBehavior2.java +++ b/test/transform/resource/after-ecj/BuilderSingularNullBehavior2.java @@ -1,3 +1,4 @@ +//version 8: springframework dep is too new to run on j6 import java.util.List; import lombok.Singular; @lombok.Builder class BuilderSingularNullBehavior2 { diff --git a/test/transform/resource/after-ecj/ExtensionMethodFunctional.java b/test/transform/resource/after-ecj/ExtensionMethodFunctional.java index e847c1f0..0971a9be 100644 --- a/test/transform/resource/after-ecj/ExtensionMethodFunctional.java +++ b/test/transform/resource/after-ecj/ExtensionMethodFunctional.java @@ -21,7 +21,7 @@ import lombok.experimental.ExtensionMethod; consumer[i].accept(o); } } - public static <T>List<T> toList(Stream<T> stream) { + public static <T>List<T> toList1(Stream<T> stream) { return (List<T>) stream.collect(Collectors.toList()); } public static <T, U>List<U> toList2(Stream<T> stream) { @@ -36,7 +36,7 @@ import lombok.experimental.ExtensionMethod; test = ExtensionMethodFunctional.Extensions.map(test, (<no type> s) -> ExtensionMethodFunctional.Extensions.reverse(s)); ExtensionMethodFunctional.Extensions.consume(test, (<no type> s) -> System.out.println(("1: " + s)), (<no type> s) -> System.out.println(("2: " + s))); ExtensionMethodFunctional.Extensions.consume(test, System.out::println, System.out::println); - ExtensionMethodFunctional.Extensions.toList(Stream.of("a", "b", "c").map(String::toUpperCase)); + ExtensionMethodFunctional.Extensions.toList1(Stream.of("a", "b", "c").map(String::toUpperCase)); List<Integer> i2 = ExtensionMethodFunctional.Extensions.toList2(Stream.of("a", "b", "c").map(String::toUpperCase)); } } diff --git a/test/transform/resource/after-ecj/LoggerSlf4jInvalidTopic.java b/test/transform/resource/after-ecj/LoggerSlf4jInvalidTopic.java deleted file mode 100644 index 33e212e3..00000000 --- a/test/transform/resource/after-ecj/LoggerSlf4jInvalidTopic.java +++ /dev/null @@ -1,9 +0,0 @@ -import lombok.extern.slf4j.Slf4j; -@Slf4j(topic = 42) class LoggerSlf4jWithIntegerTopic { - private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(42); - <clinit>() { - } - LoggerSlf4jWithIntegerTopic() { - super(); - } -}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/SuperBuilderAbstract.java b/test/transform/resource/after-ecj/SuperBuilderAbstract.java index 88406272..2fef9451 100644 --- a/test/transform/resource/after-ecj/SuperBuilderAbstract.java +++ b/test/transform/resource/after-ecj/SuperBuilderAbstract.java @@ -1,111 +1,111 @@ -public class SuperBuilderAbstract {
- public static @lombok.experimental.SuperBuilder class Parent {
- public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<C extends SuperBuilderAbstract.Parent, B extends SuperBuilderAbstract.Parent.ParentBuilder<C, B>> {
- private @java.lang.SuppressWarnings("all") int parentField;
- public ParentBuilder() {
- super();
- }
- protected abstract @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.SuppressWarnings("all") C build();
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B parentField(final int parentField) {
- this.parentField = parentField;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (("SuperBuilderAbstract.Parent.ParentBuilder(parentField=" + this.parentField) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderAbstract.Parent.ParentBuilder<SuperBuilderAbstract.Parent, SuperBuilderAbstract.Parent.ParentBuilderImpl> {
- private ParentBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstract.Parent.ParentBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstract.Parent build() {
- return new SuperBuilderAbstract.Parent(this);
- }
- }
- int parentField;
- protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderAbstract.Parent.ParentBuilder<?, ?> b) {
- super();
- this.parentField = b.parentField;
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderAbstract.Parent.ParentBuilder<?, ?> builder() {
- return new SuperBuilderAbstract.Parent.ParentBuilderImpl();
- }
- }
- public static abstract @lombok.experimental.SuperBuilder class Child extends Parent {
- public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderAbstract.Child, B extends SuperBuilderAbstract.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> {
- private @java.lang.SuppressWarnings("all") double childField;
- public ChildBuilder() {
- super();
- }
- protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build();
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B childField(final double childField) {
- this.childField = childField;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderAbstract.Child.ChildBuilder(super=" + super.toString()) + ", childField=") + this.childField) + ")");
- }
- }
- double childField;
- protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderAbstract.Child.ChildBuilder<?, ?> b) {
- super(b);
- this.childField = b.childField;
- }
- }
- public static @lombok.experimental.SuperBuilder class GrandChild extends Child {
- public static abstract @java.lang.SuppressWarnings("all") class GrandChildBuilder<C extends SuperBuilderAbstract.GrandChild, B extends SuperBuilderAbstract.GrandChild.GrandChildBuilder<C, B>> extends Child.ChildBuilder<C, B> {
- private @java.lang.SuppressWarnings("all") String grandChildField;
- public GrandChildBuilder() {
- super();
- }
- protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build();
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B grandChildField(final String grandChildField) {
- this.grandChildField = grandChildField;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderAbstract.GrandChild.GrandChildBuilder(super=" + super.toString()) + ", grandChildField=") + this.grandChildField) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class GrandChildBuilderImpl extends SuperBuilderAbstract.GrandChild.GrandChildBuilder<SuperBuilderAbstract.GrandChild, SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl> {
- private GrandChildBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstract.GrandChild build() {
- return new SuperBuilderAbstract.GrandChild(this);
- }
- }
- String grandChildField;
- protected @java.lang.SuppressWarnings("all") GrandChild(final SuperBuilderAbstract.GrandChild.GrandChildBuilder<?, ?> b) {
- super(b);
- this.grandChildField = b.grandChildField;
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderAbstract.GrandChild.GrandChildBuilder<?, ?> builder() {
- return new SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl();
- }
- }
- public SuperBuilderAbstract() {
- super();
- }
- public static void test() {
- GrandChild x = GrandChild.builder().grandChildField("").parentField(5).childField(2.5).build();
- }
-}
+public class SuperBuilderAbstract { + public static @lombok.experimental.SuperBuilder class Parent { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<C extends SuperBuilderAbstract.Parent, B extends SuperBuilderAbstract.Parent.ParentBuilder<C, B>> { + private @java.lang.SuppressWarnings("all") int parentField; + public ParentBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B parentField(final int parentField) { + this.parentField = parentField; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("SuperBuilderAbstract.Parent.ParentBuilder(parentField=" + this.parentField) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderAbstract.Parent.ParentBuilder<SuperBuilderAbstract.Parent, SuperBuilderAbstract.Parent.ParentBuilderImpl> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstract.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstract.Parent build() { + return new SuperBuilderAbstract.Parent(this); + } + } + int parentField; + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderAbstract.Parent.ParentBuilder<?, ?> b) { + super(); + this.parentField = b.parentField; + } + public static @java.lang.SuppressWarnings("all") SuperBuilderAbstract.Parent.ParentBuilder<?, ?> builder() { + return new SuperBuilderAbstract.Parent.ParentBuilderImpl(); + } + } + public static abstract @lombok.experimental.SuperBuilder class Child extends Parent { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderAbstract.Child, B extends SuperBuilderAbstract.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { + private @java.lang.SuppressWarnings("all") double childField; + public ChildBuilder() { + super(); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B childField(final double childField) { + this.childField = childField; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderAbstract.Child.ChildBuilder(super=" + super.toString()) + ", childField=") + this.childField) + ")"); + } + } + double childField; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderAbstract.Child.ChildBuilder<?, ?> b) { + super(b); + this.childField = b.childField; + } + } + public static @lombok.experimental.SuperBuilder class GrandChild extends Child { + public static abstract @java.lang.SuppressWarnings("all") class GrandChildBuilder<C extends SuperBuilderAbstract.GrandChild, B extends SuperBuilderAbstract.GrandChild.GrandChildBuilder<C, B>> extends Child.ChildBuilder<C, B> { + private @java.lang.SuppressWarnings("all") String grandChildField; + public GrandChildBuilder() { + super(); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B grandChildField(final String grandChildField) { + this.grandChildField = grandChildField; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderAbstract.GrandChild.GrandChildBuilder(super=" + super.toString()) + ", grandChildField=") + this.grandChildField) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class GrandChildBuilderImpl extends SuperBuilderAbstract.GrandChild.GrandChildBuilder<SuperBuilderAbstract.GrandChild, SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl> { + private GrandChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstract.GrandChild build() { + return new SuperBuilderAbstract.GrandChild(this); + } + } + String grandChildField; + protected @java.lang.SuppressWarnings("all") GrandChild(final SuperBuilderAbstract.GrandChild.GrandChildBuilder<?, ?> b) { + super(b); + this.grandChildField = b.grandChildField; + } + public static @java.lang.SuppressWarnings("all") SuperBuilderAbstract.GrandChild.GrandChildBuilder<?, ?> builder() { + return new SuperBuilderAbstract.GrandChild.GrandChildBuilderImpl(); + } + } + public SuperBuilderAbstract() { + super(); + } + public static void test() { + GrandChild x = GrandChild.builder().grandChildField("").parentField(5).childField(2.5).build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderAbstractToBuilder.java b/test/transform/resource/after-ecj/SuperBuilderAbstractToBuilder.java index d1ce4fa9..2d2cd422 100644 --- a/test/transform/resource/after-ecj/SuperBuilderAbstractToBuilder.java +++ b/test/transform/resource/after-ecj/SuperBuilderAbstractToBuilder.java @@ -1,140 +1,140 @@ -public class SuperBuilderAbstractToBuilder {
- public static @lombok.experimental.SuperBuilder(toBuilder = true) class Parent {
- public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<C extends SuperBuilderAbstractToBuilder.Parent, B extends SuperBuilderAbstractToBuilder.Parent.ParentBuilder<C, B>> {
- private @java.lang.SuppressWarnings("all") int parentField;
- public ParentBuilder() {
- super();
- }
- protected @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) {
- SuperBuilderAbstractToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
- return self();
- }
- private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderAbstractToBuilder.Parent instance, final SuperBuilderAbstractToBuilder.Parent.ParentBuilder<?, ?> b) {
- b.parentField(instance.parentField);
- }
- protected abstract @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.SuppressWarnings("all") C build();
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B parentField(final int parentField) {
- this.parentField = parentField;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (("SuperBuilderAbstractToBuilder.Parent.ParentBuilder(parentField=" + this.parentField) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderAbstractToBuilder.Parent.ParentBuilder<SuperBuilderAbstractToBuilder.Parent, SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl> {
- private ParentBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.Parent build() {
- return new SuperBuilderAbstractToBuilder.Parent(this);
- }
- }
- int parentField;
- protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderAbstractToBuilder.Parent.ParentBuilder<?, ?> b) {
- super();
- this.parentField = b.parentField;
- }
- public @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.Parent.ParentBuilder<?, ?> toBuilder() {
- return new SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl().$fillValuesFrom(this);
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.Parent.ParentBuilder<?, ?> builder() {
- return new SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl();
- }
- }
- public static abstract @lombok.experimental.SuperBuilder(toBuilder = true) class Child extends Parent {
- public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderAbstractToBuilder.Child, B extends SuperBuilderAbstractToBuilder.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> {
- private @java.lang.SuppressWarnings("all") double childField;
- public ChildBuilder() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) {
- super.$fillValuesFrom(instance);
- SuperBuilderAbstractToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
- return self();
- }
- private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderAbstractToBuilder.Child instance, final SuperBuilderAbstractToBuilder.Child.ChildBuilder<?, ?> b) {
- b.childField(instance.childField);
- }
- protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build();
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B childField(final double childField) {
- this.childField = childField;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderAbstractToBuilder.Child.ChildBuilder(super=" + super.toString()) + ", childField=") + this.childField) + ")");
- }
- }
- double childField;
- protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderAbstractToBuilder.Child.ChildBuilder<?, ?> b) {
- super(b);
- this.childField = b.childField;
- }
- }
- public static @lombok.experimental.SuperBuilder(toBuilder = true) class GrandChild extends Child {
- public static abstract @java.lang.SuppressWarnings("all") class GrandChildBuilder<C extends SuperBuilderAbstractToBuilder.GrandChild, B extends SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<C, B>> extends Child.ChildBuilder<C, B> {
- private @java.lang.SuppressWarnings("all") String grandChildField;
- public GrandChildBuilder() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) {
- super.$fillValuesFrom(instance);
- SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
- return self();
- }
- private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderAbstractToBuilder.GrandChild instance, final SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<?, ?> b) {
- b.grandChildField(instance.grandChildField);
- }
- protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build();
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B grandChildField(final String grandChildField) {
- this.grandChildField = grandChildField;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder(super=" + super.toString()) + ", grandChildField=") + this.grandChildField) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class GrandChildBuilderImpl extends SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<SuperBuilderAbstractToBuilder.GrandChild, SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl> {
- private GrandChildBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.GrandChild build() {
- return new SuperBuilderAbstractToBuilder.GrandChild(this);
- }
- }
- String grandChildField;
- protected @java.lang.SuppressWarnings("all") GrandChild(final SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<?, ?> b) {
- super(b);
- this.grandChildField = b.grandChildField;
- }
- public @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<?, ?> toBuilder() {
- return new SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl().$fillValuesFrom(this);
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<?, ?> builder() {
- return new SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl();
- }
- }
- public SuperBuilderAbstractToBuilder() {
- super();
- }
- public static void test() {
- GrandChild x = GrandChild.builder().grandChildField("").parentField(5).childField(2.5).build().toBuilder().build();
- }
-}
+public class SuperBuilderAbstractToBuilder { + public static @lombok.experimental.SuperBuilder(toBuilder = true) class Parent { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<C extends SuperBuilderAbstractToBuilder.Parent, B extends SuperBuilderAbstractToBuilder.Parent.ParentBuilder<C, B>> { + private @java.lang.SuppressWarnings("all") int parentField; + public ParentBuilder() { + super(); + } + protected @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { + SuperBuilderAbstractToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderAbstractToBuilder.Parent instance, final SuperBuilderAbstractToBuilder.Parent.ParentBuilder<?, ?> b) { + b.parentField(instance.parentField); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B parentField(final int parentField) { + this.parentField = parentField; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("SuperBuilderAbstractToBuilder.Parent.ParentBuilder(parentField=" + this.parentField) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderAbstractToBuilder.Parent.ParentBuilder<SuperBuilderAbstractToBuilder.Parent, SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.Parent build() { + return new SuperBuilderAbstractToBuilder.Parent(this); + } + } + int parentField; + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderAbstractToBuilder.Parent.ParentBuilder<?, ?> b) { + super(); + this.parentField = b.parentField; + } + public @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.Parent.ParentBuilder<?, ?> toBuilder() { + return new SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl().$fillValuesFrom(this); + } + public static @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.Parent.ParentBuilder<?, ?> builder() { + return new SuperBuilderAbstractToBuilder.Parent.ParentBuilderImpl(); + } + } + public static abstract @lombok.experimental.SuperBuilder(toBuilder = true) class Child extends Parent { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderAbstractToBuilder.Child, B extends SuperBuilderAbstractToBuilder.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { + private @java.lang.SuppressWarnings("all") double childField; + public ChildBuilder() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { + super.$fillValuesFrom(instance); + SuperBuilderAbstractToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderAbstractToBuilder.Child instance, final SuperBuilderAbstractToBuilder.Child.ChildBuilder<?, ?> b) { + b.childField(instance.childField); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B childField(final double childField) { + this.childField = childField; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderAbstractToBuilder.Child.ChildBuilder(super=" + super.toString()) + ", childField=") + this.childField) + ")"); + } + } + double childField; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderAbstractToBuilder.Child.ChildBuilder<?, ?> b) { + super(b); + this.childField = b.childField; + } + } + public static @lombok.experimental.SuperBuilder(toBuilder = true) class GrandChild extends Child { + public static abstract @java.lang.SuppressWarnings("all") class GrandChildBuilder<C extends SuperBuilderAbstractToBuilder.GrandChild, B extends SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<C, B>> extends Child.ChildBuilder<C, B> { + private @java.lang.SuppressWarnings("all") String grandChildField; + public GrandChildBuilder() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { + super.$fillValuesFrom(instance); + SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderAbstractToBuilder.GrandChild instance, final SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<?, ?> b) { + b.grandChildField(instance.grandChildField); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B grandChildField(final String grandChildField) { + this.grandChildField = grandChildField; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder(super=" + super.toString()) + ", grandChildField=") + this.grandChildField) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class GrandChildBuilderImpl extends SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<SuperBuilderAbstractToBuilder.GrandChild, SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl> { + private GrandChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.GrandChild build() { + return new SuperBuilderAbstractToBuilder.GrandChild(this); + } + } + String grandChildField; + protected @java.lang.SuppressWarnings("all") GrandChild(final SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<?, ?> b) { + super(b); + this.grandChildField = b.grandChildField; + } + public @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<?, ?> toBuilder() { + return new SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl().$fillValuesFrom(this); + } + public static @java.lang.SuppressWarnings("all") SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder<?, ?> builder() { + return new SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilderImpl(); + } + } + public SuperBuilderAbstractToBuilder() { + super(); + } + public static void test() { + GrandChild x = GrandChild.builder().grandChildField("").parentField(5).childField(2.5).build().toBuilder().build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderBasic.java b/test/transform/resource/after-ecj/SuperBuilderBasic.java index b5e835d4..844206d0 100644 --- a/test/transform/resource/after-ecj/SuperBuilderBasic.java +++ b/test/transform/resource/after-ecj/SuperBuilderBasic.java @@ -1,122 +1,122 @@ -import java.util.List;
-public class SuperBuilderBasic {
- public static @lombok.experimental.SuperBuilder class Parent {
- public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<C extends SuperBuilderBasic.Parent, B extends SuperBuilderBasic.Parent.ParentBuilder<C, B>> {
- private @java.lang.SuppressWarnings("all") int field1;
- private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items;
- public ParentBuilder() {
- super();
- }
- protected abstract @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.SuppressWarnings("all") C build();
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B field1(final int field1) {
- this.field1 = field1;
- return self();
- }
- public @java.lang.SuppressWarnings("all") B item(final String item) {
- if ((this.items == null))
- this.items = new java.util.ArrayList<String>();
- this.items.add(item);
- return self();
- }
- public @java.lang.SuppressWarnings("all") 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();
- }
- public @java.lang.SuppressWarnings("all") B clearItems() {
- if ((this.items != null))
- this.items.clear();
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderBasic.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderBasic.Parent.ParentBuilder<SuperBuilderBasic.Parent, SuperBuilderBasic.Parent.ParentBuilderImpl> {
- private ParentBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasic.Parent.ParentBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasic.Parent build() {
- return new SuperBuilderBasic.Parent(this);
- }
- }
- int field1;
- @lombok.Singular List<String> items;
- protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderBasic.Parent.ParentBuilder<?, ?> b) {
- super();
- 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;
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderBasic.Parent.ParentBuilder<?, ?> builder() {
- return new SuperBuilderBasic.Parent.ParentBuilderImpl();
- }
- }
- public static @lombok.experimental.SuperBuilder class Child extends SuperBuilderBasic.Parent {
- public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderBasic.Child, B extends SuperBuilderBasic.Child.ChildBuilder<C, B>> extends SuperBuilderBasic.Parent.ParentBuilder<C, B> {
- private @java.lang.SuppressWarnings("all") double field3;
- public ChildBuilder() {
- super();
- }
- protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build();
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B field3(final double field3) {
- this.field3 = field3;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderBasic.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderBasic.Child.ChildBuilder<SuperBuilderBasic.Child, SuperBuilderBasic.Child.ChildBuilderImpl> {
- private ChildBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasic.Child.ChildBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasic.Child build() {
- return new SuperBuilderBasic.Child(this);
- }
- }
- double field3;
- protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderBasic.Child.ChildBuilder<?, ?> b) {
- super(b);
- this.field3 = b.field3;
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderBasic.Child.ChildBuilder<?, ?> builder() {
- return new SuperBuilderBasic.Child.ChildBuilderImpl();
- }
- }
- public SuperBuilderBasic() {
- super();
- }
- public static void test() {
- Child x = Child.builder().field3(0.0).field1(5).item("").build();
- }
-}
+import java.util.List; +public class SuperBuilderBasic { + public static @lombok.experimental.SuperBuilder class Parent { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<C extends SuperBuilderBasic.Parent, B extends SuperBuilderBasic.Parent.ParentBuilder<C, B>> { + private @java.lang.SuppressWarnings("all") int field1; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items; + public ParentBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field1(final int field1) { + this.field1 = field1; + return self(); + } + public @java.lang.SuppressWarnings("all") B item(final String item) { + if ((this.items == null)) + this.items = new java.util.ArrayList<String>(); + this.items.add(item); + return self(); + } + public @java.lang.SuppressWarnings("all") 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(); + } + public @java.lang.SuppressWarnings("all") B clearItems() { + if ((this.items != null)) + this.items.clear(); + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderBasic.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderBasic.Parent.ParentBuilder<SuperBuilderBasic.Parent, SuperBuilderBasic.Parent.ParentBuilderImpl> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasic.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasic.Parent build() { + return new SuperBuilderBasic.Parent(this); + } + } + int field1; + @lombok.Singular List<String> items; + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderBasic.Parent.ParentBuilder<?, ?> b) { + super(); + 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; + } + public static @java.lang.SuppressWarnings("all") SuperBuilderBasic.Parent.ParentBuilder<?, ?> builder() { + return new SuperBuilderBasic.Parent.ParentBuilderImpl(); + } + } + public static @lombok.experimental.SuperBuilder class Child extends SuperBuilderBasic.Parent { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderBasic.Child, B extends SuperBuilderBasic.Child.ChildBuilder<C, B>> extends SuperBuilderBasic.Parent.ParentBuilder<C, B> { + private @java.lang.SuppressWarnings("all") double field3; + public ChildBuilder() { + super(); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field3(final double field3) { + this.field3 = field3; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderBasic.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderBasic.Child.ChildBuilder<SuperBuilderBasic.Child, SuperBuilderBasic.Child.ChildBuilderImpl> { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasic.Child.ChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasic.Child build() { + return new SuperBuilderBasic.Child(this); + } + } + double field3; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderBasic.Child.ChildBuilder<?, ?> b) { + super(b); + this.field3 = b.field3; + } + public static @java.lang.SuppressWarnings("all") SuperBuilderBasic.Child.ChildBuilder<?, ?> builder() { + return new SuperBuilderBasic.Child.ChildBuilderImpl(); + } + } + public SuperBuilderBasic() { + super(); + } + public static void test() { + Child x = Child.builder().field3(0.0).field1(5).item("").build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderBasicToBuilder.java b/test/transform/resource/after-ecj/SuperBuilderBasicToBuilder.java index f6d298e1..67ee62f6 100644 --- a/test/transform/resource/after-ecj/SuperBuilderBasicToBuilder.java +++ b/test/transform/resource/after-ecj/SuperBuilderBasicToBuilder.java @@ -1,183 +1,183 @@ -import java.util.List;
-public class SuperBuilderBasicToBuilder {
- public static @lombok.experimental.SuperBuilder(toBuilder = true) class Parent {
- public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<C extends SuperBuilderBasicToBuilder.Parent, B extends SuperBuilderBasicToBuilder.Parent.ParentBuilder<C, B>> {
- private @java.lang.SuppressWarnings("all") int field1;
- private @java.lang.SuppressWarnings("all") int obtainViaField;
- private @java.lang.SuppressWarnings("all") int obtainViaMethod;
- private @java.lang.SuppressWarnings("all") String obtainViaStaticMethod;
- private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items;
- public ParentBuilder() {
- super();
- }
- protected @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) {
- SuperBuilderBasicToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
- return self();
- }
- private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderBasicToBuilder.Parent instance, final SuperBuilderBasicToBuilder.Parent.ParentBuilder<?, ?> b) {
- b.field1(instance.field1);
- b.obtainViaField(instance.field1);
- b.obtainViaMethod(instance.method());
- b.obtainViaStaticMethod(SuperBuilderBasicToBuilder.Parent.staticMethod(instance));
- b.items(((instance.items == null) ? java.util.Collections.emptyList() : instance.items));
- }
- protected abstract @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.SuppressWarnings("all") C build();
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B field1(final int field1) {
- this.field1 = field1;
- return self();
- }
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B obtainViaField(final int obtainViaField) {
- this.obtainViaField = obtainViaField;
- return self();
- }
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B obtainViaMethod(final int obtainViaMethod) {
- this.obtainViaMethod = obtainViaMethod;
- return self();
- }
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B obtainViaStaticMethod(final String obtainViaStaticMethod) {
- this.obtainViaStaticMethod = obtainViaStaticMethod;
- return self();
- }
- public @java.lang.SuppressWarnings("all") B item(final String item) {
- if ((this.items == null))
- this.items = new java.util.ArrayList<String>();
- this.items.add(item);
- return self();
- }
- public @java.lang.SuppressWarnings("all") 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();
- }
- public @java.lang.SuppressWarnings("all") B clearItems() {
- if ((this.items != null))
- this.items.clear();
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((((((((("SuperBuilderBasicToBuilder.Parent.ParentBuilder(field1=" + this.field1) + ", obtainViaField=") + this.obtainViaField) + ", obtainViaMethod=") + this.obtainViaMethod) + ", obtainViaStaticMethod=") + this.obtainViaStaticMethod) + ", items=") + this.items) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderBasicToBuilder.Parent.ParentBuilder<SuperBuilderBasicToBuilder.Parent, SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl> {
- private ParentBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Parent build() {
- return new SuperBuilderBasicToBuilder.Parent(this);
- }
- }
- private int field1;
- @lombok.Builder.ObtainVia(field = "field1") int obtainViaField;
- @lombok.Builder.ObtainVia(method = "method") int obtainViaMethod;
- @lombok.Builder.ObtainVia(method = "staticMethod",isStatic = true) String obtainViaStaticMethod;
- @lombok.Singular List<String> items;
- private int method() {
- return 2;
- }
- private static String staticMethod(Parent instance) {
- return "staticMethod";
- }
- protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderBasicToBuilder.Parent.ParentBuilder<?, ?> b) {
- super();
- this.field1 = b.field1;
- this.obtainViaField = b.obtainViaField;
- this.obtainViaMethod = b.obtainViaMethod;
- this.obtainViaStaticMethod = b.obtainViaStaticMethod;
- java.util.List<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;
- }
- public @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Parent.ParentBuilder<?, ?> toBuilder() {
- return new SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl().$fillValuesFrom(this);
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Parent.ParentBuilder<?, ?> builder() {
- return new SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl();
- }
- }
- public static @lombok.experimental.SuperBuilder(toBuilder = true) class Child extends Parent {
- public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderBasicToBuilder.Child, B extends SuperBuilderBasicToBuilder.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> {
- private @java.lang.SuppressWarnings("all") double field3;
- public ChildBuilder() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) {
- super.$fillValuesFrom(instance);
- SuperBuilderBasicToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
- return self();
- }
- private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderBasicToBuilder.Child instance, final SuperBuilderBasicToBuilder.Child.ChildBuilder<?, ?> b) {
- b.field3(instance.field3);
- }
- protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build();
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B field3(final double field3) {
- this.field3 = field3;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderBasicToBuilder.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderBasicToBuilder.Child.ChildBuilder<SuperBuilderBasicToBuilder.Child, SuperBuilderBasicToBuilder.Child.ChildBuilderImpl> {
- private ChildBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Child.ChildBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Child build() {
- return new SuperBuilderBasicToBuilder.Child(this);
- }
- }
- private double field3;
- protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderBasicToBuilder.Child.ChildBuilder<?, ?> b) {
- super(b);
- this.field3 = b.field3;
- }
- public @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Child.ChildBuilder<?, ?> toBuilder() {
- return new SuperBuilderBasicToBuilder.Child.ChildBuilderImpl().$fillValuesFrom(this);
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Child.ChildBuilder<?, ?> builder() {
- return new SuperBuilderBasicToBuilder.Child.ChildBuilderImpl();
- }
- }
- public SuperBuilderBasicToBuilder() {
- super();
- }
- public static void test() {
- Child x = Child.builder().field3(0.0).field1(5).item("").build().toBuilder().build();
- }
-}
+import java.util.List; +public class SuperBuilderBasicToBuilder { + public static @lombok.experimental.SuperBuilder(toBuilder = true) class Parent { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<C extends SuperBuilderBasicToBuilder.Parent, B extends SuperBuilderBasicToBuilder.Parent.ParentBuilder<C, B>> { + private @java.lang.SuppressWarnings("all") int field1; + private @java.lang.SuppressWarnings("all") int obtainViaField; + private @java.lang.SuppressWarnings("all") int obtainViaMethod; + private @java.lang.SuppressWarnings("all") String obtainViaStaticMethod; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items; + public ParentBuilder() { + super(); + } + protected @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { + SuperBuilderBasicToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderBasicToBuilder.Parent instance, final SuperBuilderBasicToBuilder.Parent.ParentBuilder<?, ?> b) { + b.field1(instance.field1); + b.obtainViaField(instance.field1); + b.obtainViaMethod(instance.method()); + b.obtainViaStaticMethod(SuperBuilderBasicToBuilder.Parent.staticMethod(instance)); + b.items(((instance.items == null) ? java.util.Collections.<String>emptyList() : instance.items)); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field1(final int field1) { + this.field1 = field1; + return self(); + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B obtainViaField(final int obtainViaField) { + this.obtainViaField = obtainViaField; + return self(); + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B obtainViaMethod(final int obtainViaMethod) { + this.obtainViaMethod = obtainViaMethod; + return self(); + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B obtainViaStaticMethod(final String obtainViaStaticMethod) { + this.obtainViaStaticMethod = obtainViaStaticMethod; + return self(); + } + public @java.lang.SuppressWarnings("all") B item(final String item) { + if ((this.items == null)) + this.items = new java.util.ArrayList<String>(); + this.items.add(item); + return self(); + } + public @java.lang.SuppressWarnings("all") 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(); + } + public @java.lang.SuppressWarnings("all") B clearItems() { + if ((this.items != null)) + this.items.clear(); + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((((((("SuperBuilderBasicToBuilder.Parent.ParentBuilder(field1=" + this.field1) + ", obtainViaField=") + this.obtainViaField) + ", obtainViaMethod=") + this.obtainViaMethod) + ", obtainViaStaticMethod=") + this.obtainViaStaticMethod) + ", items=") + this.items) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderBasicToBuilder.Parent.ParentBuilder<SuperBuilderBasicToBuilder.Parent, SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Parent build() { + return new SuperBuilderBasicToBuilder.Parent(this); + } + } + private int field1; + @lombok.Builder.ObtainVia(field = "field1") int obtainViaField; + @lombok.Builder.ObtainVia(method = "method") int obtainViaMethod; + @lombok.Builder.ObtainVia(method = "staticMethod",isStatic = true) String obtainViaStaticMethod; + @lombok.Singular List<String> items; + private int method() { + return 2; + } + private static String staticMethod(Parent instance) { + return "staticMethod"; + } + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderBasicToBuilder.Parent.ParentBuilder<?, ?> b) { + super(); + this.field1 = b.field1; + this.obtainViaField = b.obtainViaField; + this.obtainViaMethod = b.obtainViaMethod; + this.obtainViaStaticMethod = b.obtainViaStaticMethod; + java.util.List<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; + } + public @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Parent.ParentBuilder<?, ?> toBuilder() { + return new SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl().$fillValuesFrom(this); + } + public static @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Parent.ParentBuilder<?, ?> builder() { + return new SuperBuilderBasicToBuilder.Parent.ParentBuilderImpl(); + } + } + public static @lombok.experimental.SuperBuilder(toBuilder = true) class Child extends Parent { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderBasicToBuilder.Child, B extends SuperBuilderBasicToBuilder.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { + private @java.lang.SuppressWarnings("all") double field3; + public ChildBuilder() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { + super.$fillValuesFrom(instance); + SuperBuilderBasicToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderBasicToBuilder.Child instance, final SuperBuilderBasicToBuilder.Child.ChildBuilder<?, ?> b) { + b.field3(instance.field3); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field3(final double field3) { + this.field3 = field3; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderBasicToBuilder.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderBasicToBuilder.Child.ChildBuilder<SuperBuilderBasicToBuilder.Child, SuperBuilderBasicToBuilder.Child.ChildBuilderImpl> { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Child.ChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Child build() { + return new SuperBuilderBasicToBuilder.Child(this); + } + } + private double field3; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderBasicToBuilder.Child.ChildBuilder<?, ?> b) { + super(b); + this.field3 = b.field3; + } + public @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Child.ChildBuilder<?, ?> toBuilder() { + return new SuperBuilderBasicToBuilder.Child.ChildBuilderImpl().$fillValuesFrom(this); + } + public static @java.lang.SuppressWarnings("all") SuperBuilderBasicToBuilder.Child.ChildBuilder<?, ?> builder() { + return new SuperBuilderBasicToBuilder.Child.ChildBuilderImpl(); + } + } + public SuperBuilderBasicToBuilder() { + super(); + } + public static void test() { + Child x = Child.builder().field3(0.0).field1(5).item("").build().toBuilder().build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderCustomized.java b/test/transform/resource/after-ecj/SuperBuilderCustomized.java index c9619602..1fb41367 100644 --- a/test/transform/resource/after-ecj/SuperBuilderCustomized.java +++ b/test/transform/resource/after-ecj/SuperBuilderCustomized.java @@ -1,91 +1,91 @@ -import java.util.List;
-public class SuperBuilderCustomized {
- public static @lombok.experimental.SuperBuilder class Parent {
- public static abstract class ParentBuilder<C extends Parent, B extends ParentBuilder<C, B>> {
- private @java.lang.SuppressWarnings("all") int field1;
- public ParentBuilder() {
- super();
- }
- public B resetToDefault() {
- field1 = 0;
- return self();
- }
- public B field1(int field1) {
- this.field1 = (field1 + 1);
- return self();
- }
- protected abstract @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.SuppressWarnings("all") C build();
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (("SuperBuilderCustomized.Parent.ParentBuilder(field1=" + this.field1) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderCustomized.Parent.ParentBuilder<SuperBuilderCustomized.Parent, SuperBuilderCustomized.Parent.ParentBuilderImpl> {
- private ParentBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomized.Parent.ParentBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomized.Parent build() {
- return new SuperBuilderCustomized.Parent(this);
- }
- }
- int field1;
- protected Parent(ParentBuilder<?, ?> b) {
- super();
- if ((b.field1 == 0))
- throw new IllegalArgumentException("field1 must be != 0");
- this.field1 = b.field1;
- }
- public static SuperBuilderCustomized.Parent.ParentBuilder<?, ?> builder(int field1) {
- return new SuperBuilderCustomized.Parent.ParentBuilderImpl().field1(field1);
- }
- }
- public static @lombok.experimental.SuperBuilder class Child extends Parent {
- private static final class ChildBuilderImpl extends ChildBuilder<Child, ChildBuilderImpl> {
- private ChildBuilderImpl() {
- super();
- }
- public @Override Child build() {
- this.resetToDefault();
- return new Child(this);
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomized.Child.ChildBuilderImpl self() {
- return this;
- }
- }
- public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderCustomized.Child, B extends SuperBuilderCustomized.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> {
- private @java.lang.SuppressWarnings("all") double field2;
- public ChildBuilder() {
- super();
- }
- protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build();
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B field2(final double field2) {
- this.field2 = field2;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderCustomized.Child.ChildBuilder(super=" + super.toString()) + ", field2=") + this.field2) + ")");
- }
- }
- double field2;
- public static ChildBuilder<?, ?> builder() {
- return new ChildBuilderImpl().field2(10.0);
- }
- protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderCustomized.Child.ChildBuilder<?, ?> b) {
- super(b);
- this.field2 = b.field2;
- }
- }
- public SuperBuilderCustomized() {
- super();
- }
- public static void test() {
- Child x = Child.builder().field2(1.0).field1(5).resetToDefault().build();
- }
-}
+import java.util.List; +public class SuperBuilderCustomized { + public static @lombok.experimental.SuperBuilder class Parent { + public static abstract class ParentBuilder<C extends Parent, B extends ParentBuilder<C, B>> { + private @java.lang.SuppressWarnings("all") int field1; + public ParentBuilder() { + super(); + } + public B resetToDefault() { + field1 = 0; + return self(); + } + public B field1(int field1) { + this.field1 = (field1 + 1); + return self(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("SuperBuilderCustomized.Parent.ParentBuilder(field1=" + this.field1) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderCustomized.Parent.ParentBuilder<SuperBuilderCustomized.Parent, SuperBuilderCustomized.Parent.ParentBuilderImpl> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomized.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomized.Parent build() { + return new SuperBuilderCustomized.Parent(this); + } + } + int field1; + protected Parent(ParentBuilder<?, ?> b) { + super(); + if ((b.field1 == 0)) + throw new IllegalArgumentException("field1 must be != 0"); + this.field1 = b.field1; + } + public static SuperBuilderCustomized.Parent.ParentBuilder<?, ?> builder(int field1) { + return new SuperBuilderCustomized.Parent.ParentBuilderImpl().field1(field1); + } + } + public static @lombok.experimental.SuperBuilder class Child extends Parent { + private static final class ChildBuilderImpl extends ChildBuilder<Child, ChildBuilderImpl> { + private ChildBuilderImpl() { + super(); + } + public @Override Child build() { + this.resetToDefault(); + return new Child(this); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomized.Child.ChildBuilderImpl self() { + return this; + } + } + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderCustomized.Child, B extends SuperBuilderCustomized.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { + private @java.lang.SuppressWarnings("all") double field2; + public ChildBuilder() { + super(); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field2(final double field2) { + this.field2 = field2; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderCustomized.Child.ChildBuilder(super=" + super.toString()) + ", field2=") + this.field2) + ")"); + } + } + double field2; + public static ChildBuilder<?, ?> builder() { + return new ChildBuilderImpl().field2(10.0); + } + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderCustomized.Child.ChildBuilder<?, ?> b) { + super(b); + this.field2 = b.field2; + } + } + public SuperBuilderCustomized() { + super(); + } + public static void test() { + Child x = Child.builder().field2(1.0).field1(5).resetToDefault().build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderCustomizedWithSetterPrefix.java b/test/transform/resource/after-ecj/SuperBuilderCustomizedWithSetterPrefix.java index 283bacd4..142181ec 100644 --- a/test/transform/resource/after-ecj/SuperBuilderCustomizedWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/SuperBuilderCustomizedWithSetterPrefix.java @@ -1,45 +1,45 @@ -import java.util.List;
-public class SuperBuilderCustomizedWithSetterPrefix {
- public static @lombok.experimental.SuperBuilder(setterPrefix = "set") class Parent {
- public static abstract class ParentBuilder<C extends Parent, B extends ParentBuilder<C, B>> {
- private @java.lang.SuppressWarnings("all") int field1;
- public ParentBuilder() {
- super();
- }
- public B setField1(int field1) {
- this.field1 = (field1 + 1);
- return self();
- }
- protected abstract @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.SuppressWarnings("all") C build();
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (("SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder(field1=" + this.field1) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder<SuperBuilderCustomizedWithSetterPrefix.Parent, SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl> {
- private ParentBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomizedWithSetterPrefix.Parent build() {
- return new SuperBuilderCustomizedWithSetterPrefix.Parent(this);
- }
- }
- int field1;
- protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder<?, ?> b) {
- super();
- this.field1 = b.field1;
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder<?, ?> builder() {
- return new SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl();
- }
- }
- public SuperBuilderCustomizedWithSetterPrefix() {
- super();
- }
- public static void test() {
- Parent x = Parent.builder().setField1(5).build();
- }
-}
+import java.util.List; +public class SuperBuilderCustomizedWithSetterPrefix { + public static @lombok.experimental.SuperBuilder(setterPrefix = "set") class Parent { + public static abstract class ParentBuilder<C extends Parent, B extends ParentBuilder<C, B>> { + private @java.lang.SuppressWarnings("all") int field1; + public ParentBuilder() { + super(); + } + public B setField1(int field1) { + this.field1 = (field1 + 1); + return self(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder(field1=" + this.field1) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder<SuperBuilderCustomizedWithSetterPrefix.Parent, SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderCustomizedWithSetterPrefix.Parent build() { + return new SuperBuilderCustomizedWithSetterPrefix.Parent(this); + } + } + int field1; + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder<?, ?> b) { + super(); + this.field1 = b.field1; + } + public static @java.lang.SuppressWarnings("all") SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilder<?, ?> builder() { + return new SuperBuilderCustomizedWithSetterPrefix.Parent.ParentBuilderImpl(); + } + } + public SuperBuilderCustomizedWithSetterPrefix() { + super(); + } + public static void test() { + Parent x = Parent.builder().setField1(5).build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderNestedGenericTypes.java b/test/transform/resource/after-ecj/SuperBuilderNestedGenericTypes.java index e511b276..0c51d4ee 100644 --- a/test/transform/resource/after-ecj/SuperBuilderNestedGenericTypes.java +++ b/test/transform/resource/after-ecj/SuperBuilderNestedGenericTypes.java @@ -1,37 +1,37 @@ -public class SuperBuilderNestedGenericTypes {
- public static abstract @lombok.experimental.SuperBuilder class Generic<T extends Generic<?>> {
- public static abstract @java.lang.SuppressWarnings("all") class GenericBuilder<T extends Generic<?>, C extends SuperBuilderNestedGenericTypes.Generic<T>, B extends SuperBuilderNestedGenericTypes.Generic.GenericBuilder<T, C, B>> {
- public GenericBuilder() {
- super();
- }
- protected abstract @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.SuppressWarnings("all") C build();
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return "SuperBuilderNestedGenericTypes.Generic.GenericBuilder()";
- }
- }
- protected @java.lang.SuppressWarnings("all") Generic(final SuperBuilderNestedGenericTypes.Generic.GenericBuilder<T, ?, ?> b) {
- super();
- }
- }
- public static abstract @lombok.experimental.SuperBuilder class NestedGeneric<T extends OtherGeneric<?>> extends Generic<NestedGeneric<? extends OtherGeneric<?>>> {
- public static abstract @java.lang.SuppressWarnings("all") 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> {
- public NestedGenericBuilder() {
- super();
- }
- protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build();
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (("SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder(super=" + super.toString()) + ")");
- }
- }
- protected @java.lang.SuppressWarnings("all") NestedGeneric(final SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder<T, ?, ?> b) {
- super(b);
- }
- }
- public interface OtherGeneric<T> {
- }
- public SuperBuilderNestedGenericTypes() {
- super();
- }
+public class SuperBuilderNestedGenericTypes { + public static abstract @lombok.experimental.SuperBuilder class Generic<T extends Generic<?>> { + public static abstract @java.lang.SuppressWarnings("all") class GenericBuilder<T extends Generic<?>, C extends SuperBuilderNestedGenericTypes.Generic<T>, B extends SuperBuilderNestedGenericTypes.Generic.GenericBuilder<T, C, B>> { + public GenericBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return "SuperBuilderNestedGenericTypes.Generic.GenericBuilder()"; + } + } + protected @java.lang.SuppressWarnings("all") Generic(final SuperBuilderNestedGenericTypes.Generic.GenericBuilder<T, ?, ?> b) { + super(); + } + } + public static abstract @lombok.experimental.SuperBuilder class NestedGeneric<T extends OtherGeneric<?>> extends Generic<NestedGeneric<? extends OtherGeneric<?>>> { + public static abstract @java.lang.SuppressWarnings("all") 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> { + public NestedGenericBuilder() { + super(); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder(super=" + super.toString()) + ")"); + } + } + protected @java.lang.SuppressWarnings("all") NestedGeneric(final SuperBuilderNestedGenericTypes.NestedGeneric.NestedGenericBuilder<T, ?, ?> b) { + super(b); + } + } + public interface OtherGeneric<T> { + } + public SuperBuilderNestedGenericTypes() { + super(); + } }
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/SuperBuilderWithCustomBuilderMethod.java b/test/transform/resource/after-ecj/SuperBuilderWithCustomBuilderMethod.java index 5438f576..93b78c3d 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithCustomBuilderMethod.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithCustomBuilderMethod.java @@ -1,122 +1,122 @@ -import java.util.List;
-public class SuperBuilderWithCustomBuilderMethod {
- public static @lombok.experimental.SuperBuilder class Parent<A> {
- public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<A, C extends SuperBuilderWithCustomBuilderMethod.Parent<A>, B extends SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, C, B>> {
- private @java.lang.SuppressWarnings("all") A field1;
- private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items;
- public ParentBuilder() {
- super();
- }
- protected abstract @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.SuppressWarnings("all") C build();
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B field1(final A field1) {
- this.field1 = field1;
- return self();
- }
- public @java.lang.SuppressWarnings("all") B item(final String item) {
- if ((this.items == null))
- this.items = new java.util.ArrayList<String>();
- this.items.add(item);
- return self();
- }
- public @java.lang.SuppressWarnings("all") 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();
- }
- public @java.lang.SuppressWarnings("all") B clearItems() {
- if ((this.items != null))
- this.items.clear();
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl<A> extends SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, SuperBuilderWithCustomBuilderMethod.Parent<A>, SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl<A>> {
- private ParentBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl<A> self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithCustomBuilderMethod.Parent<A> build() {
- return new SuperBuilderWithCustomBuilderMethod.Parent<A>(this);
- }
- }
- A field1;
- @lombok.Singular List<String> items;
- protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, ?, ?> b) {
- super();
- 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;
- }
- public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, ?, ?> builder() {
- return new SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl<A>();
- }
- }
- public static @lombok.experimental.SuperBuilder class Child<A> extends Parent<A> {
- public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<A, C extends SuperBuilderWithCustomBuilderMethod.Child<A>, B extends SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder<A, C, B>> extends Parent.ParentBuilder<A, C, B> {
- private @java.lang.SuppressWarnings("all") double field3;
- public ChildBuilder() {
- super();
- }
- protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build();
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B field3(final double field3) {
- this.field3 = field3;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl<A> extends SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder<A, SuperBuilderWithCustomBuilderMethod.Child<A>, SuperBuilderWithCustomBuilderMethod.Child.ChildBuilderImpl<A>> {
- private ChildBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithCustomBuilderMethod.Child.ChildBuilderImpl<A> self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithCustomBuilderMethod.Child<A> build() {
- return new SuperBuilderWithCustomBuilderMethod.Child<A>(this);
- }
- }
- double field3;
- public static <A>ChildBuilder<A, ?, ?> builder() {
- return new ChildBuilderImpl<A>().item("default item");
- }
- protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder<A, ?, ?> b) {
- super(b);
- this.field3 = b.field3;
- }
- }
- public SuperBuilderWithCustomBuilderMethod() {
- super();
- }
- 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 @lombok.experimental.SuperBuilder class Parent<A> { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<A, C extends SuperBuilderWithCustomBuilderMethod.Parent<A>, B extends SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, C, B>> { + private @java.lang.SuppressWarnings("all") A field1; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items; + public ParentBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field1(final A field1) { + this.field1 = field1; + return self(); + } + public @java.lang.SuppressWarnings("all") B item(final String item) { + if ((this.items == null)) + this.items = new java.util.ArrayList<String>(); + this.items.add(item); + return self(); + } + public @java.lang.SuppressWarnings("all") 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(); + } + public @java.lang.SuppressWarnings("all") B clearItems() { + if ((this.items != null)) + this.items.clear(); + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl<A> extends SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, SuperBuilderWithCustomBuilderMethod.Parent<A>, SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl<A>> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl<A> self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithCustomBuilderMethod.Parent<A> build() { + return new SuperBuilderWithCustomBuilderMethod.Parent<A>(this); + } + } + A field1; + @lombok.Singular List<String> items; + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, ?, ?> b) { + super(); + 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; + } + public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilder<A, ?, ?> builder() { + return new SuperBuilderWithCustomBuilderMethod.Parent.ParentBuilderImpl<A>(); + } + } + public static @lombok.experimental.SuperBuilder class Child<A> extends Parent<A> { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<A, C extends SuperBuilderWithCustomBuilderMethod.Child<A>, B extends SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder<A, C, B>> extends Parent.ParentBuilder<A, C, B> { + private @java.lang.SuppressWarnings("all") double field3; + public ChildBuilder() { + super(); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field3(final double field3) { + this.field3 = field3; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl<A> extends SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder<A, SuperBuilderWithCustomBuilderMethod.Child<A>, SuperBuilderWithCustomBuilderMethod.Child.ChildBuilderImpl<A>> { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithCustomBuilderMethod.Child.ChildBuilderImpl<A> self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithCustomBuilderMethod.Child<A> build() { + return new SuperBuilderWithCustomBuilderMethod.Child<A>(this); + } + } + double field3; + public static <A>ChildBuilder<A, ?, ?> builder() { + return new ChildBuilderImpl<A>().item("default item"); + } + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder<A, ?, ?> b) { + super(b); + this.field3 = b.field3; + } + } + public SuperBuilderWithCustomBuilderMethod() { + super(); + } + public static void test() { + Child<Integer> x = Child.<Integer>builder().field3(0.0).field1(5).item("").build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderWithDefaults.java b/test/transform/resource/after-ecj/SuperBuilderWithDefaults.java index 72079b2f..7c5a344a 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithDefaults.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithDefaults.java @@ -1,121 +1,121 @@ -import java.util.List;
-public class SuperBuilderWithDefaults {
- public static @lombok.experimental.SuperBuilder class Parent<N extends Number> {
- public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<N extends Number, C extends SuperBuilderWithDefaults.Parent<N>, B extends SuperBuilderWithDefaults.Parent.ParentBuilder<N, C, B>> {
- private @java.lang.SuppressWarnings("all") long millis$value;
- private @java.lang.SuppressWarnings("all") boolean millis$set;
- private @java.lang.SuppressWarnings("all") N numberField$value;
- private @java.lang.SuppressWarnings("all") boolean numberField$set;
- public ParentBuilder() {
- super();
- }
- protected abstract @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.SuppressWarnings("all") C build();
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B millis(final long millis) {
- this.millis$value = millis;
- millis$set = true;
- return self();
- }
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B numberField(final N numberField) {
- this.numberField$value = numberField;
- numberField$set = true;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderWithDefaults.Parent.ParentBuilder(millis$value=" + this.millis$value) + ", numberField$value=") + this.numberField$value) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl<N extends Number> extends SuperBuilderWithDefaults.Parent.ParentBuilder<N, SuperBuilderWithDefaults.Parent<N>, SuperBuilderWithDefaults.Parent.ParentBuilderImpl<N>> {
- private ParentBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Parent.ParentBuilderImpl<N> self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Parent<N> build() {
- return new SuperBuilderWithDefaults.Parent<N>(this);
- }
- }
- private @lombok.Builder.Default long millis;
- private @lombok.Builder.Default N numberField;
- private static @java.lang.SuppressWarnings("all") <N extends Number>long $default$millis() {
- return System.currentTimeMillis();
- }
- private static @java.lang.SuppressWarnings("all") <N extends Number>N $default$numberField() {
- return null;
- }
- protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithDefaults.Parent.ParentBuilder<N, ?, ?> b) {
- super();
- 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();
- }
- public static @java.lang.SuppressWarnings("all") <N extends Number>SuperBuilderWithDefaults.Parent.ParentBuilder<N, ?, ?> builder() {
- return new SuperBuilderWithDefaults.Parent.ParentBuilderImpl<N>();
- }
- }
- public static @lombok.experimental.SuperBuilder class Child extends Parent<Integer> {
- public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderWithDefaults.Child, B extends SuperBuilderWithDefaults.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<Integer, C, B> {
- private @java.lang.SuppressWarnings("all") double doubleField$value;
- private @java.lang.SuppressWarnings("all") boolean doubleField$set;
- public ChildBuilder() {
- super();
- }
- protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build();
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B doubleField(final double doubleField) {
- this.doubleField$value = doubleField;
- doubleField$set = true;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderWithDefaults.Child.ChildBuilder(super=" + super.toString()) + ", doubleField$value=") + this.doubleField$value) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderWithDefaults.Child.ChildBuilder<SuperBuilderWithDefaults.Child, SuperBuilderWithDefaults.Child.ChildBuilderImpl> {
- private ChildBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Child.ChildBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Child build() {
- return new SuperBuilderWithDefaults.Child(this);
- }
- }
- private @lombok.Builder.Default double doubleField;
- private static @java.lang.SuppressWarnings("all") double $default$doubleField() {
- return Math.PI;
- }
- protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithDefaults.Child.ChildBuilder<?, ?> b) {
- super(b);
- if (b.doubleField$set)
- this.doubleField = b.doubleField$value;
- else
- this.doubleField = SuperBuilderWithDefaults.Child.$default$doubleField();
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Child.ChildBuilder<?, ?> builder() {
- return new SuperBuilderWithDefaults.Child.ChildBuilderImpl();
- }
- }
- public SuperBuilderWithDefaults() {
- super();
- }
- public static void test() {
- Child x = Child.builder().doubleField(0.1).numberField(5).millis(1234567890L).build();
- }
-}
+import java.util.List; +public class SuperBuilderWithDefaults { + public static @lombok.experimental.SuperBuilder class Parent<N extends Number> { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<N extends Number, C extends SuperBuilderWithDefaults.Parent<N>, B extends SuperBuilderWithDefaults.Parent.ParentBuilder<N, C, B>> { + private @java.lang.SuppressWarnings("all") long millis$value; + private @java.lang.SuppressWarnings("all") boolean millis$set; + private @java.lang.SuppressWarnings("all") N numberField$value; + private @java.lang.SuppressWarnings("all") boolean numberField$set; + public ParentBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B millis(final long millis) { + this.millis$value = millis; + millis$set = true; + return self(); + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B numberField(final N numberField) { + this.numberField$value = numberField; + numberField$set = true; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithDefaults.Parent.ParentBuilder(millis$value=" + this.millis$value) + ", numberField$value=") + this.numberField$value) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl<N extends Number> extends SuperBuilderWithDefaults.Parent.ParentBuilder<N, SuperBuilderWithDefaults.Parent<N>, SuperBuilderWithDefaults.Parent.ParentBuilderImpl<N>> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Parent.ParentBuilderImpl<N> self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Parent<N> build() { + return new SuperBuilderWithDefaults.Parent<N>(this); + } + } + private @lombok.Builder.Default long millis; + private @lombok.Builder.Default N numberField; + private static @java.lang.SuppressWarnings("all") <N extends Number>long $default$millis() { + return System.currentTimeMillis(); + } + private static @java.lang.SuppressWarnings("all") <N extends Number>N $default$numberField() { + return null; + } + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithDefaults.Parent.ParentBuilder<N, ?, ?> b) { + super(); + 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(); + } + public static @java.lang.SuppressWarnings("all") <N extends Number>SuperBuilderWithDefaults.Parent.ParentBuilder<N, ?, ?> builder() { + return new SuperBuilderWithDefaults.Parent.ParentBuilderImpl<N>(); + } + } + public static @lombok.experimental.SuperBuilder class Child extends Parent<Integer> { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderWithDefaults.Child, B extends SuperBuilderWithDefaults.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<Integer, C, B> { + private @java.lang.SuppressWarnings("all") double doubleField$value; + private @java.lang.SuppressWarnings("all") boolean doubleField$set; + public ChildBuilder() { + super(); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B doubleField(final double doubleField) { + this.doubleField$value = doubleField; + doubleField$set = true; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithDefaults.Child.ChildBuilder(super=" + super.toString()) + ", doubleField$value=") + this.doubleField$value) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderWithDefaults.Child.ChildBuilder<SuperBuilderWithDefaults.Child, SuperBuilderWithDefaults.Child.ChildBuilderImpl> { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Child.ChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Child build() { + return new SuperBuilderWithDefaults.Child(this); + } + } + private @lombok.Builder.Default double doubleField; + private static @java.lang.SuppressWarnings("all") double $default$doubleField() { + return Math.PI; + } + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithDefaults.Child.ChildBuilder<?, ?> b) { + super(b); + if (b.doubleField$set) + this.doubleField = b.doubleField$value; + else + this.doubleField = SuperBuilderWithDefaults.Child.$default$doubleField(); + } + public static @java.lang.SuppressWarnings("all") SuperBuilderWithDefaults.Child.ChildBuilder<?, ?> builder() { + return new SuperBuilderWithDefaults.Child.ChildBuilderImpl(); + } + } + public SuperBuilderWithDefaults() { + super(); + } + public static void test() { + Child x = Child.builder().doubleField(0.1).numberField(5).millis(1234567890L).build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderWithGenerics.java b/test/transform/resource/after-ecj/SuperBuilderWithGenerics.java index bc9db55f..db989687 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithGenerics.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithGenerics.java @@ -1,122 +1,122 @@ -import java.util.List;
-public class SuperBuilderWithGenerics {
- public static @lombok.experimental.SuperBuilder class Parent<A> {
- public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<A, C extends SuperBuilderWithGenerics.Parent<A>, B extends SuperBuilderWithGenerics.Parent.ParentBuilder<A, C, B>> {
- private @java.lang.SuppressWarnings("all") A field1;
- private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items;
- public ParentBuilder() {
- super();
- }
- protected abstract @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.SuppressWarnings("all") C build();
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B field1(final A field1) {
- this.field1 = field1;
- return self();
- }
- public @java.lang.SuppressWarnings("all") B item(final String item) {
- if ((this.items == null))
- this.items = new java.util.ArrayList<String>();
- this.items.add(item);
- return self();
- }
- public @java.lang.SuppressWarnings("all") 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();
- }
- public @java.lang.SuppressWarnings("all") B clearItems() {
- if ((this.items != null))
- this.items.clear();
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderWithGenerics.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl<A> extends SuperBuilderWithGenerics.Parent.ParentBuilder<A, SuperBuilderWithGenerics.Parent<A>, SuperBuilderWithGenerics.Parent.ParentBuilderImpl<A>> {
- private ParentBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Parent.ParentBuilderImpl<A> self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Parent<A> build() {
- return new SuperBuilderWithGenerics.Parent<A>(this);
- }
- }
- A field1;
- @lombok.Singular List<String> items;
- protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithGenerics.Parent.ParentBuilder<A, ?, ?> b) {
- super();
- 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;
- }
- public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithGenerics.Parent.ParentBuilder<A, ?, ?> builder() {
- return new SuperBuilderWithGenerics.Parent.ParentBuilderImpl<A>();
- }
- }
- public static @lombok.experimental.SuperBuilder class Child<A> extends Parent<A> {
- public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<A, C extends SuperBuilderWithGenerics.Child<A>, B extends SuperBuilderWithGenerics.Child.ChildBuilder<A, C, B>> extends Parent.ParentBuilder<A, C, B> {
- private @java.lang.SuppressWarnings("all") double field3;
- public ChildBuilder() {
- super();
- }
- protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build();
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B field3(final double field3) {
- this.field3 = field3;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderWithGenerics.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl<A> extends SuperBuilderWithGenerics.Child.ChildBuilder<A, SuperBuilderWithGenerics.Child<A>, SuperBuilderWithGenerics.Child.ChildBuilderImpl<A>> {
- private ChildBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Child.ChildBuilderImpl<A> self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Child<A> build() {
- return new SuperBuilderWithGenerics.Child<A>(this);
- }
- }
- double field3;
- protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithGenerics.Child.ChildBuilder<A, ?, ?> b) {
- super(b);
- this.field3 = b.field3;
- }
- public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithGenerics.Child.ChildBuilder<A, ?, ?> builder() {
- return new SuperBuilderWithGenerics.Child.ChildBuilderImpl<A>();
- }
- }
- public SuperBuilderWithGenerics() {
- super();
- }
- 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 @lombok.experimental.SuperBuilder class Parent<A> { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<A, C extends SuperBuilderWithGenerics.Parent<A>, B extends SuperBuilderWithGenerics.Parent.ParentBuilder<A, C, B>> { + private @java.lang.SuppressWarnings("all") A field1; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items; + public ParentBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field1(final A field1) { + this.field1 = field1; + return self(); + } + public @java.lang.SuppressWarnings("all") B item(final String item) { + if ((this.items == null)) + this.items = new java.util.ArrayList<String>(); + this.items.add(item); + return self(); + } + public @java.lang.SuppressWarnings("all") 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(); + } + public @java.lang.SuppressWarnings("all") B clearItems() { + if ((this.items != null)) + this.items.clear(); + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithGenerics.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl<A> extends SuperBuilderWithGenerics.Parent.ParentBuilder<A, SuperBuilderWithGenerics.Parent<A>, SuperBuilderWithGenerics.Parent.ParentBuilderImpl<A>> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Parent.ParentBuilderImpl<A> self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Parent<A> build() { + return new SuperBuilderWithGenerics.Parent<A>(this); + } + } + A field1; + @lombok.Singular List<String> items; + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithGenerics.Parent.ParentBuilder<A, ?, ?> b) { + super(); + 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; + } + public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithGenerics.Parent.ParentBuilder<A, ?, ?> builder() { + return new SuperBuilderWithGenerics.Parent.ParentBuilderImpl<A>(); + } + } + public static @lombok.experimental.SuperBuilder class Child<A> extends Parent<A> { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<A, C extends SuperBuilderWithGenerics.Child<A>, B extends SuperBuilderWithGenerics.Child.ChildBuilder<A, C, B>> extends Parent.ParentBuilder<A, C, B> { + private @java.lang.SuppressWarnings("all") double field3; + public ChildBuilder() { + super(); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field3(final double field3) { + this.field3 = field3; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithGenerics.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl<A> extends SuperBuilderWithGenerics.Child.ChildBuilder<A, SuperBuilderWithGenerics.Child<A>, SuperBuilderWithGenerics.Child.ChildBuilderImpl<A>> { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Child.ChildBuilderImpl<A> self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics.Child<A> build() { + return new SuperBuilderWithGenerics.Child<A>(this); + } + } + double field3; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithGenerics.Child.ChildBuilder<A, ?, ?> b) { + super(b); + this.field3 = b.field3; + } + public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithGenerics.Child.ChildBuilder<A, ?, ?> builder() { + return new SuperBuilderWithGenerics.Child.ChildBuilderImpl<A>(); + } + } + public SuperBuilderWithGenerics() { + super(); + } + public static void test() { + Child<Integer> x = Child.<Integer>builder().field3(0.0).field1(5).item("").build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderWithGenerics2.java b/test/transform/resource/after-ecj/SuperBuilderWithGenerics2.java index 07d10798..96e681f4 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithGenerics2.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithGenerics2.java @@ -1,122 +1,122 @@ -import java.util.List;
-public class SuperBuilderWithGenerics2 {
- public static @lombok.experimental.SuperBuilder class Parent<A> {
- public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<A, C extends SuperBuilderWithGenerics2.Parent<A>, B extends SuperBuilderWithGenerics2.Parent.ParentBuilder<A, C, B>> {
- private @java.lang.SuppressWarnings("all") A field1;
- private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items;
- public ParentBuilder() {
- super();
- }
- protected abstract @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.SuppressWarnings("all") C build();
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B field1(final A field1) {
- this.field1 = field1;
- return self();
- }
- public @java.lang.SuppressWarnings("all") B item(final String item) {
- if ((this.items == null))
- this.items = new java.util.ArrayList<String>();
- this.items.add(item);
- return self();
- }
- public @java.lang.SuppressWarnings("all") 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();
- }
- public @java.lang.SuppressWarnings("all") B clearItems() {
- if ((this.items != null))
- this.items.clear();
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderWithGenerics2.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl<A> extends SuperBuilderWithGenerics2.Parent.ParentBuilder<A, SuperBuilderWithGenerics2.Parent<A>, SuperBuilderWithGenerics2.Parent.ParentBuilderImpl<A>> {
- private ParentBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Parent.ParentBuilderImpl<A> self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Parent<A> build() {
- return new SuperBuilderWithGenerics2.Parent<A>(this);
- }
- }
- A field1;
- @lombok.Singular List<String> items;
- protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithGenerics2.Parent.ParentBuilder<A, ?, ?> b) {
- super();
- 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;
- }
- public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithGenerics2.Parent.ParentBuilder<A, ?, ?> builder() {
- return new SuperBuilderWithGenerics2.Parent.ParentBuilderImpl<A>();
- }
- }
- public static @lombok.experimental.SuperBuilder(builderMethodName = "builder2") class Child<A> extends Parent<String> {
- public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<A, C extends SuperBuilderWithGenerics2.Child<A>, B extends SuperBuilderWithGenerics2.Child.ChildBuilder<A, C, B>> extends Parent.ParentBuilder<String, C, B> {
- private @java.lang.SuppressWarnings("all") A field3;
- public ChildBuilder() {
- super();
- }
- protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build();
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B field3(final A field3) {
- this.field3 = field3;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderWithGenerics2.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl<A> extends SuperBuilderWithGenerics2.Child.ChildBuilder<A, SuperBuilderWithGenerics2.Child<A>, SuperBuilderWithGenerics2.Child.ChildBuilderImpl<A>> {
- private ChildBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Child.ChildBuilderImpl<A> self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Child<A> build() {
- return new SuperBuilderWithGenerics2.Child<A>(this);
- }
- }
- A field3;
- protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithGenerics2.Child.ChildBuilder<A, ?, ?> b) {
- super(b);
- this.field3 = b.field3;
- }
- public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithGenerics2.Child.ChildBuilder<A, ?, ?> builder2() {
- return new SuperBuilderWithGenerics2.Child.ChildBuilderImpl<A>();
- }
- }
- public SuperBuilderWithGenerics2() {
- super();
- }
- 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 @lombok.experimental.SuperBuilder class Parent<A> { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<A, C extends SuperBuilderWithGenerics2.Parent<A>, B extends SuperBuilderWithGenerics2.Parent.ParentBuilder<A, C, B>> { + private @java.lang.SuppressWarnings("all") A field1; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items; + public ParentBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field1(final A field1) { + this.field1 = field1; + return self(); + } + public @java.lang.SuppressWarnings("all") B item(final String item) { + if ((this.items == null)) + this.items = new java.util.ArrayList<String>(); + this.items.add(item); + return self(); + } + public @java.lang.SuppressWarnings("all") 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(); + } + public @java.lang.SuppressWarnings("all") B clearItems() { + if ((this.items != null)) + this.items.clear(); + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithGenerics2.Parent.ParentBuilder(field1=" + this.field1) + ", items=") + this.items) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl<A> extends SuperBuilderWithGenerics2.Parent.ParentBuilder<A, SuperBuilderWithGenerics2.Parent<A>, SuperBuilderWithGenerics2.Parent.ParentBuilderImpl<A>> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Parent.ParentBuilderImpl<A> self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Parent<A> build() { + return new SuperBuilderWithGenerics2.Parent<A>(this); + } + } + A field1; + @lombok.Singular List<String> items; + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithGenerics2.Parent.ParentBuilder<A, ?, ?> b) { + super(); + 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; + } + public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithGenerics2.Parent.ParentBuilder<A, ?, ?> builder() { + return new SuperBuilderWithGenerics2.Parent.ParentBuilderImpl<A>(); + } + } + public static @lombok.experimental.SuperBuilder(builderMethodName = "builder2") class Child<A> extends Parent<String> { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<A, C extends SuperBuilderWithGenerics2.Child<A>, B extends SuperBuilderWithGenerics2.Child.ChildBuilder<A, C, B>> extends Parent.ParentBuilder<String, C, B> { + private @java.lang.SuppressWarnings("all") A field3; + public ChildBuilder() { + super(); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field3(final A field3) { + this.field3 = field3; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithGenerics2.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl<A> extends SuperBuilderWithGenerics2.Child.ChildBuilder<A, SuperBuilderWithGenerics2.Child<A>, SuperBuilderWithGenerics2.Child.ChildBuilderImpl<A>> { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Child.ChildBuilderImpl<A> self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenerics2.Child<A> build() { + return new SuperBuilderWithGenerics2.Child<A>(this); + } + } + A field3; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithGenerics2.Child.ChildBuilder<A, ?, ?> b) { + super(b); + this.field3 = b.field3; + } + public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithGenerics2.Child.ChildBuilder<A, ?, ?> builder2() { + return new SuperBuilderWithGenerics2.Child.ChildBuilderImpl<A>(); + } + } + public SuperBuilderWithGenerics2() { + super(); + } + public static void test() { + Child<Integer> x = Child.<Integer>builder2().field3(1).field1("value").item("").build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderWithGenericsAndToBuilder.java b/test/transform/resource/after-ecj/SuperBuilderWithGenericsAndToBuilder.java index c1eb42fd..829b50b9 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithGenericsAndToBuilder.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithGenericsAndToBuilder.java @@ -1,162 +1,162 @@ -import java.util.Map;
-public class SuperBuilderWithGenericsAndToBuilder {
- public static @lombok.experimental.SuperBuilder(toBuilder = true) class Parent<A> {
- public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<A, C extends SuperBuilderWithGenericsAndToBuilder.Parent<A>, B extends SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, C, B>> {
- private @java.lang.SuppressWarnings("all") A field1;
- private @java.lang.SuppressWarnings("all") java.util.ArrayList<Integer> items$key;
- private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items$value;
- public ParentBuilder() {
- super();
- }
- protected @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) {
- SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
- return self();
- }
- private static @java.lang.SuppressWarnings("all") <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));
- }
- protected abstract @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.SuppressWarnings("all") C build();
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B field1(final A field1) {
- this.field1 = field1;
- return self();
- }
- public @java.lang.SuppressWarnings("all") B item(final Integer itemKey, final String itemValue) {
- if ((this.items$key == null))
- {
- this.items$key = new java.util.ArrayList<Integer>();
- this.items$value = new java.util.ArrayList<String>();
- }
- this.items$key.add(itemKey);
- this.items$value.add(itemValue);
- return self();
- }
- public @java.lang.SuppressWarnings("all") 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 (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();
- }
- public @java.lang.SuppressWarnings("all") B clearItems() {
- if ((this.items$key != null))
- {
- this.items$key.clear();
- this.items$value.clear();
- }
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((((("SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder(field1=" + this.field1) + ", items$key=") + this.items$key) + ", items$value=") + this.items$value) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl<A> extends SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, SuperBuilderWithGenericsAndToBuilder.Parent<A>, SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A>> {
- private ParentBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A> self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Parent<A> build() {
- return new SuperBuilderWithGenericsAndToBuilder.Parent<A>(this);
- }
- }
- A field1;
- @lombok.Singular Map<Integer, String> items;
- protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> b) {
- super();
- 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() < 0x40000000) ? ((1 + b.items$key.size()) + ((b.items$key.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE));
- for (int $i = 0;; ($i < b.items$key.size()); $i ++)
- items.put(b.items$key.get($i), b.items$value.get($i));
- items = java.util.Collections.unmodifiableMap(items);
- }
- this.items = items;
- }
- public @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> toBuilder() {
- return new SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A>().$fillValuesFrom(this);
- }
- public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> builder() {
- return new SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A>();
- }
- }
- public static @lombok.experimental.SuperBuilder(toBuilder = true) class Child<A> extends Parent<A> {
- public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<A, C extends SuperBuilderWithGenericsAndToBuilder.Child<A>, B extends SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, C, B>> extends Parent.ParentBuilder<A, C, B> {
- private @java.lang.SuppressWarnings("all") double field3;
- public ChildBuilder() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) {
- super.$fillValuesFrom(instance);
- SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
- return self();
- }
- private static @java.lang.SuppressWarnings("all") <A>void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithGenericsAndToBuilder.Child<A> instance, final SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> b) {
- b.field3(instance.field3);
- }
- protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build();
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B field3(final double field3) {
- this.field3 = field3;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl<A> extends SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, SuperBuilderWithGenericsAndToBuilder.Child<A>, SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A>> {
- private ChildBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A> self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Child<A> build() {
- return new SuperBuilderWithGenericsAndToBuilder.Child<A>(this);
- }
- }
- double field3;
- protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> b) {
- super(b);
- this.field3 = b.field3;
- }
- public @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> toBuilder() {
- return new SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A>().$fillValuesFrom(this);
- }
- public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> builder() {
- return new SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A>();
- }
- }
- public SuperBuilderWithGenericsAndToBuilder() {
- super();
- }
- 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 @lombok.experimental.SuperBuilder(toBuilder = true) class Parent<A> { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<A, C extends SuperBuilderWithGenericsAndToBuilder.Parent<A>, B extends SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, C, B>> { + private @java.lang.SuppressWarnings("all") A field1; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<Integer> items$key; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items$value; + public ParentBuilder() { + super(); + } + protected @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { + SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + private static @java.lang.SuppressWarnings("all") <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.<Integer, String>emptyMap() : instance.items)); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field1(final A field1) { + this.field1 = field1; + return self(); + } + public @java.lang.SuppressWarnings("all") B item(final Integer itemKey, final String itemValue) { + if ((this.items$key == null)) + { + this.items$key = new java.util.ArrayList<Integer>(); + this.items$value = new java.util.ArrayList<String>(); + } + this.items$key.add(itemKey); + this.items$value.add(itemValue); + return self(); + } + public @java.lang.SuppressWarnings("all") 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 (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(); + } + public @java.lang.SuppressWarnings("all") B clearItems() { + if ((this.items$key != null)) + { + this.items$key.clear(); + this.items$value.clear(); + } + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder(field1=" + this.field1) + ", items$key=") + this.items$key) + ", items$value=") + this.items$value) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl<A> extends SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, SuperBuilderWithGenericsAndToBuilder.Parent<A>, SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A>> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A> self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Parent<A> build() { + return new SuperBuilderWithGenericsAndToBuilder.Parent<A>(this); + } + } + A field1; + @lombok.Singular Map<Integer, String> items; + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> b) { + super(); + 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() < 0x40000000) ? ((1 + b.items$key.size()) + ((b.items$key.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE)); + for (int $i = 0;; ($i < b.items$key.size()); $i ++) + items.put(b.items$key.get($i), b.items$value.get($i)); + items = java.util.Collections.unmodifiableMap(items); + } + this.items = items; + } + public @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> toBuilder() { + return new SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A>().$fillValuesFrom(this); + } + public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilder<A, ?, ?> builder() { + return new SuperBuilderWithGenericsAndToBuilder.Parent.ParentBuilderImpl<A>(); + } + } + public static @lombok.experimental.SuperBuilder(toBuilder = true) class Child<A> extends Parent<A> { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<A, C extends SuperBuilderWithGenericsAndToBuilder.Child<A>, B extends SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, C, B>> extends Parent.ParentBuilder<A, C, B> { + private @java.lang.SuppressWarnings("all") double field3; + public ChildBuilder() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { + super.$fillValuesFrom(instance); + SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + private static @java.lang.SuppressWarnings("all") <A>void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithGenericsAndToBuilder.Child<A> instance, final SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> b) { + b.field3(instance.field3); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B field3(final double field3) { + this.field3 = field3; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl<A> extends SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, SuperBuilderWithGenericsAndToBuilder.Child<A>, SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A>> { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A> self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Child<A> build() { + return new SuperBuilderWithGenericsAndToBuilder.Child<A>(this); + } + } + double field3; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> b) { + super(b); + this.field3 = b.field3; + } + public @java.lang.SuppressWarnings("all") SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> toBuilder() { + return new SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A>().$fillValuesFrom(this); + } + public static @java.lang.SuppressWarnings("all") <A>SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder<A, ?, ?> builder() { + return new SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilderImpl<A>(); + } + } + public SuperBuilderWithGenericsAndToBuilder() { + super(); + } + 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-ecj/SuperBuilderWithNonNull.java b/test/transform/resource/after-ecj/SuperBuilderWithNonNull.java index b9c96a38..28504f29 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithNonNull.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithNonNull.java @@ -1,111 +1,111 @@ -import java.util.List;
-public class SuperBuilderWithNonNull {
- public static @lombok.experimental.SuperBuilder class Parent {
- public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<C extends SuperBuilderWithNonNull.Parent, B extends SuperBuilderWithNonNull.Parent.ParentBuilder<C, B>> {
- private @java.lang.SuppressWarnings("all") String nonNullParentField$value;
- private @java.lang.SuppressWarnings("all") boolean nonNullParentField$set;
- public ParentBuilder() {
- super();
- }
- protected abstract @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.SuppressWarnings("all") C build();
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B nonNullParentField(final @lombok.NonNull String nonNullParentField) {
- if ((nonNullParentField == null))
- {
- throw new java.lang.NullPointerException("nonNullParentField is marked non-null but is null");
- }
- this.nonNullParentField$value = nonNullParentField;
- nonNullParentField$set = true;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (("SuperBuilderWithNonNull.Parent.ParentBuilder(nonNullParentField$value=" + this.nonNullParentField$value) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderWithNonNull.Parent.ParentBuilder<SuperBuilderWithNonNull.Parent, SuperBuilderWithNonNull.Parent.ParentBuilderImpl> {
- private ParentBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Parent.ParentBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Parent build() {
- return new SuperBuilderWithNonNull.Parent(this);
- }
- }
- final @lombok.NonNull @lombok.Builder.Default String nonNullParentField;
- private static @java.lang.SuppressWarnings("all") String $default$nonNullParentField() {
- return "default";
- }
- protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithNonNull.Parent.ParentBuilder<?, ?> b) {
- super();
- if (b.nonNullParentField$set)
- this.nonNullParentField = b.nonNullParentField$value;
- else
- this.nonNullParentField = SuperBuilderWithNonNull.Parent.$default$nonNullParentField();
- if ((nonNullParentField == null))
- {
- throw new java.lang.NullPointerException("nonNullParentField is marked non-null but is null");
- }
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Parent.ParentBuilder<?, ?> builder() {
- return new SuperBuilderWithNonNull.Parent.ParentBuilderImpl();
- }
- }
- public static @lombok.experimental.SuperBuilder class Child extends Parent {
- public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderWithNonNull.Child, B extends SuperBuilderWithNonNull.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> {
- private @java.lang.SuppressWarnings("all") String nonNullChildField;
- public ChildBuilder() {
- super();
- }
- protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build();
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B nonNullChildField(final @lombok.NonNull String nonNullChildField) {
- if ((nonNullChildField == null))
- {
- throw new java.lang.NullPointerException("nonNullChildField is marked non-null but is null");
- }
- this.nonNullChildField = nonNullChildField;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderWithNonNull.Child.ChildBuilder(super=" + super.toString()) + ", nonNullChildField=") + this.nonNullChildField) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderWithNonNull.Child.ChildBuilder<SuperBuilderWithNonNull.Child, SuperBuilderWithNonNull.Child.ChildBuilderImpl> {
- private ChildBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Child.ChildBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Child build() {
- return new SuperBuilderWithNonNull.Child(this);
- }
- }
- @lombok.NonNull String nonNullChildField;
- protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithNonNull.Child.ChildBuilder<?, ?> b) {
- super(b);
- this.nonNullChildField = b.nonNullChildField;
- if ((nonNullChildField == null))
- {
- throw new java.lang.NullPointerException("nonNullChildField is marked non-null but is null");
- }
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Child.ChildBuilder<?, ?> builder() {
- return new SuperBuilderWithNonNull.Child.ChildBuilderImpl();
- }
- }
- public SuperBuilderWithNonNull() {
- super();
- }
- public static void test() {
- Child x = Child.builder().nonNullChildField("child").nonNullParentField("parent").build();
- }
-}
+import java.util.List; +public class SuperBuilderWithNonNull { + public static @lombok.experimental.SuperBuilder class Parent { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<C extends SuperBuilderWithNonNull.Parent, B extends SuperBuilderWithNonNull.Parent.ParentBuilder<C, B>> { + private @java.lang.SuppressWarnings("all") String nonNullParentField$value; + private @java.lang.SuppressWarnings("all") boolean nonNullParentField$set; + public ParentBuilder() { + super(); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B nonNullParentField(final @lombok.NonNull String nonNullParentField) { + if ((nonNullParentField == null)) + { + throw new java.lang.NullPointerException("nonNullParentField is marked non-null but is null"); + } + this.nonNullParentField$value = nonNullParentField; + nonNullParentField$set = true; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("SuperBuilderWithNonNull.Parent.ParentBuilder(nonNullParentField$value=" + this.nonNullParentField$value) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderWithNonNull.Parent.ParentBuilder<SuperBuilderWithNonNull.Parent, SuperBuilderWithNonNull.Parent.ParentBuilderImpl> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Parent build() { + return new SuperBuilderWithNonNull.Parent(this); + } + } + final @lombok.NonNull @lombok.Builder.Default String nonNullParentField; + private static @java.lang.SuppressWarnings("all") String $default$nonNullParentField() { + return "default"; + } + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithNonNull.Parent.ParentBuilder<?, ?> b) { + super(); + if (b.nonNullParentField$set) + this.nonNullParentField = b.nonNullParentField$value; + else + this.nonNullParentField = SuperBuilderWithNonNull.Parent.$default$nonNullParentField(); + if ((nonNullParentField == null)) + { + throw new java.lang.NullPointerException("nonNullParentField is marked non-null but is null"); + } + } + public static @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Parent.ParentBuilder<?, ?> builder() { + return new SuperBuilderWithNonNull.Parent.ParentBuilderImpl(); + } + } + public static @lombok.experimental.SuperBuilder class Child extends Parent { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderWithNonNull.Child, B extends SuperBuilderWithNonNull.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { + private @java.lang.SuppressWarnings("all") String nonNullChildField; + public ChildBuilder() { + super(); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B nonNullChildField(final @lombok.NonNull String nonNullChildField) { + if ((nonNullChildField == null)) + { + throw new java.lang.NullPointerException("nonNullChildField is marked non-null but is null"); + } + this.nonNullChildField = nonNullChildField; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithNonNull.Child.ChildBuilder(super=" + super.toString()) + ", nonNullChildField=") + this.nonNullChildField) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderWithNonNull.Child.ChildBuilder<SuperBuilderWithNonNull.Child, SuperBuilderWithNonNull.Child.ChildBuilderImpl> { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Child.ChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Child build() { + return new SuperBuilderWithNonNull.Child(this); + } + } + @lombok.NonNull String nonNullChildField; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithNonNull.Child.ChildBuilder<?, ?> b) { + super(b); + this.nonNullChildField = b.nonNullChildField; + if ((nonNullChildField == null)) + { + throw new java.lang.NullPointerException("nonNullChildField is marked non-null but is null"); + } + } + public static @java.lang.SuppressWarnings("all") SuperBuilderWithNonNull.Child.ChildBuilder<?, ?> builder() { + return new SuperBuilderWithNonNull.Child.ChildBuilderImpl(); + } + } + public SuperBuilderWithNonNull() { + super(); + } + public static void test() { + Child x = Child.builder().nonNullChildField("child").nonNullParentField("parent").build(); + } +} diff --git a/test/transform/resource/after-ecj/SuperBuilderWithSetterPrefix.java b/test/transform/resource/after-ecj/SuperBuilderWithSetterPrefix.java index 0edb6608..3a1278c1 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithSetterPrefix.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithSetterPrefix.java @@ -1,183 +1,183 @@ -import java.util.List;
-public class SuperBuilderWithSetterPrefix {
- public static @lombok.experimental.SuperBuilder(toBuilder = true,setterPrefix = "with") class Parent {
- public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<C extends SuperBuilderWithSetterPrefix.Parent, B extends SuperBuilderWithSetterPrefix.Parent.ParentBuilder<C, B>> {
- private @java.lang.SuppressWarnings("all") int field1;
- private @java.lang.SuppressWarnings("all") int obtainViaField;
- private @java.lang.SuppressWarnings("all") int obtainViaMethod;
- private @java.lang.SuppressWarnings("all") String obtainViaStaticMethod;
- private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items;
- public ParentBuilder() {
- super();
- }
- protected @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) {
- SuperBuilderWithSetterPrefix.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
- return self();
- }
- private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithSetterPrefix.Parent instance, final SuperBuilderWithSetterPrefix.Parent.ParentBuilder<?, ?> b) {
- b.withField1(instance.field1);
- b.withObtainViaField(instance.field1);
- b.withObtainViaMethod(instance.method());
- b.withObtainViaStaticMethod(SuperBuilderWithSetterPrefix.Parent.staticMethod(instance));
- b.withItems(((instance.items == null) ? java.util.Collections.emptyList() : instance.items));
- }
- protected abstract @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.SuppressWarnings("all") C build();
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B withField1(final int field1) {
- this.field1 = field1;
- return self();
- }
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B withObtainViaField(final int obtainViaField) {
- this.obtainViaField = obtainViaField;
- return self();
- }
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B withObtainViaMethod(final int obtainViaMethod) {
- this.obtainViaMethod = obtainViaMethod;
- return self();
- }
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B withObtainViaStaticMethod(final String obtainViaStaticMethod) {
- this.obtainViaStaticMethod = obtainViaStaticMethod;
- return self();
- }
- public @java.lang.SuppressWarnings("all") B withItem(final String item) {
- if ((this.items == null))
- this.items = new java.util.ArrayList<String>();
- this.items.add(item);
- return self();
- }
- public @java.lang.SuppressWarnings("all") 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();
- }
- public @java.lang.SuppressWarnings("all") B clearItems() {
- if ((this.items != null))
- this.items.clear();
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((((((((("SuperBuilderWithSetterPrefix.Parent.ParentBuilder(field1=" + this.field1) + ", obtainViaField=") + this.obtainViaField) + ", obtainViaMethod=") + this.obtainViaMethod) + ", obtainViaStaticMethod=") + this.obtainViaStaticMethod) + ", items=") + this.items) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderWithSetterPrefix.Parent.ParentBuilder<SuperBuilderWithSetterPrefix.Parent, SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl> {
- private ParentBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Parent build() {
- return new SuperBuilderWithSetterPrefix.Parent(this);
- }
- }
- private int field1;
- @lombok.Builder.ObtainVia(field = "field1") int obtainViaField;
- @lombok.Builder.ObtainVia(method = "method") int obtainViaMethod;
- @lombok.Builder.ObtainVia(method = "staticMethod",isStatic = true) String obtainViaStaticMethod;
- @lombok.Singular List<String> items;
- private int method() {
- return 2;
- }
- private static String staticMethod(Parent instance) {
- return "staticMethod";
- }
- protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithSetterPrefix.Parent.ParentBuilder<?, ?> b) {
- super();
- this.field1 = b.field1;
- this.obtainViaField = b.obtainViaField;
- this.obtainViaMethod = b.obtainViaMethod;
- this.obtainViaStaticMethod = b.obtainViaStaticMethod;
- java.util.List<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;
- }
- public @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Parent.ParentBuilder<?, ?> toBuilder() {
- return new SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl().$fillValuesFrom(this);
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Parent.ParentBuilder<?, ?> builder() {
- return new SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl();
- }
- }
- public static @lombok.experimental.SuperBuilder(toBuilder = true,setterPrefix = "set") class Child extends Parent {
- public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderWithSetterPrefix.Child, B extends SuperBuilderWithSetterPrefix.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> {
- private @java.lang.SuppressWarnings("all") double field3;
- public ChildBuilder() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) {
- super.$fillValuesFrom(instance);
- SuperBuilderWithSetterPrefix.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this);
- return self();
- }
- private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithSetterPrefix.Child instance, final SuperBuilderWithSetterPrefix.Child.ChildBuilder<?, ?> b) {
- b.setField3(instance.field3);
- }
- protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self();
- public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build();
- /**
- * @return {@code this}.
- */
- public @java.lang.SuppressWarnings("all") B setField3(final double field3) {
- this.field3 = field3;
- return self();
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (((("SuperBuilderWithSetterPrefix.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")");
- }
- }
- private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderWithSetterPrefix.Child.ChildBuilder<SuperBuilderWithSetterPrefix.Child, SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl> {
- private ChildBuilderImpl() {
- super();
- }
- protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl self() {
- return this;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Child build() {
- return new SuperBuilderWithSetterPrefix.Child(this);
- }
- }
- private double field3;
- protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithSetterPrefix.Child.ChildBuilder<?, ?> b) {
- super(b);
- this.field3 = b.field3;
- }
- public @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Child.ChildBuilder<?, ?> toBuilder() {
- return new SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl().$fillValuesFrom(this);
- }
- public static @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Child.ChildBuilder<?, ?> builder() {
- return new SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl();
- }
- }
- public SuperBuilderWithSetterPrefix() {
- super();
- }
- public static void test() {
- Child x = Child.builder().setField3(0.0).withField1(5).withItem("").build().toBuilder().build();
- }
-}
+import java.util.List; +public class SuperBuilderWithSetterPrefix { + public static @lombok.experimental.SuperBuilder(toBuilder = true,setterPrefix = "with") class Parent { + public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder<C extends SuperBuilderWithSetterPrefix.Parent, B extends SuperBuilderWithSetterPrefix.Parent.ParentBuilder<C, B>> { + private @java.lang.SuppressWarnings("all") int field1; + private @java.lang.SuppressWarnings("all") int obtainViaField; + private @java.lang.SuppressWarnings("all") int obtainViaMethod; + private @java.lang.SuppressWarnings("all") String obtainViaStaticMethod; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items; + public ParentBuilder() { + super(); + } + protected @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { + SuperBuilderWithSetterPrefix.Parent.ParentBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithSetterPrefix.Parent instance, final SuperBuilderWithSetterPrefix.Parent.ParentBuilder<?, ?> b) { + b.withField1(instance.field1); + b.withObtainViaField(instance.field1); + b.withObtainViaMethod(instance.method()); + b.withObtainViaStaticMethod(SuperBuilderWithSetterPrefix.Parent.staticMethod(instance)); + b.withItems(((instance.items == null) ? java.util.Collections.<String>emptyList() : instance.items)); + } + protected abstract @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B withField1(final int field1) { + this.field1 = field1; + return self(); + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B withObtainViaField(final int obtainViaField) { + this.obtainViaField = obtainViaField; + return self(); + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B withObtainViaMethod(final int obtainViaMethod) { + this.obtainViaMethod = obtainViaMethod; + return self(); + } + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B withObtainViaStaticMethod(final String obtainViaStaticMethod) { + this.obtainViaStaticMethod = obtainViaStaticMethod; + return self(); + } + public @java.lang.SuppressWarnings("all") B withItem(final String item) { + if ((this.items == null)) + this.items = new java.util.ArrayList<String>(); + this.items.add(item); + return self(); + } + public @java.lang.SuppressWarnings("all") 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(); + } + public @java.lang.SuppressWarnings("all") B clearItems() { + if ((this.items != null)) + this.items.clear(); + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((((((("SuperBuilderWithSetterPrefix.Parent.ParentBuilder(field1=" + this.field1) + ", obtainViaField=") + this.obtainViaField) + ", obtainViaMethod=") + this.obtainViaMethod) + ", obtainViaStaticMethod=") + this.obtainViaStaticMethod) + ", items=") + this.items) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends SuperBuilderWithSetterPrefix.Parent.ParentBuilder<SuperBuilderWithSetterPrefix.Parent, SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl> { + private ParentBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Parent build() { + return new SuperBuilderWithSetterPrefix.Parent(this); + } + } + private int field1; + @lombok.Builder.ObtainVia(field = "field1") int obtainViaField; + @lombok.Builder.ObtainVia(method = "method") int obtainViaMethod; + @lombok.Builder.ObtainVia(method = "staticMethod",isStatic = true) String obtainViaStaticMethod; + @lombok.Singular List<String> items; + private int method() { + return 2; + } + private static String staticMethod(Parent instance) { + return "staticMethod"; + } + protected @java.lang.SuppressWarnings("all") Parent(final SuperBuilderWithSetterPrefix.Parent.ParentBuilder<?, ?> b) { + super(); + this.field1 = b.field1; + this.obtainViaField = b.obtainViaField; + this.obtainViaMethod = b.obtainViaMethod; + this.obtainViaStaticMethod = b.obtainViaStaticMethod; + java.util.List<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; + } + public @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Parent.ParentBuilder<?, ?> toBuilder() { + return new SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl().$fillValuesFrom(this); + } + public static @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Parent.ParentBuilder<?, ?> builder() { + return new SuperBuilderWithSetterPrefix.Parent.ParentBuilderImpl(); + } + } + public static @lombok.experimental.SuperBuilder(toBuilder = true,setterPrefix = "set") class Child extends Parent { + public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends SuperBuilderWithSetterPrefix.Child, B extends SuperBuilderWithSetterPrefix.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { + private @java.lang.SuppressWarnings("all") double field3; + public ChildBuilder() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") B $fillValuesFrom(final C instance) { + super.$fillValuesFrom(instance); + SuperBuilderWithSetterPrefix.Child.ChildBuilder.$fillValuesFromInstanceIntoBuilder(instance, this); + return self(); + } + private static @java.lang.SuppressWarnings("all") void $fillValuesFromInstanceIntoBuilder(final SuperBuilderWithSetterPrefix.Child instance, final SuperBuilderWithSetterPrefix.Child.ChildBuilder<?, ?> b) { + b.setField3(instance.field3); + } + protected abstract @java.lang.Override @java.lang.SuppressWarnings("all") B self(); + public abstract @java.lang.Override @java.lang.SuppressWarnings("all") C build(); + /** + * @return {@code this}. + */ + public @java.lang.SuppressWarnings("all") B setField3(final double field3) { + this.field3 = field3; + return self(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("SuperBuilderWithSetterPrefix.Child.ChildBuilder(super=" + super.toString()) + ", field3=") + this.field3) + ")"); + } + } + private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends SuperBuilderWithSetterPrefix.Child.ChildBuilder<SuperBuilderWithSetterPrefix.Child, SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl> { + private ChildBuilderImpl() { + super(); + } + protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl self() { + return this; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Child build() { + return new SuperBuilderWithSetterPrefix.Child(this); + } + } + private double field3; + protected @java.lang.SuppressWarnings("all") Child(final SuperBuilderWithSetterPrefix.Child.ChildBuilder<?, ?> b) { + super(b); + this.field3 = b.field3; + } + public @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Child.ChildBuilder<?, ?> toBuilder() { + return new SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl().$fillValuesFrom(this); + } + public static @java.lang.SuppressWarnings("all") SuperBuilderWithSetterPrefix.Child.ChildBuilder<?, ?> builder() { + return new SuperBuilderWithSetterPrefix.Child.ChildBuilderImpl(); + } + } + public SuperBuilderWithSetterPrefix() { + super(); + } + public static void test() { + Child x = Child.builder().setField3(0.0).withField1(5).withItem("").build().toBuilder().build(); + } +} diff --git a/test/transform/resource/after-ecj/ValueCallSuper.java b/test/transform/resource/after-ecj/ValueCallSuper.java index 2fef08ab..72422a4a 100644 --- a/test/transform/resource/after-ecj/ValueCallSuper.java +++ b/test/transform/resource/after-ecj/ValueCallSuper.java @@ -1,32 +1,32 @@ -class ValueParent {
- ValueParent() {
- super();
- }
-}
-final @lombok.Value class ValueCallSuper extends ValueParent {
- public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
- if ((o == this))
- return true;
- if ((! (o instanceof ValueCallSuper)))
- return false;
- final ValueCallSuper other = (ValueCallSuper) o;
- if ((! other.canEqual((java.lang.Object) this)))
- return false;
- if ((! super.equals(o)))
- return false;
- return true;
- }
- protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) {
- return (other instanceof ValueCallSuper);
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
- final int result = super.hashCode();
- return result;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return "ValueCallSuper()";
- }
- public @java.lang.SuppressWarnings("all") ValueCallSuper() {
- super();
- }
-}
+class ValueParent { + ValueParent() { + super(); + } +} +final @lombok.Value class ValueCallSuper extends ValueParent { + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof ValueCallSuper))) + return false; + final ValueCallSuper other = (ValueCallSuper) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + if ((! super.equals(o))) + return false; + return true; + } + protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof ValueCallSuper); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + final int result = super.hashCode(); + return result; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return "ValueCallSuper()"; + } + public @java.lang.SuppressWarnings("all") ValueCallSuper() { + super(); + } +} diff --git a/test/transform/resource/before/BuilderSingularNullBehavior2.java b/test/transform/resource/before/BuilderSingularNullBehavior2.java index 7d1d0e57..dde4eea9 100644 --- a/test/transform/resource/before/BuilderSingularNullBehavior2.java +++ b/test/transform/resource/before/BuilderSingularNullBehavior2.java @@ -1,3 +1,4 @@ +//version 8: springframework dep is too new to run on j6 //CONF: lombok.addNullAnnotations = spring //CONF: lombok.nonNull.exceptionType = JDK import java.util.List; diff --git a/test/transform/resource/before/CheckerFrameworkBasic.java b/test/transform/resource/before/CheckerFrameworkBasic.java index fb43ad08..4bf1ac73 100644 --- a/test/transform/resource/before/CheckerFrameworkBasic.java +++ b/test/transform/resource/before/CheckerFrameworkBasic.java @@ -1,3 +1,4 @@ +//version 8: //CONF: checkerframework = 4.0 import lombok.AllArgsConstructor; import lombok.Data; diff --git a/test/transform/resource/before/CheckerFrameworkBuilder.java b/test/transform/resource/before/CheckerFrameworkBuilder.java index 440b80e9..0f24e1b7 100644 --- a/test/transform/resource/before/CheckerFrameworkBuilder.java +++ b/test/transform/resource/before/CheckerFrameworkBuilder.java @@ -1,3 +1,4 @@ +//version 8: //CONF: checkerframework = 4.0 import java.util.List; import lombok.Builder; diff --git a/test/transform/resource/before/CheckerFrameworkSuperBuilder.java b/test/transform/resource/before/CheckerFrameworkSuperBuilder.java index ed9e14cb..fefff676 100644 --- a/test/transform/resource/before/CheckerFrameworkSuperBuilder.java +++ b/test/transform/resource/before/CheckerFrameworkSuperBuilder.java @@ -1,3 +1,4 @@ +//version 8: //CONF: checkerframework = 4.0 import java.util.List; import lombok.Singular; diff --git a/test/transform/resource/before/EqualsAndHashCodeAnnotated.java b/test/transform/resource/before/EqualsAndHashCodeAnnotated.java index d672b982..f65d7b5b 100644 --- a/test/transform/resource/before/EqualsAndHashCodeAnnotated.java +++ b/test/transform/resource/before/EqualsAndHashCodeAnnotated.java @@ -1,4 +1,4 @@ -//version 8 +//version 8: import java.lang.annotation.*; @lombok.EqualsAndHashCode diff --git a/test/transform/resource/before/ExtensionMethodFunctional.java b/test/transform/resource/before/ExtensionMethodFunctional.java index a9e7dd9f..8586dd7a 100644 --- a/test/transform/resource/before/ExtensionMethodFunctional.java +++ b/test/transform/resource/before/ExtensionMethodFunctional.java @@ -16,7 +16,7 @@ class ExtensionMethodFunctional { test.consume(s -> System.out.println("1: " + s), s -> System.out.println("2: " + s)); test.consume(System.out::println, System.out::println); - Stream.of("a", "b", "c").map(String::toUpperCase).toList(); + Stream.of("a", "b", "c").map(String::toUpperCase).toList1(); List<Integer> i2 = Stream.of("a", "b", "c").map(String::toUpperCase).toList2(); } @@ -36,7 +36,7 @@ class ExtensionMethodFunctional { } } - public static <T> List<T> toList(Stream<T> stream) { + public static <T> List<T> toList1(Stream<T> stream) { return (List<T>) stream.collect(Collectors.toList()); } diff --git a/test/transform/resource/before/JacksonBuilderSingular.java b/test/transform/resource/before/JacksonBuilderSingular.java index c179c760..20d6979a 100644 --- a/test/transform/resource/before/JacksonBuilderSingular.java +++ b/test/transform/resource/before/JacksonBuilderSingular.java @@ -1,3 +1,4 @@ +//version 8: Jackson deps are at least Java7+. import java.util.List; import java.util.Map; diff --git a/test/transform/resource/before/JacksonJsonProperty.java b/test/transform/resource/before/JacksonJsonProperty.java index f0b7b2f2..c0bccfae 100644 --- a/test/transform/resource/before/JacksonJsonProperty.java +++ b/test/transform/resource/before/JacksonJsonProperty.java @@ -1,3 +1,4 @@ +//version 8: Jackson deps are at least Java7+. import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.Nulls; diff --git a/test/transform/resource/before/JacksonizedBuilderComplex.java b/test/transform/resource/before/JacksonizedBuilderComplex.java index dec1cd3b..5942926d 100644 --- a/test/transform/resource/before/JacksonizedBuilderComplex.java +++ b/test/transform/resource/before/JacksonizedBuilderComplex.java @@ -1,10 +1,11 @@ -//CONF: lombok.builder.className = Test*Name
-import java.util.List;
-import lombok.Builder;
-import lombok.extern.jackson.Jacksonized;
-
-class JacksonizedBuilderComplex {
- @Jacksonized
- @Builder(buildMethodName = "execute", setterPrefix = "with")
- private static <T extends Number> void testVoidWithGenerics(T number, int arg2, String arg3, JacksonizedBuilderComplex selfRef) {}
-}
+//version 8: Jackson deps are at least Java7+. +//CONF: lombok.builder.className = Test*Name +import java.util.List; +import lombok.Builder; +import lombok.extern.jackson.Jacksonized; + +class JacksonizedBuilderComplex { + @Jacksonized + @Builder(buildMethodName = "execute", setterPrefix = "with") + private static <T extends Number> void testVoidWithGenerics(T number, int arg2, String arg3, JacksonizedBuilderComplex selfRef) {} +} diff --git a/test/transform/resource/before/JacksonizedBuilderSimple.java b/test/transform/resource/before/JacksonizedBuilderSimple.java index 6da015ec..b81a0f5d 100644 --- a/test/transform/resource/before/JacksonizedBuilderSimple.java +++ b/test/transform/resource/before/JacksonizedBuilderSimple.java @@ -1,3 +1,4 @@ +//version 8: Jackson deps are at least Java7+. import java.util.List; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; diff --git a/test/transform/resource/before/JacksonizedSuperBuilderSimple.java b/test/transform/resource/before/JacksonizedSuperBuilderSimple.java index 1e3bd0fc..23e52c97 100644 --- a/test/transform/resource/before/JacksonizedSuperBuilderSimple.java +++ b/test/transform/resource/before/JacksonizedSuperBuilderSimple.java @@ -1,3 +1,4 @@ +//version 8: Jackson deps are at least Java7+. public class JacksonizedSuperBuilderSimple { @lombok.extern.jackson.Jacksonized @lombok.experimental.SuperBuilder diff --git a/test/transform/resource/before/JacksonizedSuperBuilderWithJsonDeserialize.java b/test/transform/resource/before/JacksonizedSuperBuilderWithJsonDeserialize.java index 0c80d1a6..ac0dba07 100644 --- a/test/transform/resource/before/JacksonizedSuperBuilderWithJsonDeserialize.java +++ b/test/transform/resource/before/JacksonizedSuperBuilderWithJsonDeserialize.java @@ -1,3 +1,4 @@ +//version 8: Jackson deps are at least Java7+. @lombok.extern.jackson.Jacksonized @lombok.experimental.SuperBuilder @com.fasterxml.jackson.databind.annotation.JsonDeserialize diff --git a/test/transform/resource/before/LoggerLog4j2.java b/test/transform/resource/before/LoggerLog4j2.java index 10b3aae5..1dd48d7a 100644 --- a/test/transform/resource/before/LoggerLog4j2.java +++ b/test/transform/resource/before/LoggerLog4j2.java @@ -1,3 +1,4 @@ +//version 8: import lombok.extern.log4j.Log4j2; @lombok.extern.log4j.Log4j2 diff --git a/test/transform/resource/before/LoggerSlf4jInvalidTopic.java b/test/transform/resource/before/LoggerSlf4jInvalidTopic.java deleted file mode 100644 index eed02f01..00000000 --- a/test/transform/resource/before/LoggerSlf4jInvalidTopic.java +++ /dev/null @@ -1,5 +0,0 @@ -import lombok.extern.slf4j.Slf4j; - -@Slf4j(topic=42) -class LoggerSlf4jWithIntegerTopic { -}
\ No newline at end of file diff --git a/test/transform/resource/before/NullLibrary1.java b/test/transform/resource/before/NullLibrary1.java index 95433270..d57d3d09 100644 --- a/test/transform/resource/before/NullLibrary1.java +++ b/test/transform/resource/before/NullLibrary1.java @@ -1,3 +1,4 @@ +//version 8: //CONF: lombok.addNullAnnotations = eclipse @lombok.EqualsAndHashCode @lombok.ToString diff --git a/test/transform/resource/before/NullLibrary2.java b/test/transform/resource/before/NullLibrary2.java index 17b1e6e0..6b0ce4b0 100644 --- a/test/transform/resource/before/NullLibrary2.java +++ b/test/transform/resource/before/NullLibrary2.java @@ -1,3 +1,4 @@ +//version 8: springframework dep is too new to run on j6 //CONF: lombok.addNullAnnotations = spring @lombok.EqualsAndHashCode @lombok.ToString diff --git a/test/transform/resource/before/SuperBuilderBasicToBuilder.java b/test/transform/resource/before/SuperBuilderBasicToBuilder.java index 93161443..bd97876e 100644 --- a/test/transform/resource/before/SuperBuilderBasicToBuilder.java +++ b/test/transform/resource/before/SuperBuilderBasicToBuilder.java @@ -15,7 +15,7 @@ public class SuperBuilderBasicToBuilder { private int method() { return 2; } - + private static String staticMethod(Parent instance) { return "staticMethod"; } diff --git a/test/transform/resource/before/SuperBuilderCustomized.java b/test/transform/resource/before/SuperBuilderCustomized.java index 8e641d90..652d0865 100644 --- a/test/transform/resource/before/SuperBuilderCustomized.java +++ b/test/transform/resource/before/SuperBuilderCustomized.java @@ -1,3 +1,4 @@ +//version 8: Javac 6 will error out due to `ChildBuilder` not existing before properly running lombok. Giving j6 support status, not worth fixing. import java.util.List; public class SuperBuilderCustomized { diff --git a/test/transform/resource/before/SuperBuilderSingularAnnotatedTypes.java b/test/transform/resource/before/SuperBuilderSingularAnnotatedTypes.java index d26352d2..097f4e60 100644 --- a/test/transform/resource/before/SuperBuilderSingularAnnotatedTypes.java +++ b/test/transform/resource/before/SuperBuilderSingularAnnotatedTypes.java @@ -1,4 +1,4 @@ -//VERSION 8: +//version 8: import java.lang.annotation.ElementType; import java.lang.annotation.Target; import java.util.Set; diff --git a/test/transform/resource/before/SuperBuilderWithCustomBuilderMethod.java b/test/transform/resource/before/SuperBuilderWithCustomBuilderMethod.java index d52cbded..b828eafe 100644 --- a/test/transform/resource/before/SuperBuilderWithCustomBuilderMethod.java +++ b/test/transform/resource/before/SuperBuilderWithCustomBuilderMethod.java @@ -1,3 +1,4 @@ +//version 8: Javac 6 will error out due to `ChildBuilder` not existing before properly running lombok. Giving j6 support status, not worth fixing. import java.util.List; public class SuperBuilderWithCustomBuilderMethod { diff --git a/test/transform/resource/before/ValDelegateMethodReference.java b/test/transform/resource/before/ValDelegateMethodReference.java index 21b781aa..3d1f082c 100644 --- a/test/transform/resource/before/ValDelegateMethodReference.java +++ b/test/transform/resource/before/ValDelegateMethodReference.java @@ -1,3 +1,4 @@ +//version 8: //platform !eclipse: Requires a 'full' eclipse with intialized workspace, and we don't (yet) have that set up properly in the test run. import lombok.Getter; import lombok.Setter; diff --git a/test/transform/resource/before/ValWeirdTypes.java b/test/transform/resource/before/ValWeirdTypes.java index 8dd63e86..f62feca6 100644 --- a/test/transform/resource/before/ValWeirdTypes.java +++ b/test/transform/resource/before/ValWeirdTypes.java @@ -1,3 +1,4 @@ +// version 8: In java6/7, lub types worked differently, so, the `arraysAsList` method has a slightly different inferred type there. import java.math.BigDecimal; import java.util.*; import lombok.val; diff --git a/test/transform/resource/before/ValueCallSuper.java b/test/transform/resource/before/ValueCallSuper.java index e236b404..bf561998 100644 --- a/test/transform/resource/before/ValueCallSuper.java +++ b/test/transform/resource/before/ValueCallSuper.java @@ -1,7 +1,7 @@ -//CONF: lombok.equalsAndHashCode.callSuper = call
-
-class ValueParent {
-}
-@lombok.Value
-class ValueCallSuper extends ValueParent {
-}
+//CONF: lombok.equalsAndHashCode.callSuper = call + +class ValueParent { +} +@lombok.Value +class ValueCallSuper extends ValueParent { +} diff --git a/test/transform/resource/before/WithByNullAnnos.java b/test/transform/resource/before/WithByNullAnnos.java index 3fd8087f..a3ef6ac3 100644 --- a/test/transform/resource/before/WithByNullAnnos.java +++ b/test/transform/resource/before/WithByNullAnnos.java @@ -1,3 +1,4 @@ +//version 8: //CONF: lombok.addNullAnnotations=checkerframework import java.util.List; @lombok.RequiredArgsConstructor diff --git a/test/transform/resource/before/WithByTypes.java b/test/transform/resource/before/WithByTypes.java index 9d2fe358..e33b0dd6 100644 --- a/test/transform/resource/before/WithByTypes.java +++ b/test/transform/resource/before/WithByTypes.java @@ -1,3 +1,4 @@ +//version 8: @lombok.RequiredArgsConstructor @lombok.experimental.FieldDefaults(level = lombok.AccessLevel.PRIVATE, makeFinal = true) @lombok.experimental.WithBy diff --git a/test/transform/resource/before/WithPlain.java b/test/transform/resource/before/WithPlain.java index 4f048242..9be8d4d5 100644 --- a/test/transform/resource/before/WithPlain.java +++ b/test/transform/resource/before/WithPlain.java @@ -1,3 +1,4 @@ +//version 8: springframework dep is too new to run on j6 //CONF: lombok.addNullAnnotations = spring import lombok.With; class WithPlain { diff --git a/test/transform/resource/messages-delombok/LoggerSlf4jInvalidTopic.java.messages b/test/transform/resource/messages-delombok/LoggerSlf4jInvalidTopic.java.messages deleted file mode 100644 index 8de0a120..00000000 --- a/test/transform/resource/messages-delombok/LoggerSlf4jInvalidTopic.java.messages +++ /dev/null @@ -1,2 +0,0 @@ -3 incompatible types: int cannot be converted to java.lang.String --1 not flagged modified
\ No newline at end of file diff --git a/test/transform/resource/messages-ecj/LoggerSlf4jInvalidTopic.java.messages b/test/transform/resource/messages-ecj/LoggerSlf4jInvalidTopic.java.messages deleted file mode 100644 index 9bc2a82b..00000000 --- a/test/transform/resource/messages-ecj/LoggerSlf4jInvalidTopic.java.messages +++ /dev/null @@ -1 +0,0 @@ -3 Type mismatch: cannot convert from int to String
\ No newline at end of file diff --git a/test/transform/resource/messages-idempotent/LoggerSlf4jInvalidTopic.java.messages b/test/transform/resource/messages-idempotent/LoggerSlf4jInvalidTopic.java.messages deleted file mode 100644 index d894fad1..00000000 --- a/test/transform/resource/messages-idempotent/LoggerSlf4jInvalidTopic.java.messages +++ /dev/null @@ -1 +0,0 @@ -3 incompatible types: int cannot be converted to java.lang.String
\ No newline at end of file |