From b439e4ce771813a12300c3006f9fcc12f25678d7 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Tue, 16 Jul 2019 01:24:18 +0200 Subject: [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. --- .../resource/after-ecj/BuilderDefaults.java | 12 ++++++------ .../after-ecj/BuilderDefaultsGenerics.java | 16 ++++++++-------- .../after-ecj/ConstructorsWithBuilderDefaults.java | 8 ++++---- .../ConstructorsWithBuilderDefaults2.java | 12 ++++++------ .../after-ecj/SuperBuilderWithDefaults.java | 22 +++++++++++----------- .../after-ecj/SuperBuilderWithNonNull.java | 8 ++++---- 6 files changed, 39 insertions(+), 39 deletions(-) (limited to 'test/transform/resource/after-ecj') diff --git a/test/transform/resource/after-ecj/BuilderDefaults.java b/test/transform/resource/after-ecj/BuilderDefaults.java index 1a0f1168..b9588386 100644 --- a/test/transform/resource/after-ecj/BuilderDefaults.java +++ b/test/transform/resource/after-ecj/BuilderDefaults.java @@ -2,16 +2,16 @@ import lombok.Builder; import lombok.Value; public final @Value @Builder class BuilderDefaults { public static @java.lang.SuppressWarnings("all") class BuilderDefaultsBuilder { - private @java.lang.SuppressWarnings("all") int x; + private @java.lang.SuppressWarnings("all") int x$value; private @java.lang.SuppressWarnings("all") boolean x$set; private @java.lang.SuppressWarnings("all") String name; - private @java.lang.SuppressWarnings("all") long z; + private @java.lang.SuppressWarnings("all") long z$value; private @java.lang.SuppressWarnings("all") boolean z$set; @java.lang.SuppressWarnings("all") BuilderDefaultsBuilder() { super(); } public @java.lang.SuppressWarnings("all") BuilderDefaultsBuilder x(final int x) { - this.x = x; + this.x$value = x; x$set = true; return this; } @@ -20,15 +20,15 @@ public final @Value @Builder class BuilderDefaults { return this; } public @java.lang.SuppressWarnings("all") BuilderDefaultsBuilder z(final long z) { - this.z = z; + this.z$value = z; z$set = true; return this; } public @java.lang.SuppressWarnings("all") BuilderDefaults build() { - return new BuilderDefaults((x$set ? x : BuilderDefaults.$default$x()), name, (z$set ? z : BuilderDefaults.$default$z())); + return new BuilderDefaults((x$set ? x$value : BuilderDefaults.$default$x()), name, (z$set ? z$value : BuilderDefaults.$default$z())); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((((("BuilderDefaults.BuilderDefaultsBuilder(x=" + this.x) + ", name=") + this.name) + ", z=") + this.z) + ")"); + return (((((("BuilderDefaults.BuilderDefaultsBuilder(x$value=" + this.x$value) + ", name=") + this.name) + ", z$value=") + this.z$value) + ")"); } } private final @Builder.Default int x; diff --git a/test/transform/resource/after-ecj/BuilderDefaultsGenerics.java b/test/transform/resource/after-ecj/BuilderDefaultsGenerics.java index a8f81afa..8f9da4b3 100644 --- a/test/transform/resource/after-ecj/BuilderDefaultsGenerics.java +++ b/test/transform/resource/after-ecj/BuilderDefaultsGenerics.java @@ -2,35 +2,35 @@ import lombok.Builder; import java.util.*; public @Builder class BuilderDefaultsGenerics> { public static @java.lang.SuppressWarnings("all") class BuilderDefaultsGenericsBuilder> { - private @java.lang.SuppressWarnings("all") java.util.concurrent.Callable callable; + private @java.lang.SuppressWarnings("all") java.util.concurrent.Callable callable$value; private @java.lang.SuppressWarnings("all") boolean callable$set; - private @java.lang.SuppressWarnings("all") T tee; + private @java.lang.SuppressWarnings("all") T tee$value; private @java.lang.SuppressWarnings("all") boolean tee$set; - private @java.lang.SuppressWarnings("all") R arrr; + private @java.lang.SuppressWarnings("all") R arrr$value; private @java.lang.SuppressWarnings("all") boolean arrr$set; @java.lang.SuppressWarnings("all") BuilderDefaultsGenericsBuilder() { super(); } public @java.lang.SuppressWarnings("all") BuilderDefaultsGenericsBuilder callable(final java.util.concurrent.Callable callable) { - this.callable = callable; + this.callable$value = callable; callable$set = true; return this; } public @java.lang.SuppressWarnings("all") BuilderDefaultsGenericsBuilder tee(final T tee) { - this.tee = tee; + this.tee$value = tee; tee$set = true; return this; } public @java.lang.SuppressWarnings("all") BuilderDefaultsGenericsBuilder arrr(final R arrr) { - this.arrr = arrr; + this.arrr$value = arrr; arrr$set = true; return this; } public @java.lang.SuppressWarnings("all") BuilderDefaultsGenerics build() { - return new BuilderDefaultsGenerics((callable$set ? callable : BuilderDefaultsGenerics.$default$callable()), (tee$set ? tee : BuilderDefaultsGenerics.$default$tee()), (arrr$set ? arrr : BuilderDefaultsGenerics.$default$arrr())); + return new BuilderDefaultsGenerics((callable$set ? callable$value : BuilderDefaultsGenerics.$default$callable()), (tee$set ? tee$value : BuilderDefaultsGenerics.$default$tee()), (arrr$set ? arrr$value : BuilderDefaultsGenerics.$default$arrr())); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((((("BuilderDefaultsGenerics.BuilderDefaultsGenericsBuilder(callable=" + this.callable) + ", tee=") + this.tee) + ", arrr=") + this.arrr) + ")"); + return (((((("BuilderDefaultsGenerics.BuilderDefaultsGenericsBuilder(callable$value=" + this.callable$value) + ", tee$value=") + this.tee$value) + ", arrr$value=") + this.arrr$value) + ")"); } } private @Builder.Default java.util.concurrent.Callable callable; diff --git a/test/transform/resource/after-ecj/ConstructorsWithBuilderDefaults.java b/test/transform/resource/after-ecj/ConstructorsWithBuilderDefaults.java index 9d4c42c1..fd860c69 100644 --- a/test/transform/resource/after-ecj/ConstructorsWithBuilderDefaults.java +++ b/test/transform/resource/after-ecj/ConstructorsWithBuilderDefaults.java @@ -4,14 +4,14 @@ import lombok.Value; import lombok.Builder; final @NoArgsConstructor(force = true) @AllArgsConstructor @Builder @Value class ConstructorsWithBuilderDefaults { public static @java.lang.SuppressWarnings("all") class ConstructorsWithBuilderDefaultsBuilder { - private @java.lang.SuppressWarnings("all") int x; + private @java.lang.SuppressWarnings("all") int x$value; private @java.lang.SuppressWarnings("all") boolean x$set; private @java.lang.SuppressWarnings("all") int y; @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaultsBuilder() { super(); } public @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaultsBuilder x(final int x) { - this.x = x; + this.x$value = x; x$set = true; return this; } @@ -20,10 +20,10 @@ final @NoArgsConstructor(force = true) @AllArgsConstructor @Builder @Value class return this; } public @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaults build() { - return new ConstructorsWithBuilderDefaults((x$set ? x : ConstructorsWithBuilderDefaults.$default$x()), y); + return new ConstructorsWithBuilderDefaults((x$set ? x$value : ConstructorsWithBuilderDefaults.$default$x()), y); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((("ConstructorsWithBuilderDefaults.ConstructorsWithBuilderDefaultsBuilder(x=" + this.x) + ", y=") + this.y) + ")"); + return (((("ConstructorsWithBuilderDefaults.ConstructorsWithBuilderDefaultsBuilder(x$value=" + this.x$value) + ", y=") + this.y) + ")"); } } private final @Builder.Default int x; diff --git a/test/transform/resource/after-ecj/ConstructorsWithBuilderDefaults2.java b/test/transform/resource/after-ecj/ConstructorsWithBuilderDefaults2.java index cc96c674..776899fb 100644 --- a/test/transform/resource/after-ecj/ConstructorsWithBuilderDefaults2.java +++ b/test/transform/resource/after-ecj/ConstructorsWithBuilderDefaults2.java @@ -3,21 +3,21 @@ import lombok.Value; import lombok.Builder; final @Builder @Value class ConstructorsWithBuilderDefaults { public static @java.lang.SuppressWarnings("all") class ConstructorsWithBuilderDefaultsBuilder { - private @java.lang.SuppressWarnings("all") java.util.List z; + private @java.lang.SuppressWarnings("all") java.util.List z$value; private @java.lang.SuppressWarnings("all") boolean z$set; - private @java.lang.SuppressWarnings("all") T x; + private @java.lang.SuppressWarnings("all") T x$value; private @java.lang.SuppressWarnings("all") boolean x$set; private @java.lang.SuppressWarnings("all") T q; @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaultsBuilder() { super(); } public @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaultsBuilder z(final java.util.List z) { - this.z = z; + this.z$value = z; z$set = true; return this; } public @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaultsBuilder x(final T x) { - this.x = x; + this.x$value = x; x$set = true; return this; } @@ -26,10 +26,10 @@ final @Builder @Value class ConstructorsWithBuilderDefaults { return this; } public @java.lang.SuppressWarnings("all") ConstructorsWithBuilderDefaults build() { - return new ConstructorsWithBuilderDefaults((z$set ? z : ConstructorsWithBuilderDefaults.$default$z()), (x$set ? x : ConstructorsWithBuilderDefaults.$default$x()), q); + return new ConstructorsWithBuilderDefaults((z$set ? z$value : ConstructorsWithBuilderDefaults.$default$z()), (x$set ? x$value : ConstructorsWithBuilderDefaults.$default$x()), q); } public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { - return (((((("ConstructorsWithBuilderDefaults.ConstructorsWithBuilderDefaultsBuilder(z=" + this.z) + ", x=") + this.x) + ", q=") + this.q) + ")"); + return (((((("ConstructorsWithBuilderDefaults.ConstructorsWithBuilderDefaultsBuilder(z$value=" + this.z$value) + ", x$value=") + this.x$value) + ", q=") + this.q) + ")"); } } private final @Builder.Default java.util.List z; diff --git a/test/transform/resource/after-ecj/SuperBuilderWithDefaults.java b/test/transform/resource/after-ecj/SuperBuilderWithDefaults.java index e259b68d..ff1b5931 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithDefaults.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithDefaults.java @@ -2,9 +2,9 @@ import java.util.List; public class SuperBuilderWithDefaults { public static @lombok.experimental.SuperBuilder class Parent { public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder, B extends ParentBuilder> { - 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 extends ParentBuilder, ParentBuilderImpl> { @@ -47,11 +47,11 @@ public class SuperBuilderWithDefaults { protected @java.lang.SuppressWarnings("all") Parent(final ParentBuilder b) { super(); if (b.millis$set) - this.millis = b.millis; + this.millis = b.millis$value; else this.millis = Parent.$default$millis(); if (b.numberField$set) - this.numberField = b.numberField; + this.numberField = b.numberField$value; else this.numberField = Parent.$default$numberField(); } @@ -61,7 +61,7 @@ public class SuperBuilderWithDefaults { } public static @lombok.experimental.SuperBuilder class Child extends Parent { public static abstract @java.lang.SuppressWarnings("all") class ChildBuilder> extends Parent.ParentBuilder { - 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 { @@ -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(); } diff --git a/test/transform/resource/after-ecj/SuperBuilderWithNonNull.java b/test/transform/resource/after-ecj/SuperBuilderWithNonNull.java index 616d7083..31198ee1 100644 --- a/test/transform/resource/after-ecj/SuperBuilderWithNonNull.java +++ b/test/transform/resource/after-ecj/SuperBuilderWithNonNull.java @@ -2,7 +2,7 @@ import java.util.List; public class SuperBuilderWithNonNull { public static @lombok.experimental.SuperBuilder class Parent { public static abstract @java.lang.SuppressWarnings("all") class ParentBuilder> { - private @java.lang.SuppressWarnings("all") String nonNullParentField; + private @java.lang.SuppressWarnings("all") String nonNullParentField$value; private @java.lang.SuppressWarnings("all") boolean nonNullParentField$set; public ParentBuilder() { super(); @@ -14,12 +14,12 @@ public class SuperBuilderWithNonNull { { throw new java.lang.NullPointerException("nonNullParentField is marked non-null but is null"); } - this.nonNullParentField = nonNullParentField; + 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=" + this.nonNullParentField) + ")"); + return (("SuperBuilderWithNonNull.Parent.ParentBuilder(nonNullParentField$value=" + this.nonNullParentField$value) + ")"); } } private static final @java.lang.SuppressWarnings("all") class ParentBuilderImpl extends ParentBuilder { @@ -40,7 +40,7 @@ public class SuperBuilderWithNonNull { protected @java.lang.SuppressWarnings("all") Parent(final ParentBuilder b) { super(); if (b.nonNullParentField$set) - this.nonNullParentField = b.nonNullParentField; + this.nonNullParentField = b.nonNullParentField$value; else this.nonNullParentField = Parent.$default$nonNullParentField(); if ((nonNullParentField == null)) -- cgit