//version 8: import java.util.List; class CheckerFrameworkSuperBuilder { public static class Parent { int x; int y; int z; List names; @java.lang.SuppressWarnings("all") private static int $default$x() { return 5; } @java.lang.SuppressWarnings("all") public static abstract class ParentBuilder> { @java.lang.SuppressWarnings("all") private boolean x$set; @java.lang.SuppressWarnings("all") private int x$value; @java.lang.SuppressWarnings("all") private int y; @java.lang.SuppressWarnings("all") private int z; @java.lang.SuppressWarnings("all") private java.util.ArrayList names; @org.checkerframework.common.returnsreceiver.qual.This @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") protected abstract 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 this); /** * @return {@code this}. */ @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") public B x(CheckerFrameworkSuperBuilder.Parent.@org.checkerframework.checker.calledmethods.qual.NotCalledMethods("x") ParentBuilder this, final int x) { this.x$value = x; x$set = true; return self(); } /** * @return {@code this}. */ @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") public B y(CheckerFrameworkSuperBuilder.Parent.@org.checkerframework.checker.calledmethods.qual.NotCalledMethods("y") ParentBuilder this, final int y) { this.y = y; return self(); } /** * @return {@code this}. */ @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") public B z(CheckerFrameworkSuperBuilder.Parent.@org.checkerframework.checker.calledmethods.qual.NotCalledMethods("z") ParentBuilder this, final int z) { this.z = z; return self(); } @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") public B name(final String name) { if (this.names == null) this.names = new java.util.ArrayList(); this.names.add(name); return self(); } @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") public B names(final java.util.Collection names) { if (names == null) { throw new java.lang.NullPointerException("names cannot be null"); } if (this.names == null) this.names = new java.util.ArrayList(); this.names.addAll(names); return self(); } @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") public B clearNames() { if (this.names != null) this.names.clear(); return self(); } @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { return "CheckerFrameworkSuperBuilder.Parent.ParentBuilder(x$value=" + this.x$value + ", y=" + this.y + ", z=" + this.z + ", names=" + this.names + ")"; } } @java.lang.SuppressWarnings("all") private static final class ParentBuilderImpl extends CheckerFrameworkSuperBuilder.Parent.ParentBuilder { @java.lang.SuppressWarnings("all") private ParentBuilderImpl() { } @java.lang.Override @org.checkerframework.common.returnsreceiver.qual.This @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") protected CheckerFrameworkSuperBuilder.Parent.ParentBuilderImpl self() { return this; } @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.Override @java.lang.SuppressWarnings("all") public CheckerFrameworkSuperBuilder.Parent build(CheckerFrameworkSuperBuilder.Parent.@org.checkerframework.checker.calledmethods.qual.CalledMethods({"y", "z"}) ParentBuilderImpl this) { return new CheckerFrameworkSuperBuilder.Parent(this); } } @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") protected Parent(final CheckerFrameworkSuperBuilder.Parent.ParentBuilder b) { if (b.x$set) this.x = b.x$value; else this.x = CheckerFrameworkSuperBuilder.Parent.$default$x(); this.y = b.y; this.z = b.z; java.util.List names; switch (b.names == null ? 0 : b.names.size()) { case 0: names = java.util.Collections.emptyList(); break; case 1: names = java.util.Collections.singletonList(b.names.get(0)); break; default: names = java.util.Collections.unmodifiableList(new java.util.ArrayList(b.names)); } this.names = names; } @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") public static CheckerFrameworkSuperBuilder.Parent.@org.checkerframework.common.aliasing.qual.Unique ParentBuilder builder() { return new CheckerFrameworkSuperBuilder.Parent.ParentBuilderImpl(); } } public static class ZChild extends Parent { int a; int b; @java.lang.SuppressWarnings("all") private static int $default$a() { return 1; } @java.lang.SuppressWarnings("all") public static abstract class ZChildBuilder> extends Parent.ParentBuilder { @java.lang.SuppressWarnings("all") private boolean a$set; @java.lang.SuppressWarnings("all") private int a$value; @java.lang.SuppressWarnings("all") private int b; @java.lang.Override @org.checkerframework.common.returnsreceiver.qual.This @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") protected abstract 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 this); /** * @return {@code this}. */ @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") public B a(CheckerFrameworkSuperBuilder.ZChild.@org.checkerframework.checker.calledmethods.qual.NotCalledMethods("a") ZChildBuilder this, final int a) { this.a$value = a; a$set = true; return self(); } /** * @return {@code this}. */ @org.checkerframework.common.returnsreceiver.qual.This @java.lang.SuppressWarnings("all") public B b(CheckerFrameworkSuperBuilder.ZChild.@org.checkerframework.checker.calledmethods.qual.NotCalledMethods("b") ZChildBuilder this, final int b) { this.b = b; return self(); } @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.Override @java.lang.SuppressWarnings("all") public java.lang.String toString() { return "CheckerFrameworkSuperBuilder.ZChild.ZChildBuilder(super=" + super.toString() + ", a$value=" + this.a$value + ", b=" + this.b + ")"; } } @java.lang.SuppressWarnings("all") private static final class ZChildBuilderImpl extends CheckerFrameworkSuperBuilder.ZChild.ZChildBuilder { @java.lang.SuppressWarnings("all") private ZChildBuilderImpl() { } @java.lang.Override @org.checkerframework.common.returnsreceiver.qual.This @org.checkerframework.dataflow.qual.Pure @java.lang.SuppressWarnings("all") protected CheckerFrameworkSuperBuilder.ZChild.ZChildBuilderImpl self() { return this; } @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.Override @java.lang.SuppressWarnings("all") public CheckerFrameworkSuperBuilder.ZChild build(CheckerFrameworkSuperBuilder.ZChild.@org.checkerframework.checker.calledmethods.qual.CalledMethods("b") ZChildBuilderImpl this) { return new CheckerFrameworkSuperBuilder.ZChild(this); } } @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") protected ZChild(final CheckerFrameworkSuperBuilder.ZChild.ZChildBuilder b) { super(b); if (b.a$set) this.a = b.a$value; else this.a = CheckerFrameworkSuperBuilder.ZChild.$default$a(); this.b = b.b; } @org.checkerframework.dataflow.qual.SideEffectFree @java.lang.SuppressWarnings("all") public static CheckerFrameworkSuperBuilder.ZChild.@org.checkerframework.common.aliasing.qual.Unique ZChildBuilder builder() { return new CheckerFrameworkSuperBuilder.ZChild.ZChildBuilderImpl(); } } }