import java.util.Arrays; import lombok.Builder; public class SuperBuilderWithDefaultsAndTargetTyping { public static class Parent { private String foo; @java.lang.SuppressWarnings("all") private static String $default$foo() { return doSth(Arrays.asList(1), Arrays.asList('a')); } @java.lang.SuppressWarnings("all") public static abstract class ParentBuilder> { @java.lang.SuppressWarnings("all") private boolean foo$set; @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}. */ @java.lang.SuppressWarnings("all") public B foo(final String foo) { this.foo$value = foo; foo$set = true; return self(); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { return "SuperBuilderWithDefaultsAndTargetTyping.Parent.ParentBuilder(foo$value=" + this.foo$value + ")"; } } @java.lang.SuppressWarnings("all") private static final class ParentBuilderImpl extends SuperBuilderWithDefaultsAndTargetTyping.Parent.ParentBuilder { @java.lang.SuppressWarnings("all") private ParentBuilderImpl() { } @java.lang.Override @java.lang.SuppressWarnings("all") protected SuperBuilderWithDefaultsAndTargetTyping.Parent.ParentBuilderImpl self() { return this; } @java.lang.Override @java.lang.SuppressWarnings("all") public SuperBuilderWithDefaultsAndTargetTyping.Parent build() { return new SuperBuilderWithDefaultsAndTargetTyping.Parent(this); } } @java.lang.SuppressWarnings("all") protected Parent(final SuperBuilderWithDefaultsAndTargetTyping.Parent.ParentBuilder b) { if (b.foo$set) this.foo = b.foo$value; else this.foo = SuperBuilderWithDefaultsAndTargetTyping.Parent.$default$foo(); } @java.lang.SuppressWarnings("all") public static SuperBuilderWithDefaultsAndTargetTyping.Parent.ParentBuilder builder() { return new SuperBuilderWithDefaultsAndTargetTyping.Parent.ParentBuilderImpl(); } } public static class Child extends Parent { private String foo; @java.lang.SuppressWarnings("all") private static String $default$foo() { return doSth(Arrays.asList(1), Arrays.asList('a')); } @java.lang.SuppressWarnings("all") public static abstract class ChildBuilder> extends Parent.ParentBuilder { @java.lang.SuppressWarnings("all") private boolean foo$set; @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}. */ @java.lang.SuppressWarnings("all") public B foo(final String foo) { this.foo$value = foo; foo$set = true; return self(); } @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { return "SuperBuilderWithDefaultsAndTargetTyping.Child.ChildBuilder(super=" + super.toString() + ", foo$value=" + this.foo$value + ")"; } } @java.lang.SuppressWarnings("all") private static final class ChildBuilderImpl extends SuperBuilderWithDefaultsAndTargetTyping.Child.ChildBuilder { @java.lang.SuppressWarnings("all") private ChildBuilderImpl() { } @java.lang.Override @java.lang.SuppressWarnings("all") protected SuperBuilderWithDefaultsAndTargetTyping.Child.ChildBuilderImpl self() { return this; } @java.lang.Override @java.lang.SuppressWarnings("all") public SuperBuilderWithDefaultsAndTargetTyping.Child build() { return new SuperBuilderWithDefaultsAndTargetTyping.Child(this); } } @java.lang.SuppressWarnings("all") protected Child(final SuperBuilderWithDefaultsAndTargetTyping.Child.ChildBuilder b) { super(b); if (b.foo$set) this.foo = b.foo$value; else this.foo = SuperBuilderWithDefaultsAndTargetTyping.Child.$default$foo(); } @java.lang.SuppressWarnings("all") public static SuperBuilderWithDefaultsAndTargetTyping.Child.ChildBuilder builder() { return new SuperBuilderWithDefaultsAndTargetTyping.Child.ChildBuilderImpl(); } } static String doSth(java.util.List i, java.util.List c) { return null; } }