aboutsummaryrefslogtreecommitdiff
path: root/test/transform/resource/after-delombok/SuperBuilderSingularCustomized.java
diff options
context:
space:
mode:
authorJan Rieke <rieke@subshell.com>2021-03-12 11:51:18 +0100
committerJan Rieke <rieke@subshell.com>2021-03-12 11:51:18 +0100
commit14f861b5f1c49d9ccc2eb0cda088753e6b63d349 (patch)
treeb5a3cd1dc17cbf7ad85c4c4c5da40889da8f873a /test/transform/resource/after-delombok/SuperBuilderSingularCustomized.java
parentf8c16ed8ac69d0106a845ca96573557700b6f39d (diff)
downloadlombok-14f861b5f1c49d9ccc2eb0cda088753e6b63d349.tar.gz
lombok-14f861b5f1c49d9ccc2eb0cda088753e6b63d349.tar.bz2
lombok-14f861b5f1c49d9ccc2eb0cda088753e6b63d349.zip
[fixes #2701] fix NPE on customized SuperBuilder with Singular
Diffstat (limited to 'test/transform/resource/after-delombok/SuperBuilderSingularCustomized.java')
-rw-r--r--test/transform/resource/after-delombok/SuperBuilderSingularCustomized.java77
1 files changed, 77 insertions, 0 deletions
diff --git a/test/transform/resource/after-delombok/SuperBuilderSingularCustomized.java b/test/transform/resource/after-delombok/SuperBuilderSingularCustomized.java
new file mode 100644
index 00000000..04cfd9f2
--- /dev/null
+++ b/test/transform/resource/after-delombok/SuperBuilderSingularCustomized.java
@@ -0,0 +1,77 @@
+import java.util.Set;
+class SuperBuilderSingularCustomized {
+ private Set<String> foos;
+ public static abstract class SuperBuilderSingularCustomizedBuilder<C extends SuperBuilderSingularCustomized, B extends SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilder<C, B>> {
+ @java.lang.SuppressWarnings("all")
+ private java.util.ArrayList<String> foos;
+ public B custom(final String value) {
+ return self();
+ }
+ @java.lang.SuppressWarnings("all")
+ protected abstract B self();
+ @java.lang.SuppressWarnings("all")
+ public abstract C build();
+ @java.lang.SuppressWarnings("all")
+ public B foo(final String foo) {
+ if (this.foos == null) this.foos = new java.util.ArrayList<String>();
+ this.foos.add(foo);
+ return self();
+ }
+ @java.lang.SuppressWarnings("all")
+ public B foos(final java.util.Collection<? extends String> foos) {
+ if (foos == null) {
+ throw new java.lang.NullPointerException("foos cannot be null");
+ }
+ if (this.foos == null) this.foos = new java.util.ArrayList<String>();
+ this.foos.addAll(foos);
+ return self();
+ }
+ @java.lang.SuppressWarnings("all")
+ public B clearFoos() {
+ if (this.foos != null) this.foos.clear();
+ return self();
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilder(foos=" + this.foos + ")";
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ private static final class SuperBuilderSingularCustomizedBuilderImpl extends SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilder<SuperBuilderSingularCustomized, SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilderImpl> {
+ @java.lang.SuppressWarnings("all")
+ private SuperBuilderSingularCustomizedBuilderImpl() {
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ protected SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilderImpl self() {
+ return this;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public SuperBuilderSingularCustomized build() {
+ return new SuperBuilderSingularCustomized(this);
+ }
+ }
+ @java.lang.SuppressWarnings("all")
+ protected SuperBuilderSingularCustomized(final SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilder<?, ?> b) {
+ java.util.Set<String> foos;
+ switch (b.foos == null ? 0 : b.foos.size()) {
+ case 0:
+ foos = java.util.Collections.emptySet();
+ break;
+ case 1:
+ foos = java.util.Collections.singleton(b.foos.get(0));
+ break;
+ default:
+ foos = new java.util.LinkedHashSet<String>(b.foos.size() < 1073741824 ? 1 + b.foos.size() + (b.foos.size() - 3) / 3 : java.lang.Integer.MAX_VALUE);
+ foos.addAll(b.foos);
+ foos = java.util.Collections.unmodifiableSet(foos);
+ }
+ this.foos = foos;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilder<?, ?> builder() {
+ return new SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilderImpl();
+ }
+} \ No newline at end of file