aboutsummaryrefslogtreecommitdiff
path: root/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNull.java
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2018-10-15 21:12:45 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2018-10-15 21:16:03 +0200
commit94eadb5131b32b6cf599a3f5445524a08ba0569b (patch)
tree391e310ec42d25e9ee26bbff57290d492da23f51 /test/transform/resource/after-delombok/BuilderSingularToBuilderWithNull.java
parent06455de367932e93da707b9d91e1a347d0c072a6 (diff)
downloadlombok-94eadb5131b32b6cf599a3f5445524a08ba0569b.tar.gz
lombok-94eadb5131b32b6cf599a3f5445524a08ba0569b.tar.bz2
lombok-94eadb5131b32b6cf599a3f5445524a08ba0569b.zip
[fixes #1324] toBuilder with @Singular marked collections that are null no longer throws NPE.
Diffstat (limited to 'test/transform/resource/after-delombok/BuilderSingularToBuilderWithNull.java')
-rw-r--r--test/transform/resource/after-delombok/BuilderSingularToBuilderWithNull.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNull.java b/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNull.java
index b0563858..96ffd2dc 100644
--- a/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNull.java
+++ b/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNull.java
@@ -58,6 +58,8 @@ class BuilderSingularToBuilderWithNull {
}
@java.lang.SuppressWarnings("all")
public BuilderSingularToBuilderWithNullBuilder toBuilder() {
- return new BuilderSingularToBuilderWithNullBuilder().elems(this.elems == null ? java.util.Collections.<String>emptyList() : this.elems);
+ final BuilderSingularToBuilderWithNullBuilder builder = new BuilderSingularToBuilderWithNullBuilder();
+ if (this.elems != null) builder.elems(this.elems);
+ return builder;
}
}