diff options
author | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2023-01-12 01:44:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-12 01:44:52 +0100 |
commit | e90d497c93ecc7db1d5a901d40f11fc919f31447 (patch) | |
tree | e85b974b9c8bd42e1e9241d2bd3231cfecaa3ebc /test/transform/resource/after-delombok | |
parent | ef916881ad85371b905b0104072df2a2b133eee8 (diff) | |
parent | d2ae62ac71ebf55406d308dc41e76f36e7cb5ea8 (diff) | |
download | lombok-e90d497c93ecc7db1d5a901d40f11fc919f31447.tar.gz lombok-e90d497c93ecc7db1d5a901d40f11fc919f31447.tar.bz2 lombok-e90d497c93ecc7db1d5a901d40f11fc919f31447.zip |
Merge pull request #3232 from janrieke/superBuilderFixMethodExistsChecks
Fix SuperBuilder for fields named "build" or "self"
Diffstat (limited to 'test/transform/resource/after-delombok')
27 files changed, 336 insertions, 230 deletions
diff --git a/test/transform/resource/after-delombok/BuilderCustomName.java b/test/transform/resource/after-delombok/BuilderCustomName.java index 2e5924d3..900fbb03 100644 --- a/test/transform/resource/after-delombok/BuilderCustomName.java +++ b/test/transform/resource/after-delombok/BuilderCustomName.java @@ -5,10 +5,6 @@ class BuilderCustomName<T> { public static abstract class SimpleTestBuilder<T, C extends BuilderCustomName<T>, B extends BuilderCustomName.SimpleTestBuilder<T, C, B>> { @java.lang.SuppressWarnings("all") private int field; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -17,6 +13,10 @@ class BuilderCustomName<T> { this.field = field; 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() { diff --git a/test/transform/resource/after-delombok/CheckerFrameworkSuperBuilder.java b/test/transform/resource/after-delombok/CheckerFrameworkSuperBuilder.java index cab11f3c..cf00f5fc 100644 --- a/test/transform/resource/after-delombok/CheckerFrameworkSuperBuilder.java +++ b/test/transform/resource/after-delombok/CheckerFrameworkSuperBuilder.java @@ -23,12 +23,6 @@ class CheckerFrameworkSuperBuilder { private int z; @java.lang.SuppressWarnings("all") private java.util.ArrayList<String> names; - @org.checkerframework.dataflow.qual.Pure - @java.lang.SuppressWarnings("all") - protected abstract @org.checkerframework.common.returnsreceiver.qual.This B self(); - @org.checkerframework.dataflow.qual.SideEffectFree - @java.lang.SuppressWarnings("all") - public abstract C build(CheckerFrameworkSuperBuilder.Parent.@org.checkerframework.checker.calledmethods.qual.CalledMethods({"y", "z"}) ParentBuilder<C, B> this); /** * @return {@code this}. */ @@ -74,6 +68,12 @@ class CheckerFrameworkSuperBuilder { if (this.names != null) this.names.clear(); return self(); } + @org.checkerframework.dataflow.qual.Pure + @java.lang.SuppressWarnings("all") + protected abstract @org.checkerframework.common.returnsreceiver.qual.This B self(); + @org.checkerframework.dataflow.qual.SideEffectFree + @java.lang.SuppressWarnings("all") + public abstract C build(CheckerFrameworkSuperBuilder.Parent.@org.checkerframework.checker.calledmethods.qual.CalledMethods({"y", "z"}) ParentBuilder<C, B> this); @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.Override @java.lang.SuppressWarnings("all") @@ -140,14 +140,6 @@ class CheckerFrameworkSuperBuilder { private int a$value; @java.lang.SuppressWarnings("all") private int b; - @java.lang.Override - @org.checkerframework.dataflow.qual.Pure - @java.lang.SuppressWarnings("all") - protected abstract @org.checkerframework.common.returnsreceiver.qual.This B self(); - @org.checkerframework.dataflow.qual.SideEffectFree - @java.lang.Override - @java.lang.SuppressWarnings("all") - public abstract C build(CheckerFrameworkSuperBuilder.ZChild.@org.checkerframework.checker.calledmethods.qual.CalledMethods("b") ZChildBuilder<C, B> this); /** * @return {@code this}. */ @@ -165,6 +157,14 @@ class CheckerFrameworkSuperBuilder { this.b = b; return self(); } + @java.lang.Override + @org.checkerframework.dataflow.qual.Pure + @java.lang.SuppressWarnings("all") + protected abstract @org.checkerframework.common.returnsreceiver.qual.This B self(); + @org.checkerframework.dataflow.qual.SideEffectFree + @java.lang.Override + @java.lang.SuppressWarnings("all") + public abstract C build(CheckerFrameworkSuperBuilder.ZChild.@org.checkerframework.checker.calledmethods.qual.CalledMethods("b") ZChildBuilder<C, B> this); @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.Override @java.lang.SuppressWarnings("all") diff --git a/test/transform/resource/after-delombok/ConstructorsWithSuperBuilderDefaults.java b/test/transform/resource/after-delombok/ConstructorsWithSuperBuilderDefaults.java index e7811dd5..c5188bb3 100644 --- a/test/transform/resource/after-delombok/ConstructorsWithSuperBuilderDefaults.java +++ b/test/transform/resource/after-delombok/ConstructorsWithSuperBuilderDefaults.java @@ -17,12 +17,6 @@ class ConstructorsWithSuperBuilderDefaults { @java.lang.SuppressWarnings("all") private int y; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** * @return {@code this}. */ @@ -42,6 +36,12 @@ class ConstructorsWithSuperBuilderDefaults { 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() { diff --git a/test/transform/resource/after-delombok/JacksonizedSuperBuilderSimple.java b/test/transform/resource/after-delombok/JacksonizedSuperBuilderSimple.java index 88a51f41..a07d9dfc 100644 --- a/test/transform/resource/after-delombok/JacksonizedSuperBuilderSimple.java +++ b/test/transform/resource/after-delombok/JacksonizedSuperBuilderSimple.java @@ -8,10 +8,6 @@ public class JacksonizedSuperBuilderSimple { 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}. */ @@ -20,6 +16,10 @@ public class JacksonizedSuperBuilderSimple { this.field1 = field1; 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() { diff --git a/test/transform/resource/after-delombok/JacksonizedSuperBuilderWithJsonDeserialize.java b/test/transform/resource/after-delombok/JacksonizedSuperBuilderWithJsonDeserialize.java index 1ed38f05..307537ae 100644 --- a/test/transform/resource/after-delombok/JacksonizedSuperBuilderWithJsonDeserialize.java +++ b/test/transform/resource/after-delombok/JacksonizedSuperBuilderWithJsonDeserialize.java @@ -6,10 +6,6 @@ public class JacksonizedSuperBuilderWithJsonDeserialize { public static abstract class JacksonizedSuperBuilderWithJsonDeserializeBuilder<C extends JacksonizedSuperBuilderWithJsonDeserialize, B extends JacksonizedSuperBuilderWithJsonDeserialize.JacksonizedSuperBuilderWithJsonDeserializeBuilder<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}. */ @@ -18,6 +14,10 @@ public class JacksonizedSuperBuilderWithJsonDeserialize { this.field1 = field1; 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() { diff --git a/test/transform/resource/after-delombok/NullAnnotatedCheckerFrameworkSuperBuilder.java b/test/transform/resource/after-delombok/NullAnnotatedCheckerFrameworkSuperBuilder.java index 25a76c6d..ae2bcdfd 100644 --- a/test/transform/resource/after-delombok/NullAnnotatedCheckerFrameworkSuperBuilder.java +++ b/test/transform/resource/after-delombok/NullAnnotatedCheckerFrameworkSuperBuilder.java @@ -29,12 +29,6 @@ class NullAnnotatedCheckerFrameworkSuperBuilder { @java.lang.SuppressWarnings("all") private java.util.ArrayList<String> names; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** * @return {@code this}. */ @@ -92,6 +86,12 @@ class NullAnnotatedCheckerFrameworkSuperBuilder { 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.@org.checkerframework.checker.nullness.qual.NonNull String toString() { @@ -165,14 +165,6 @@ class NullAnnotatedCheckerFrameworkSuperBuilder { @java.lang.SuppressWarnings("all") private int b; - @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}. */ @@ -196,6 +188,14 @@ class NullAnnotatedCheckerFrameworkSuperBuilder { @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.@org.checkerframework.checker.nullness.qual.NonNull String toString() { return "NullAnnotatedCheckerFrameworkSuperBuilder.ZChild.ZChildBuilder(super=" + super.toString() + ", a$value=" + this.a$value + ", b=" + this.b + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderAbstract.java b/test/transform/resource/after-delombok/SuperBuilderAbstract.java index 727c5beb..f92eede2 100644 --- a/test/transform/resource/after-delombok/SuperBuilderAbstract.java +++ b/test/transform/resource/after-delombok/SuperBuilderAbstract.java @@ -5,10 +5,6 @@ public class SuperBuilderAbstract { 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}. */ @@ -17,6 +13,10 @@ public class SuperBuilderAbstract { this.parentField = parentField; 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() { @@ -54,12 +54,6 @@ public class SuperBuilderAbstract { 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}. */ @@ -70,6 +64,12 @@ public class SuperBuilderAbstract { } @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 "SuperBuilderAbstract.Child.ChildBuilder(super=" + super.toString() + ", childField=" + this.childField + ")"; } @@ -86,12 +86,6 @@ public class SuperBuilderAbstract { 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}. */ @@ -102,6 +96,12 @@ public class SuperBuilderAbstract { } @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 "SuperBuilderAbstract.GrandChild.GrandChildBuilder(super=" + super.toString() + ", grandChildField=" + this.grandChildField + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderAbstractToBuilder.java b/test/transform/resource/after-delombok/SuperBuilderAbstractToBuilder.java index 53962c60..c9ed6ad7 100644 --- a/test/transform/resource/after-delombok/SuperBuilderAbstractToBuilder.java +++ b/test/transform/resource/after-delombok/SuperBuilderAbstractToBuilder.java @@ -14,10 +14,6 @@ public class SuperBuilderAbstractToBuilder { 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}. */ @@ -26,6 +22,10 @@ public class SuperBuilderAbstractToBuilder { this.parentField = parentField; 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() { @@ -78,12 +78,6 @@ public class SuperBuilderAbstractToBuilder { 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}. */ @@ -94,6 +88,12 @@ public class SuperBuilderAbstractToBuilder { } @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 "SuperBuilderAbstractToBuilder.Child.ChildBuilder(super=" + super.toString() + ", childField=" + this.childField + ")"; } @@ -121,12 +121,6 @@ public class SuperBuilderAbstractToBuilder { 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}. */ @@ -137,6 +131,12 @@ public class SuperBuilderAbstractToBuilder { } @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 "SuperBuilderAbstractToBuilder.GrandChild.GrandChildBuilder(super=" + super.toString() + ", grandChildField=" + this.grandChildField + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderBasic.java b/test/transform/resource/after-delombok/SuperBuilderBasic.java index 7fff2ef8..31b6692d 100644 --- a/test/transform/resource/after-delombok/SuperBuilderBasic.java +++ b/test/transform/resource/after-delombok/SuperBuilderBasic.java @@ -9,10 +9,6 @@ public class SuperBuilderBasic { 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}. */ @@ -41,6 +37,10 @@ public class SuperBuilderBasic { if (this.items != null) this.items.clear(); 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() { @@ -90,12 +90,6 @@ public class SuperBuilderBasic { 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}. */ @@ -106,6 +100,12 @@ public class SuperBuilderBasic { } @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 "SuperBuilderBasic.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderBasicToBuilder.java b/test/transform/resource/after-delombok/SuperBuilderBasicToBuilder.java index add6f841..f57937ec 100644 --- a/test/transform/resource/after-delombok/SuperBuilderBasicToBuilder.java +++ b/test/transform/resource/after-delombok/SuperBuilderBasicToBuilder.java @@ -37,10 +37,6 @@ public class SuperBuilderBasicToBuilder { 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}. */ @@ -93,6 +89,10 @@ public class SuperBuilderBasicToBuilder { if (this.items != null) this.items.clear(); 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() { @@ -160,12 +160,6 @@ public class SuperBuilderBasicToBuilder { 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}. */ @@ -176,6 +170,12 @@ public class SuperBuilderBasicToBuilder { } @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 "SuperBuilderBasicToBuilder.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderCustomized.java b/test/transform/resource/after-delombok/SuperBuilderCustomized.java index 3a0bbd9b..5f41cdde 100644 --- a/test/transform/resource/after-delombok/SuperBuilderCustomized.java +++ b/test/transform/resource/after-delombok/SuperBuilderCustomized.java @@ -71,12 +71,6 @@ public class SuperBuilderCustomized { 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}. */ @@ -87,6 +81,12 @@ public class SuperBuilderCustomized { } @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 "SuperBuilderCustomized.Child.ChildBuilder(super=" + super.toString() + ", field2=" + this.field2 + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderInitializer.java b/test/transform/resource/after-delombok/SuperBuilderInitializer.java index 95943aa9..19ed0c68 100644 --- a/test/transform/resource/after-delombok/SuperBuilderInitializer.java +++ b/test/transform/resource/after-delombok/SuperBuilderInitializer.java @@ -19,12 +19,6 @@ class SuperBuilderInitializer { @java.lang.SuppressWarnings("all") private String world; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** * @return {@code this}. */ @@ -34,6 +28,12 @@ class SuperBuilderInitializer { 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() { diff --git a/test/transform/resource/after-delombok/SuperBuilderNameClashes.java b/test/transform/resource/after-delombok/SuperBuilderNameClashes.java index 37372e41..5b0db135 100644 --- a/test/transform/resource/after-delombok/SuperBuilderNameClashes.java +++ b/test/transform/resource/after-delombok/SuperBuilderNameClashes.java @@ -81,10 +81,6 @@ public class SuperBuilderNameClashes { 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}. */ @@ -93,6 +89,10 @@ public class SuperBuilderNameClashes { this.c2 = c2; return self(); } + @java.lang.SuppressWarnings("all") + protected abstract B self(); + @java.lang.SuppressWarnings("all") + public abstract C3 build(); @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { diff --git a/test/transform/resource/after-delombok/SuperBuilderSingularAnnotatedTypes.java b/test/transform/resource/after-delombok/SuperBuilderSingularAnnotatedTypes.java index ad51816a..6e2fdca2 100644 --- a/test/transform/resource/after-delombok/SuperBuilderSingularAnnotatedTypes.java +++ b/test/transform/resource/after-delombok/SuperBuilderSingularAnnotatedTypes.java @@ -19,10 +19,6 @@ class SuperBuilderSingularAnnotatedTypes { @java.lang.SuppressWarnings("all") private java.util.ArrayList<@MyAnnotation @NonNull Integer> bars$value; @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); - @java.lang.SuppressWarnings("all") public B foo(@MyAnnotation @NonNull final String foo) { if (foo == null) { throw new java.lang.NullPointerException("foo is marked non-null but is null"); @@ -84,6 +80,10 @@ class SuperBuilderSingularAnnotatedTypes { } 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() { diff --git a/test/transform/resource/after-delombok/SuperBuilderSingularCustomized.java b/test/transform/resource/after-delombok/SuperBuilderSingularCustomized.java index 04cfd9f2..1f07c448 100644 --- a/test/transform/resource/after-delombok/SuperBuilderSingularCustomized.java +++ b/test/transform/resource/after-delombok/SuperBuilderSingularCustomized.java @@ -8,10 +8,6 @@ class SuperBuilderSingularCustomized { return self(); } @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); - @java.lang.SuppressWarnings("all") public B foo(final String foo) { if (this.foos == null) this.foos = new java.util.ArrayList<String>(); this.foos.add(foo); @@ -31,6 +27,10 @@ class SuperBuilderSingularCustomized { if (this.foos != null) this.foos.clear(); 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() { diff --git a/test/transform/resource/after-delombok/SuperBuilderSingularToBuilderGuava.java b/test/transform/resource/after-delombok/SuperBuilderSingularToBuilderGuava.java index ec716fdd..685f3f85 100644 --- a/test/transform/resource/after-delombok/SuperBuilderSingularToBuilderGuava.java +++ b/test/transform/resource/after-delombok/SuperBuilderSingularToBuilderGuava.java @@ -32,10 +32,6 @@ public class SuperBuilderSingularToBuilderGuava { b.users(instance.users == null ? com.google.common.collect.ImmutableTable.<Number, Number, String>of() : instance.users); } @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); - @java.lang.SuppressWarnings("all") public B card(final T card) { if (this.cards == null) this.cards = com.google.common.collect.ImmutableList.builder(); this.cards.add(card); @@ -135,6 +131,10 @@ public class SuperBuilderSingularToBuilderGuava { this.users = null; 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() { @@ -196,12 +196,6 @@ public class SuperBuilderSingularToBuilderGuava { private static <T> void $fillValuesFromInstanceIntoBuilder(final SuperBuilderSingularToBuilderGuava.Child<T> instance, final SuperBuilderSingularToBuilderGuava.Child.ChildBuilder<T, ?, ?> 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}. */ @@ -212,6 +206,12 @@ public class SuperBuilderSingularToBuilderGuava { } @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 "SuperBuilderSingularToBuilderGuava.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderWithCustomBuilderMethod.java b/test/transform/resource/after-delombok/SuperBuilderWithCustomBuilderMethod.java index 9237a148..a2f3231d 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithCustomBuilderMethod.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithCustomBuilderMethod.java @@ -10,10 +10,6 @@ public class SuperBuilderWithCustomBuilderMethod { 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}. */ @@ -42,6 +38,10 @@ public class SuperBuilderWithCustomBuilderMethod { if (this.items != null) this.items.clear(); 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() { @@ -94,12 +94,6 @@ public class SuperBuilderWithCustomBuilderMethod { 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}. */ @@ -110,6 +104,12 @@ public class SuperBuilderWithCustomBuilderMethod { } @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 "SuperBuilderWithCustomBuilderMethod.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderWithDefaults.java b/test/transform/resource/after-delombok/SuperBuilderWithDefaults.java index a9d92ff9..3fc47f02 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithDefaults.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithDefaults.java @@ -21,10 +21,6 @@ public class SuperBuilderWithDefaults { 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}. */ @@ -43,6 +39,10 @@ public class SuperBuilderWithDefaults { numberField$set = true; 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() { @@ -89,12 +89,6 @@ public class SuperBuilderWithDefaults { 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}. */ @@ -106,6 +100,12 @@ public class SuperBuilderWithDefaults { } @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 "SuperBuilderWithDefaults.Child.ChildBuilder(super=" + super.toString() + ", doubleField$value=" + this.doubleField$value + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderWithDefaultsAndTargetTyping.java b/test/transform/resource/after-delombok/SuperBuilderWithDefaultsAndTargetTyping.java index bc7b3099..9a67573d 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithDefaultsAndTargetTyping.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithDefaultsAndTargetTyping.java @@ -18,12 +18,6 @@ public class SuperBuilderWithDefaultsAndTargetTyping { @java.lang.SuppressWarnings("all") private String foo$value; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - - @java.lang.SuppressWarnings("all") - public abstract C build(); - /** * @return {@code this}. */ @@ -34,6 +28,12 @@ public class SuperBuilderWithDefaultsAndTargetTyping { 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() { @@ -90,14 +90,6 @@ public class SuperBuilderWithDefaultsAndTargetTyping { @java.lang.SuppressWarnings("all") private String foo$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}. */ @@ -110,6 +102,14 @@ public class SuperBuilderWithDefaultsAndTargetTyping { @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 "SuperBuilderWithDefaultsAndTargetTyping.Child.ChildBuilder(super=" + super.toString() + ", foo$value=" + this.foo$value + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderWithGenerics.java b/test/transform/resource/after-delombok/SuperBuilderWithGenerics.java index 017ebf31..0c00cdfc 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithGenerics.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithGenerics.java @@ -9,10 +9,6 @@ public class SuperBuilderWithGenerics { 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}. */ @@ -41,6 +37,10 @@ public class SuperBuilderWithGenerics { if (this.items != null) this.items.clear(); 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() { @@ -90,12 +90,6 @@ public class SuperBuilderWithGenerics { 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}. */ @@ -106,6 +100,12 @@ public class SuperBuilderWithGenerics { } @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 "SuperBuilderWithGenerics.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderWithGenerics2.java b/test/transform/resource/after-delombok/SuperBuilderWithGenerics2.java index 8c465b0e..011604e9 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithGenerics2.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithGenerics2.java @@ -9,10 +9,6 @@ public class SuperBuilderWithGenerics2 { 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}. */ @@ -41,6 +37,10 @@ public class SuperBuilderWithGenerics2 { if (this.items != null) this.items.clear(); 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() { @@ -90,12 +90,6 @@ public class SuperBuilderWithGenerics2 { 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}. */ @@ -106,6 +100,12 @@ public class SuperBuilderWithGenerics2 { } @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 "SuperBuilderWithGenerics2.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderWithGenerics3.java b/test/transform/resource/after-delombok/SuperBuilderWithGenerics3.java index 991d7cbe..ac33d10f 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithGenerics3.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithGenerics3.java @@ -6,10 +6,6 @@ public class SuperBuilderWithGenerics3 { public static abstract class ParentBuilder<A, C extends SuperBuilderWithGenerics3.Parent<A>, B extends SuperBuilderWithGenerics3.Parent.ParentBuilder<A, C, B>> { @java.lang.SuppressWarnings("all") private String str; - @java.lang.SuppressWarnings("all") - protected abstract B self(); - @java.lang.SuppressWarnings("all") - public abstract C build(); /** * @return {@code this}. */ @@ -18,6 +14,10 @@ public class SuperBuilderWithGenerics3 { this.str = str; 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() { @@ -57,12 +57,6 @@ public class SuperBuilderWithGenerics3 { public static abstract class ChildBuilder<C extends SuperBuilderWithGenerics3.Child, B extends SuperBuilderWithGenerics3.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<Child.SomeInnerStaticClass, 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}. */ @@ -73,6 +67,12 @@ public class SuperBuilderWithGenerics3 { } @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 "SuperBuilderWithGenerics3.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderWithGenericsAndToBuilder.java b/test/transform/resource/after-delombok/SuperBuilderWithGenericsAndToBuilder.java index 28c48db3..b85e233c 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithGenericsAndToBuilder.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithGenericsAndToBuilder.java @@ -21,10 +21,6 @@ public class SuperBuilderWithGenericsAndToBuilder { 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}. */ @@ -66,6 +62,10 @@ public class SuperBuilderWithGenericsAndToBuilder { } 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() { @@ -132,12 +132,6 @@ public class SuperBuilderWithGenericsAndToBuilder { 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}. */ @@ -148,6 +142,12 @@ public class SuperBuilderWithGenericsAndToBuilder { } @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 "SuperBuilderWithGenericsAndToBuilder.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java b/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java index a3e15e8d..f51b204d 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithNonNull.java @@ -14,10 +14,6 @@ public class SuperBuilderWithNonNull { 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}. */ @@ -30,6 +26,10 @@ public class SuperBuilderWithNonNull { nonNullParentField$set = true; 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() { @@ -72,12 +72,6 @@ public class SuperBuilderWithNonNull { 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}. */ @@ -91,6 +85,12 @@ public class SuperBuilderWithNonNull { } @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 "SuperBuilderWithNonNull.Child.ChildBuilder(super=" + super.toString() + ", nonNullChildField=" + this.nonNullChildField + ")"; } diff --git a/test/transform/resource/after-delombok/SuperBuilderWithOverloadedGeneratedMethods.java b/test/transform/resource/after-delombok/SuperBuilderWithOverloadedGeneratedMethods.java new file mode 100644 index 00000000..4c8b77a8 --- /dev/null +++ b/test/transform/resource/after-delombok/SuperBuilderWithOverloadedGeneratedMethods.java @@ -0,0 +1,106 @@ +public class SuperBuilderWithOverloadedGeneratedMethods { + public static class Parent { + int self; + @java.lang.SuppressWarnings("all") + public static abstract class ParentBuilder<C extends SuperBuilderWithOverloadedGeneratedMethods.Parent, B extends SuperBuilderWithOverloadedGeneratedMethods.Parent.ParentBuilder<C, B>> { + @java.lang.SuppressWarnings("all") + private int self; + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B self(final int self) { + this.self = self; + 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 "SuperBuilderWithOverloadedGeneratedMethods.Parent.ParentBuilder(self=" + this.self + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ParentBuilderImpl extends SuperBuilderWithOverloadedGeneratedMethods.Parent.ParentBuilder<SuperBuilderWithOverloadedGeneratedMethods.Parent, SuperBuilderWithOverloadedGeneratedMethods.Parent.ParentBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ParentBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithOverloadedGeneratedMethods.Parent.ParentBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithOverloadedGeneratedMethods.Parent build() { + return new SuperBuilderWithOverloadedGeneratedMethods.Parent(this); + } + } + @java.lang.SuppressWarnings("all") + protected Parent(final SuperBuilderWithOverloadedGeneratedMethods.Parent.ParentBuilder<?, ?> b) { + this.self = b.self; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderWithOverloadedGeneratedMethods.Parent.ParentBuilder<?, ?> builder() { + return new SuperBuilderWithOverloadedGeneratedMethods.Parent.ParentBuilderImpl(); + } + } + public static class Child extends Parent { + double build; + @java.lang.SuppressWarnings("all") + public static abstract class ChildBuilder<C extends SuperBuilderWithOverloadedGeneratedMethods.Child, B extends SuperBuilderWithOverloadedGeneratedMethods.Child.ChildBuilder<C, B>> extends Parent.ParentBuilder<C, B> { + @java.lang.SuppressWarnings("all") + private double build; + /** + * @return {@code this}. + */ + @java.lang.SuppressWarnings("all") + public B build(final double build) { + this.build = build; + return self(); + } + @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 "SuperBuilderWithOverloadedGeneratedMethods.Child.ChildBuilder(super=" + super.toString() + ", build=" + this.build + ")"; + } + } + @java.lang.SuppressWarnings("all") + private static final class ChildBuilderImpl extends SuperBuilderWithOverloadedGeneratedMethods.Child.ChildBuilder<SuperBuilderWithOverloadedGeneratedMethods.Child, SuperBuilderWithOverloadedGeneratedMethods.Child.ChildBuilderImpl> { + @java.lang.SuppressWarnings("all") + private ChildBuilderImpl() { + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + protected SuperBuilderWithOverloadedGeneratedMethods.Child.ChildBuilderImpl self() { + return this; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public SuperBuilderWithOverloadedGeneratedMethods.Child build() { + return new SuperBuilderWithOverloadedGeneratedMethods.Child(this); + } + } + @java.lang.SuppressWarnings("all") + protected Child(final SuperBuilderWithOverloadedGeneratedMethods.Child.ChildBuilder<?, ?> b) { + super(b); + this.build = b.build; + } + @java.lang.SuppressWarnings("all") + public static SuperBuilderWithOverloadedGeneratedMethods.Child.ChildBuilder<?, ?> builder() { + return new SuperBuilderWithOverloadedGeneratedMethods.Child.ChildBuilderImpl(); + } + } + public static void test() { + Child x = Child.builder().build(0.0).self(5).build(); + } +} diff --git a/test/transform/resource/after-delombok/SuperBuilderWithPrefixes.java b/test/transform/resource/after-delombok/SuperBuilderWithPrefixes.java index 16325113..04c23051 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithPrefixes.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithPrefixes.java @@ -10,10 +10,6 @@ class SuperBuilderWithPrefixes { private int otherField; @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}. */ @@ -50,6 +46,10 @@ class SuperBuilderWithPrefixes { if (this.items != null) this.items.clear(); 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() { diff --git a/test/transform/resource/after-delombok/SuperBuilderWithSetterPrefix.java b/test/transform/resource/after-delombok/SuperBuilderWithSetterPrefix.java index 88db8511..a82e2eac 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithSetterPrefix.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithSetterPrefix.java @@ -37,10 +37,6 @@ public class SuperBuilderWithSetterPrefix { 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}. */ @@ -93,6 +89,10 @@ public class SuperBuilderWithSetterPrefix { if (this.items != null) this.items.clear(); 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() { @@ -160,12 +160,6 @@ public class SuperBuilderWithSetterPrefix { 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}. */ @@ -176,6 +170,12 @@ public class SuperBuilderWithSetterPrefix { } @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 "SuperBuilderWithSetterPrefix.Child.ChildBuilder(super=" + super.toString() + ", field3=" + this.field3 + ")"; } |