diff options
author | Jan Rieke <rieke@subshell.com> | 2018-08-16 14:38:44 +0200 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2018-08-27 21:23:11 +0200 |
commit | f072827630bfbdc548bc739fa979308cc2c4d3fb (patch) | |
tree | 2726270fb01887e3a2cd2e0b0d93130b5f5f192b /test | |
parent | 3f4f9e65520c91df59abbb03cdd91574d75ea197 (diff) | |
download | lombok-f072827630bfbdc548bc739fa979308cc2c4d3fb.tar.gz lombok-f072827630bfbdc548bc739fa979308cc2c4d3fb.tar.bz2 lombok-f072827630bfbdc548bc739fa979308cc2c4d3fb.zip |
@SuperBuilder adapts @Builder.Default behavior from @Builder as #1347 is
fixed now (javac)
Diffstat (limited to 'test')
-rw-r--r-- | test/transform/resource/after-delombok/SuperBuilderWithDefaults.java | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/test/transform/resource/after-delombok/SuperBuilderWithDefaults.java b/test/transform/resource/after-delombok/SuperBuilderWithDefaults.java index 7b6b4578..06d88f4d 100644 --- a/test/transform/resource/after-delombok/SuperBuilderWithDefaults.java +++ b/test/transform/resource/after-delombok/SuperBuilderWithDefaults.java @@ -1,8 +1,16 @@ import java.util.List;
public class SuperBuilderWithDefaults {
public static class Parent<N extends Number> {
- private long millis = System.currentTimeMillis();
- private N numberField = null;
+ private long millis;
+ private N numberField;
+ @java.lang.SuppressWarnings("all")
+ private static <N extends Number> long $default$millis() {
+ return System.currentTimeMillis();
+ }
+ @java.lang.SuppressWarnings("all")
+ private static <N extends Number> N $default$numberField() {
+ return null;
+ }
@java.lang.SuppressWarnings("all")
public static abstract class ParentBuilder<N extends Number, C extends Parent<N>, B extends ParentBuilder<N, C, B>> {
@java.lang.SuppressWarnings("all")
@@ -53,8 +61,10 @@ public class SuperBuilderWithDefaults { }
@java.lang.SuppressWarnings("all")
protected Parent(final ParentBuilder<N, ?, ?> b) {
- if (b.millis$set) this.millis = b.millis;
- if (b.numberField$set) this.numberField = b.numberField;
+ this.millis = b.millis;
+ if (!b.millis$set) this.millis = Parent.<N>$default$millis();
+ this.numberField = b.numberField;
+ if (!b.numberField$set) this.numberField = Parent.<N>$default$numberField();
}
@java.lang.SuppressWarnings("all")
public static <N extends Number> ParentBuilder<N, ?, ?> builder() {
@@ -62,7 +72,11 @@ public class SuperBuilderWithDefaults { }
}
public static class Child extends Parent<Integer> {
- private double doubleField = Math.PI;
+ private double doubleField;
+ @java.lang.SuppressWarnings("all")
+ private static double $default$doubleField() {
+ return Math.PI;
+ }
@java.lang.SuppressWarnings("all")
public static abstract class ChildBuilder<C extends Child, B extends ChildBuilder<C, B>> extends Parent.ParentBuilder<Integer, C, B> {
@java.lang.SuppressWarnings("all")
@@ -106,7 +120,8 @@ public class SuperBuilderWithDefaults { @java.lang.SuppressWarnings("all")
protected Child(final ChildBuilder<?, ?> b) {
super(b);
- if (b.doubleField$set) this.doubleField = b.doubleField;
+ this.doubleField = b.doubleField;
+ if (!b.doubleField$set) this.doubleField = Child.$default$doubleField();
}
@java.lang.SuppressWarnings("all")
public static ChildBuilder<?, ?> builder() {
|