aboutsummaryrefslogtreecommitdiff
path: root/test/transform/resource/after-ecj/SuperBuilderSingularCustomized.java
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2021-03-21 05:12:12 +0100
committerGitHub <noreply@github.com>2021-03-21 05:12:12 +0100
commite9e16a355f9f83e85291fa895ad944411606b1d6 (patch)
tree8c233853ec39760af3b9794f810c3a7682266ee2 /test/transform/resource/after-ecj/SuperBuilderSingularCustomized.java
parent38faf6d350d0e4749039538bdc201624cd2f1ecb (diff)
parent14f861b5f1c49d9ccc2eb0cda088753e6b63d349 (diff)
downloadlombok-e9e16a355f9f83e85291fa895ad944411606b1d6.tar.gz
lombok-e9e16a355f9f83e85291fa895ad944411606b1d6.tar.bz2
lombok-e9e16a355f9f83e85291fa895ad944411606b1d6.zip
Merge pull request #2772 from janrieke/superBuilderNPEwithSingular
[fixes #2701] fix NPE on customized SuperBuilder with Singular
Diffstat (limited to 'test/transform/resource/after-ecj/SuperBuilderSingularCustomized.java')
-rw-r--r--test/transform/resource/after-ecj/SuperBuilderSingularCustomized.java70
1 files changed, 70 insertions, 0 deletions
diff --git a/test/transform/resource/after-ecj/SuperBuilderSingularCustomized.java b/test/transform/resource/after-ecj/SuperBuilderSingularCustomized.java
new file mode 100644
index 00000000..613edb03
--- /dev/null
+++ b/test/transform/resource/after-ecj/SuperBuilderSingularCustomized.java
@@ -0,0 +1,70 @@
+import java.util.Set;
+@lombok.experimental.SuperBuilder class SuperBuilderSingularCustomized {
+ public static abstract class SuperBuilderSingularCustomizedBuilder<C extends SuperBuilderSingularCustomized, B extends SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilder<C, B>> {
+ private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> foos;
+ public SuperBuilderSingularCustomizedBuilder() {
+ super();
+ }
+ public B custom(final String value) {
+ return self();
+ }
+ protected abstract @java.lang.SuppressWarnings("all") B self();
+ public abstract @java.lang.SuppressWarnings("all") C build();
+ public @java.lang.SuppressWarnings("all") B foo(final String foo) {
+ if ((this.foos == null))
+ this.foos = new java.util.ArrayList<String>();
+ this.foos.add(foo);
+ return self();
+ }
+ public @java.lang.SuppressWarnings("all") 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();
+ }
+ public @java.lang.SuppressWarnings("all") B clearFoos() {
+ if ((this.foos != null))
+ this.foos.clear();
+ return self();
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (("SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilder(foos=" + this.foos) + ")");
+ }
+ }
+ private static final @java.lang.SuppressWarnings("all") class SuperBuilderSingularCustomizedBuilderImpl extends SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilder<SuperBuilderSingularCustomized, SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilderImpl> {
+ private SuperBuilderSingularCustomizedBuilderImpl() {
+ super();
+ }
+ protected @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilderImpl self() {
+ return this;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") SuperBuilderSingularCustomized build() {
+ return new SuperBuilderSingularCustomized(this);
+ }
+ }
+ private @lombok.Singular Set<String> foos;
+ protected @java.lang.SuppressWarnings("all") SuperBuilderSingularCustomized(final SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilder<?, ?> b) {
+ super();
+ 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() < 0x40000000) ? ((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;
+ }
+ public static @java.lang.SuppressWarnings("all") SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilder<?, ?> builder() {
+ return new SuperBuilderSingularCustomized.SuperBuilderSingularCustomizedBuilderImpl();
+ }
+} \ No newline at end of file