From d6057f8eb7d38994dc94645c55979f0f8a2233fa Mon Sep 17 00:00:00 2001 From: Jan Rieke Date: Fri, 12 Oct 2018 09:06:34 +0200 Subject: fixed toBuilder on Singular fields with wildcards (javac) --- .../BuilderSingularWildcardListsWithToBuilder.java | 94 ++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilder.java (limited to 'test/transform/resource/after-delombok') diff --git a/test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilder.java b/test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilder.java new file mode 100644 index 00000000..509d0394 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilder.java @@ -0,0 +1,94 @@ +import java.util.List; +import java.util.Collection; +class BuilderSingularWildcardListsWithToBuilder { + private List objects; + private Collection numbers; + @java.lang.SuppressWarnings("all") + BuilderSingularWildcardListsWithToBuilder(final List objects, final Collection numbers) { + this.objects = objects; + this.numbers = numbers; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSingularWildcardListsWithToBuilderBuilder { + @java.lang.SuppressWarnings("all") + private java.util.ArrayList objects; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList numbers; + @java.lang.SuppressWarnings("all") + BuilderSingularWildcardListsWithToBuilderBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWildcardListsWithToBuilderBuilder object(final java.lang.Object object) { + if (this.objects == null) this.objects = new java.util.ArrayList(); + this.objects.add(object); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWildcardListsWithToBuilderBuilder objects(final java.util.Collection objects) { + if (this.objects == null) this.objects = new java.util.ArrayList(); + this.objects.addAll(objects); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWildcardListsWithToBuilderBuilder clearObjects() { + if (this.objects != null) this.objects.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWildcardListsWithToBuilderBuilder number(final Number number) { + if (this.numbers == null) this.numbers = new java.util.ArrayList(); + this.numbers.add(number); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWildcardListsWithToBuilderBuilder numbers(final java.util.Collection numbers) { + if (this.numbers == null) this.numbers = new java.util.ArrayList(); + this.numbers.addAll(numbers); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWildcardListsWithToBuilderBuilder clearNumbers() { + if (this.numbers != null) this.numbers.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWildcardListsWithToBuilder build() { + java.util.List objects; + switch (this.objects == null ? 0 : this.objects.size()) { + case 0: + objects = java.util.Collections.emptyList(); + break; + case 1: + objects = java.util.Collections.singletonList(this.objects.get(0)); + break; + default: + objects = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.objects)); + } + java.util.Collection numbers; + switch (this.numbers == null ? 0 : this.numbers.size()) { + case 0: + numbers = java.util.Collections.emptyList(); + break; + case 1: + numbers = java.util.Collections.singletonList(this.numbers.get(0)); + break; + default: + numbers = java.util.Collections.unmodifiableList(new java.util.ArrayList(this.numbers)); + } + return new BuilderSingularWildcardListsWithToBuilder(objects, numbers); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingularWildcardListsWithToBuilder.BuilderSingularWildcardListsWithToBuilderBuilder(objects=" + this.objects + ", numbers=" + this.numbers + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderSingularWildcardListsWithToBuilderBuilder builder() { + return new BuilderSingularWildcardListsWithToBuilderBuilder(); + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWildcardListsWithToBuilderBuilder toBuilder() { + return new BuilderSingularWildcardListsWithToBuilderBuilder().objects(this.objects == null ? java.util.Collections.emptyList() : this.objects).numbers(this.numbers == null ? java.util.Collections.emptyList() : this.numbers); + } +} -- cgit