[Fixes #2115] builder fields tracking a property that has a default set is now called $value in order to convey that you shouldnt manually mess with it.

This commit is contained in:
Reinier Zwitserloot committed 2019-07-16 01:24:18 +02:00
1 parent b3824c9dc1
commit b439e4ce77
23 files changed
+208 -176

No files matched your search

@@ -2,9 +2,9 @@ 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 Parent<N>, B extends ParentBuilder<N, C, B>> {
private @java.lang.SuppressWarnings("all") long millis;
private @java.lang.SuppressWarnings("all") long millis$value;
private @java.lang.SuppressWarnings("all") boolean millis$set;
private @java.lang.SuppressWarnings("all") N numberField;
private @java.lang.SuppressWarnings("all") N numberField$value;
private @java.lang.SuppressWarnings("all") boolean numberField$set;
public ParentBuilder() {
super();
@@ -12,17 +12,17 @@ public class SuperBuilderWithDefaults {
protected abstract @java.lang.SuppressWarnings("all") B self();
public abstract @java.lang.SuppressWarnings("all") C build();
public @java.lang.SuppressWarnings("all") B millis(final long millis) {
this.millis = millis;
this.millis$value = millis;
millis$set = true;
return self();
}
public @java.lang.SuppressWarnings("all") B numberField(final N numberField) {
this.numberField = 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=" + this.millis) + ", numberField=") + this.numberField) + ")");
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 ParentBuilder<N, Parent<N>, ParentBuilderImpl<N>> {
@@ -47,11 +47,11 @@ public class SuperBuilderWithDefaults {
protected @java.lang.SuppressWarnings("all") Parent(final ParentBuilder<N, ?, ?> b) {
super();
if (b.millis$set)
this.millis = b.millis;
this.millis = b.millis$value;
else
this.millis = Parent.<N>$default$millis();
if (b.numberField$set)
this.numberField = b.numberField;
this.numberField = b.numberField$value;
else
this.numberField = Parent.<N>$default$numberField();
}
@@ -61,7 +61,7 @@ public class SuperBuilderWithDefaults {
}
public static @lombok.experimental.SuperBuilder class Child extends Parent<Integer> {
public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder<C extends Child, B extends ChildBuilder<C, B>> extends Parent.ParentBuilder<Integer, C, B> {
private @java.lang.SuppressWarnings("all") double doubleField;
private @java.lang.SuppressWarnings("all") double doubleField$value;
private @java.lang.SuppressWarnings("all") boolean doubleField$set;
public ChildBuilder() {
super();
@@ -69,12 +69,12 @@ public class SuperBuilderWithDefaults {
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.SuppressWarnings("all") B doubleField(final double doubleField) {
this.doubleField = 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=") + this.doubleField) + ")");
return (((("SuperBuilderWithDefaults.Child.ChildBuilder(super=" + super.toString()) + ", doubleField$value=") + this.doubleField$value) + ")");
}
}
private static final @java.lang.SuppressWarnings("all") class ChildBuilderImpl extends ChildBuilder<Child, ChildBuilderImpl> {
@@ -95,7 +95,7 @@ public class SuperBuilderWithDefaults {
protected @java.lang.SuppressWarnings("all") Child(final ChildBuilder<?, ?> b) {
super(b);
if (b.doubleField$set)
this.doubleField = b.doubleField;
this.doubleField = b.doubleField$value;
else
this.doubleField = Child.$default$doubleField();
}