diff options
author | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2020-01-31 06:33:33 +0100 |
---|---|---|
committer | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2020-01-31 06:33:33 +0100 |
commit | c42bfbae39990b365a5f05eb23895da6203023bc (patch) | |
tree | 6bbebbff773571debc5709072e735f2f42469d46 /test/transform/resource/after-ecj/BuilderSingularNullBehavior2.java | |
parent | d31182c4383a5ccc499862d2a8035d49e5202319 (diff) | |
download | lombok-c42bfbae39990b365a5f05eb23895da6203023bc.tar.gz lombok-c42bfbae39990b365a5f05eb23895da6203023bc.tar.bz2 lombok-c42bfbae39990b365a5f05eb23895da6203023bc.zip |
[issue #2221] simplified configuration for `@Singular`-generated plural form nullchecks.
Diffstat (limited to 'test/transform/resource/after-ecj/BuilderSingularNullBehavior2.java')
-rw-r--r-- | test/transform/resource/after-ecj/BuilderSingularNullBehavior2.java | 49 |
1 files changed, 7 insertions, 42 deletions
diff --git a/test/transform/resource/after-ecj/BuilderSingularNullBehavior2.java b/test/transform/resource/after-ecj/BuilderSingularNullBehavior2.java index 308a5174..85f9fb21 100644 --- a/test/transform/resource/after-ecj/BuilderSingularNullBehavior2.java +++ b/test/transform/resource/after-ecj/BuilderSingularNullBehavior2.java @@ -1,10 +1,8 @@ import java.util.List; import lombok.Singular; -import lombok.Singular.NullCollectionBehavior; @lombok.Builder class BuilderSingularNullBehavior2 { public static @java.lang.SuppressWarnings("all") class BuilderSingularNullBehavior2Builder { private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> locations; - private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> doohickeys; @java.lang.SuppressWarnings("all") BuilderSingularNullBehavior2Builder() { super(); } @@ -14,7 +12,7 @@ import lombok.Singular.NullCollectionBehavior; this.locations.add(location); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularNullBehavior2.BuilderSingularNullBehavior2Builder locations(final java.util. @org.checkerframework.checker.nullness.qual.NonNull Collection<? extends String> locations) { + public @java.lang.SuppressWarnings("all") BuilderSingularNullBehavior2.BuilderSingularNullBehavior2Builder locations(final @org.springframework.lang.NonNull java.util.Collection<? extends String> locations) { java.util.Objects.requireNonNull(locations, "locations cannot be null"); if ((this.locations == null)) this.locations = new java.util.ArrayList<String>(); @@ -26,26 +24,6 @@ import lombok.Singular.NullCollectionBehavior; this.locations.clear(); return this; } - public @java.lang.SuppressWarnings("all") BuilderSingularNullBehavior2.BuilderSingularNullBehavior2Builder doohickey(final String doohickey) { - if ((this.doohickeys == null)) - this.doohickeys = new java.util.ArrayList<String>(); - this.doohickeys.add(doohickey); - return this; - } - public @java.lang.SuppressWarnings("all") BuilderSingularNullBehavior2.BuilderSingularNullBehavior2Builder doohickeys(final java.util. @org.checkerframework.checker.nullness.qual.Nullable Collection<? extends String> doohickeys) { - if ((doohickeys != null)) - { - if ((this.doohickeys == null)) - this.doohickeys = new java.util.ArrayList<String>(); - this.doohickeys.addAll(doohickeys); - } - return this; - } - public @java.lang.SuppressWarnings("all") BuilderSingularNullBehavior2.BuilderSingularNullBehavior2Builder clearDoohickeys() { - if ((this.doohickeys != null)) - this.doohickeys.clear(); - return this; - } public @java.lang.SuppressWarnings("all") BuilderSingularNullBehavior2 build() { java.util.List<String> locations; switch (((this.locations == null) ? 0 : this.locations.size())) { @@ -58,31 +36,18 @@ import lombok.Singular.NullCollectionBehavior; default : locations = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.locations)); } - java.util.List<String> doohickeys; - switch (((this.doohickeys == null) ? 0 : this.doohickeys.size())) { - case 0 : - doohickeys = java.util.Collections.emptyList(); - break; - case 1 : - doohickeys = java.util.Collections.singletonList(this.doohickeys.get(0)); - break; - default : - doohickeys = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.doohickeys)); - } - return new BuilderSingularNullBehavior2(locations, doohickeys); + return new BuilderSingularNullBehavior2(locations); } - public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.@org.checkerframework.checker.nullness.qual.NonNull String toString() { - return (((("BuilderSingularNullBehavior2.BuilderSingularNullBehavior2Builder(locations=" + this.locations) + ", doohickeys=") + this.doohickeys) + ")"); + public @java.lang.Override @org.springframework.lang.NonNull @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderSingularNullBehavior2.BuilderSingularNullBehavior2Builder(locations=" + this.locations) + ")"); } } - private @Singular(nullBehavior = Singular.NullCollectionBehavior.JDK) List<String> locations; - private @Singular(nullBehavior = lombok.Singular.NullCollectionBehavior.IGNORE) List<String> doohickeys; - @java.lang.SuppressWarnings("all") BuilderSingularNullBehavior2(final List<String> locations, final List<String> doohickeys) { + private @Singular List<String> locations; + @java.lang.SuppressWarnings("all") BuilderSingularNullBehavior2(final List<String> locations) { super(); this.locations = locations; - this.doohickeys = doohickeys; } public static @java.lang.SuppressWarnings("all") BuilderSingularNullBehavior2.BuilderSingularNullBehavior2Builder builder() { return new BuilderSingularNullBehavior2.BuilderSingularNullBehavior2Builder(); } -} +}
\ No newline at end of file |