aboutsummaryrefslogtreecommitdiff
path: root/test/transform/resource
diff options
context:
space:
mode:
authorJan Rieke <rieke@subshell.com>2018-08-16 14:38:44 +0200
committerJan Rieke <rieke@subshell.com>2018-08-16 14:38:44 +0200
commitdbc173ba5c575eea404d3a76b3bc24d35656767c (patch)
tree15a8a41c722a7da7cd64adf8a944b0b4596f556b /test/transform/resource
parentc21adf7f47ed0077c53547a36041b1dba45bdcb8 (diff)
downloadlombok-dbc173ba5c575eea404d3a76b3bc24d35656767c.tar.gz
lombok-dbc173ba5c575eea404d3a76b3bc24d35656767c.tar.bz2
lombok-dbc173ba5c575eea404d3a76b3bc24d35656767c.zip
@SuperBuilder adapts @Builder.Default behavior from @Builder as #1347 is
fixed now (javac)
Diffstat (limited to 'test/transform/resource')
-rw-r--r--test/transform/resource/after-delombok/SuperBuilderWithDefaults.java27
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() {