diff options
Diffstat (limited to 'test/transform')
26 files changed, 1602 insertions, 2 deletions
diff --git a/test/transform/resource/after-delombok/BuilderSingularGuavaListsSets.java b/test/transform/resource/after-delombok/BuilderSingularGuavaListsSets.java new file mode 100644 index 00000000..3fc969ef --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularGuavaListsSets.java @@ -0,0 +1,93 @@ +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableCollection; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.ImmutableSortedSet; +class BuilderSingularGuavaListsSets<T> { + private ImmutableList<T> cards; + private ImmutableCollection<? extends Number> frogs; + @SuppressWarnings("all") + private ImmutableSet rawSet; + private ImmutableSortedSet<String> passes; + @java.lang.SuppressWarnings("all") + BuilderSingularGuavaListsSets(final ImmutableList<T> cards, final ImmutableCollection<? extends Number> frogs, final ImmutableSet rawSet, final ImmutableSortedSet<String> passes) { + this.cards = cards; + this.frogs = frogs; + this.rawSet = rawSet; + this.passes = passes; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSingularGuavaListsSetsBuilder<T> { + private com.google.common.collect.ImmutableList.Builder<T> cards; + private com.google.common.collect.ImmutableList.Builder<Number> frogs; + private com.google.common.collect.ImmutableSet.Builder<java.lang.Object> rawSet; + private com.google.common.collect.ImmutableSortedSet.Builder<String> passes; + @java.lang.SuppressWarnings("all") + BuilderSingularGuavaListsSetsBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder<T> card(final T card) { + if (this.cards == null) this.cards = com.google.common.collect.ImmutableList.builder(); + this.cards.add(card); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder<T> cards(final java.lang.Iterable<? extends T> cards) { + if (this.cards == null) this.cards = com.google.common.collect.ImmutableList.builder(); + this.cards.addAll(cards); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder<T> frog(final Number frog) { + if (this.frogs == null) this.frogs = com.google.common.collect.ImmutableList.builder(); + this.frogs.add(frog); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder<T> frogs(final java.lang.Iterable<? extends Number> frogs) { + if (this.frogs == null) this.frogs = com.google.common.collect.ImmutableList.builder(); + this.frogs.addAll(frogs); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder<T> rawSet(final java.lang.Object rawSet) { + if (this.rawSet == null) this.rawSet = com.google.common.collect.ImmutableSet.builder(); + this.rawSet.add(rawSet); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder<T> rawSet(final java.lang.Iterable<?> rawSet) { + if (this.rawSet == null) this.rawSet = com.google.common.collect.ImmutableSet.builder(); + this.rawSet.addAll(rawSet); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder<T> pass(final String pass) { + if (this.passes == null) this.passes = com.google.common.collect.ImmutableSortedSet.naturalOrder(); + this.passes.add(pass); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder<T> passes(final java.lang.Iterable<? extends String> passes) { + if (this.passes == null) this.passes = com.google.common.collect.ImmutableSortedSet.naturalOrder(); + this.passes.addAll(passes); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSets<T> build() { + com.google.common.collect.ImmutableList<T> cards = this.cards == null ? com.google.common.collect.ImmutableList.of() : this.cards.build(); + com.google.common.collect.ImmutableCollection<Number> frogs = this.frogs == null ? com.google.common.collect.ImmutableList.of() : this.frogs.build(); + com.google.common.collect.ImmutableSet<java.lang.Object> rawSet = this.rawSet == null ? com.google.common.collect.ImmutableSet.of() : this.rawSet.build(); + com.google.common.collect.ImmutableSortedSet<String> passes = this.passes == null ? com.google.common.collect.ImmutableSortedSet.of() : this.passes.build(); + return new BuilderSingularGuavaListsSets<T>(cards, frogs, rawSet, passes); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder(cards=" + this.cards + ", frogs=" + this.frogs + ", rawSet=" + this.rawSet + ", passes=" + this.passes + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static <T> BuilderSingularGuavaListsSetsBuilder<T> builder() { + return new BuilderSingularGuavaListsSetsBuilder<T>(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/BuilderSingularGuavaMaps.java b/test/transform/resource/after-delombok/BuilderSingularGuavaMaps.java new file mode 100644 index 00000000..c55dff28 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularGuavaMaps.java @@ -0,0 +1,76 @@ +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableBiMap; +import com.google.common.collect.ImmutableSortedMap; +class BuilderSingularGuavaMaps<K, V> { + private ImmutableMap<K, V> battleaxes; + private ImmutableSortedMap<Integer, ? extends V> vertices; + @SuppressWarnings("all") + private ImmutableBiMap rawMap; + @java.lang.SuppressWarnings("all") + BuilderSingularGuavaMaps(final ImmutableMap<K, V> battleaxes, final ImmutableSortedMap<Integer, ? extends V> vertices, final ImmutableBiMap rawMap) { + this.battleaxes = battleaxes; + this.vertices = vertices; + this.rawMap = rawMap; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSingularGuavaMapsBuilder<K, V> { + private com.google.common.collect.ImmutableMap.Builder<K, V> battleaxes; + private com.google.common.collect.ImmutableSortedMap.Builder<Integer, V> vertices; + private com.google.common.collect.ImmutableBiMap.Builder<java.lang.Object, java.lang.Object> rawMap; + @java.lang.SuppressWarnings("all") + BuilderSingularGuavaMapsBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaMapsBuilder<K, V> battleaxe(final K battleaxe$key, final V battleaxe$value) { + if (this.battleaxes == null) this.battleaxes = com.google.common.collect.ImmutableMap.builder(); + this.battleaxes.put(battleaxe$key, battleaxe$value); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaMapsBuilder<K, V> battleaxes(final java.util.Map<? extends K, ? extends V> battleaxes) { + if (this.battleaxes == null) this.battleaxes = com.google.common.collect.ImmutableMap.builder(); + this.battleaxes.putAll(battleaxes); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaMapsBuilder<K, V> vertex(final Integer vertex$key, final V vertex$value) { + if (this.vertices == null) this.vertices = com.google.common.collect.ImmutableSortedMap.naturalOrder(); + this.vertices.put(vertex$key, vertex$value); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaMapsBuilder<K, V> vertices(final java.util.Map<? extends Integer, ? extends V> vertices) { + if (this.vertices == null) this.vertices = com.google.common.collect.ImmutableSortedMap.naturalOrder(); + this.vertices.putAll(vertices); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaMapsBuilder<K, V> rawMap(final java.lang.Object rawMap$key, final java.lang.Object rawMap$value) { + if (this.rawMap == null) this.rawMap = com.google.common.collect.ImmutableBiMap.builder(); + this.rawMap.put(rawMap$key, rawMap$value); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaMapsBuilder<K, V> rawMap(final java.util.Map<?, ?> rawMap) { + if (this.rawMap == null) this.rawMap = com.google.common.collect.ImmutableBiMap.builder(); + this.rawMap.putAll(rawMap); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaMaps<K, V> build() { + com.google.common.collect.ImmutableMap<K, V> battleaxes = this.battleaxes == null ? com.google.common.collect.ImmutableMap.of() : this.battleaxes.build(); + com.google.common.collect.ImmutableSortedMap<Integer, V> vertices = this.vertices == null ? com.google.common.collect.ImmutableSortedMap.of() : this.vertices.build(); + com.google.common.collect.ImmutableBiMap<java.lang.Object, java.lang.Object> rawMap = this.rawMap == null ? com.google.common.collect.ImmutableBiMap.of() : this.rawMap.build(); + return new BuilderSingularGuavaMaps<K, V>(battleaxes, vertices, rawMap); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingularGuavaMaps.BuilderSingularGuavaMapsBuilder(battleaxes=" + this.battleaxes + ", vertices=" + this.vertices + ", rawMap=" + this.rawMap + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static <K, V> BuilderSingularGuavaMapsBuilder<K, V> builder() { + return new BuilderSingularGuavaMapsBuilder<K, V>(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/BuilderSingularLists.java b/test/transform/resource/after-delombok/BuilderSingularLists.java new file mode 100644 index 00000000..aa5382c1 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularLists.java @@ -0,0 +1,111 @@ +import java.util.List; +import java.util.Collection; +class BuilderSingularLists<T> { + private List<T> children; + private Collection<? extends Number> scarves; + @SuppressWarnings("all") + private List rawList; + @java.lang.SuppressWarnings("all") + BuilderSingularLists(final List<T> children, final Collection<? extends Number> scarves, final List rawList) { + this.children = children; + this.scarves = scarves; + this.rawList = rawList; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSingularListsBuilder<T> { + private java.util.ArrayList<T> children; + private java.util.ArrayList<Number> scarves; + private java.util.ArrayList<java.lang.Object> rawList; + @java.lang.SuppressWarnings("all") + BuilderSingularListsBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularListsBuilder<T> child(final T child) { + if (this.children == null) this.children = new java.util.ArrayList<T>(); + this.children.add(child); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularListsBuilder<T> children(final java.util.Collection<? extends T> children) { + if (this.children == null) this.children = new java.util.ArrayList<T>(); + this.children.addAll(children); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularListsBuilder<T> scarf(final Number scarf) { + if (this.scarves == null) this.scarves = new java.util.ArrayList<Number>(); + this.scarves.add(scarf); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularListsBuilder<T> scarves(final java.util.Collection<? extends Number> scarves) { + if (this.scarves == null) this.scarves = new java.util.ArrayList<Number>(); + this.scarves.addAll(scarves); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularListsBuilder<T> rawList(final java.lang.Object rawList) { + if (this.rawList == null) this.rawList = new java.util.ArrayList<java.lang.Object>(); + this.rawList.add(rawList); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularListsBuilder<T> rawList(final java.util.Collection<?> rawList) { + if (this.rawList == null) this.rawList = new java.util.ArrayList<java.lang.Object>(); + this.rawList.addAll(rawList); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularLists<T> build() { + java.util.List<T> children; + switch (this.children == null ? 0 : this.children.size()) { + case 0: + children = java.util.Collections.emptyList(); + break; + case 1: + children = java.util.Collections.singletonList(this.children.get(0)); + break; + default: + children = new java.util.ArrayList<T>(this.children.size()); + children.addAll(this.children); + children = java.util.Collections.unmodifiableList(children); + } + java.util.List<Number> scarves; + switch (this.scarves == null ? 0 : this.scarves.size()) { + case 0: + scarves = java.util.Collections.emptyList(); + break; + case 1: + scarves = java.util.Collections.singletonList(this.scarves.get(0)); + break; + default: + scarves = new java.util.ArrayList<Number>(this.scarves.size()); + scarves.addAll(this.scarves); + scarves = java.util.Collections.unmodifiableList(scarves); + } + java.util.List<java.lang.Object> rawList; + switch (this.rawList == null ? 0 : this.rawList.size()) { + case 0: + rawList = java.util.Collections.emptyList(); + break; + case 1: + rawList = java.util.Collections.singletonList(this.rawList.get(0)); + break; + default: + rawList = new java.util.ArrayList<java.lang.Object>(this.rawList.size()); + rawList.addAll(this.rawList); + rawList = java.util.Collections.unmodifiableList(rawList); + } + return new BuilderSingularLists<T>(children, scarves, rawList); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingularLists.BuilderSingularListsBuilder(children=" + this.children + ", scarves=" + this.scarves + ", rawList=" + this.rawList + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static <T> BuilderSingularListsBuilder<T> builder() { + return new BuilderSingularListsBuilder<T>(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderSingularMaps.java b/test/transform/resource/after-delombok/BuilderSingularMaps.java new file mode 100644 index 00000000..640ddb94 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularMaps.java @@ -0,0 +1,173 @@ +import java.util.Map; +import java.util.SortedMap; +class BuilderSingularMaps<K, V> { + private Map<K, V> women; + private SortedMap<K, ? extends Number> men; + @SuppressWarnings("all") + private Map rawMap; + private Map<String, V> stringMap; + @java.lang.SuppressWarnings("all") + BuilderSingularMaps(final Map<K, V> women, final SortedMap<K, ? extends Number> men, final Map rawMap, final Map<String, V> stringMap) { + this.women = women; + this.men = men; + this.rawMap = rawMap; + this.stringMap = stringMap; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSingularMapsBuilder<K, V> { + private java.util.ArrayList<K> women$key; + private java.util.ArrayList<V> women$value; + private java.util.ArrayList<K> men$key; + private java.util.ArrayList<Number> men$value; + private java.util.ArrayList<java.lang.Object> rawMap$key; + private java.util.ArrayList<java.lang.Object> rawMap$value; + private java.util.ArrayList<String> stringMap$key; + private java.util.ArrayList<V> stringMap$value; + @java.lang.SuppressWarnings("all") + BuilderSingularMapsBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularMapsBuilder<K, V> woman(final K womanKey, final V womanValue) { + if (this.women$key == null) { + this.women$key = new java.util.ArrayList<K>(); + this.women$value = new java.util.ArrayList<V>(); + } + this.women$key.add(womanKey); + this.women$value.add(womanValue); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularMapsBuilder<K, V> women(final java.util.Map<? extends K, ? extends V> women) { + if (this.women$key == null) { + this.women$key = new java.util.ArrayList<K>(); + this.women$value = new java.util.ArrayList<V>(); + } + for (final java.util.Map.Entry<? extends K, ? extends V> $lombokEntry : women.entrySet()) { + this.women$key.add($lombokEntry.getKey()); + this.women$value.add($lombokEntry.getValue()); + } + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularMapsBuilder<K, V> man(final K manKey, final Number manValue) { + if (this.men$key == null) { + this.men$key = new java.util.ArrayList<K>(); + this.men$value = new java.util.ArrayList<Number>(); + } + this.men$key.add(manKey); + this.men$value.add(manValue); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularMapsBuilder<K, V> men(final java.util.Map<? extends K, ? extends Number> men) { + if (this.men$key == null) { + this.men$key = new java.util.ArrayList<K>(); + this.men$value = new java.util.ArrayList<Number>(); + } + for (final java.util.Map.Entry<? extends K, ? extends Number> $lombokEntry : men.entrySet()) { + this.men$key.add($lombokEntry.getKey()); + this.men$value.add($lombokEntry.getValue()); + } + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularMapsBuilder<K, V> rawMap(final java.lang.Object rawMapKey, final java.lang.Object rawMapValue) { + if (this.rawMap$key == null) { + this.rawMap$key = new java.util.ArrayList<java.lang.Object>(); + this.rawMap$value = new java.util.ArrayList<java.lang.Object>(); + } + this.rawMap$key.add(rawMapKey); + this.rawMap$value.add(rawMapValue); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularMapsBuilder<K, V> rawMap(final java.util.Map<?, ?> rawMap) { + if (this.rawMap$key == null) { + this.rawMap$key = new java.util.ArrayList<java.lang.Object>(); + this.rawMap$value = new java.util.ArrayList<java.lang.Object>(); + } + for (final java.util.Map.Entry<?, ?> $lombokEntry : rawMap.entrySet()) { + this.rawMap$key.add($lombokEntry.getKey()); + this.rawMap$value.add($lombokEntry.getValue()); + } + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularMapsBuilder<K, V> stringMap(final String stringMapKey, final V stringMapValue) { + if (this.stringMap$key == null) { + this.stringMap$key = new java.util.ArrayList<String>(); + this.stringMap$value = new java.util.ArrayList<V>(); + } + this.stringMap$key.add(stringMapKey); + this.stringMap$value.add(stringMapValue); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularMapsBuilder<K, V> stringMap(final java.util.Map<? extends String, ? extends V> stringMap) { + if (this.stringMap$key == null) { + this.stringMap$key = new java.util.ArrayList<String>(); + this.stringMap$value = new java.util.ArrayList<V>(); + } + for (final java.util.Map.Entry<? extends String, ? extends V> $lombokEntry : stringMap.entrySet()) { + this.stringMap$key.add($lombokEntry.getKey()); + this.stringMap$value.add($lombokEntry.getValue()); + } + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularMaps<K, V> build() { + java.util.Map<K, V> women; + switch (this.women$key == null ? 0 : this.women$key.size()) { + case 0: + women = java.util.Collections.emptyMap(); + break; + case 1: + women = java.util.Collections.singletonMap(this.women$key.get(0), this.women$value.get(0)); + break; + default: + women = new java.util.LinkedHashMap<K, V>(this.women$key.size() < 1073741824 ? 1 + this.women$key.size() + (this.women$key.size() - 3) / 3 : java.lang.Integer.MAX_VALUE); + for (int $i = 0; $i < this.women$key.size(); $i++) women.put(this.women$key.get($i), this.women$value.get($i)); + women = java.util.Collections.unmodifiableMap(women); + } + java.util.SortedMap<K, Number> men = new java.util.TreeMap<K, Number>(); + if (this.men$key != null) for (int $i = 0; $i < (this.men$key == null ? 0 : this.men$key.size()); $i++) men.put(this.men$key.get($i), this.men$value.get($i)); + men = java.util.Collections.unmodifiableSortedMap(men); + java.util.Map<java.lang.Object, java.lang.Object> rawMap; + switch (this.rawMap$key == null ? 0 : this.rawMap$key.size()) { + case 0: + rawMap = java.util.Collections.emptyMap(); + break; + case 1: + rawMap = java.util.Collections.singletonMap(this.rawMap$key.get(0), this.rawMap$value.get(0)); + break; + default: + rawMap = new java.util.LinkedHashMap<java.lang.Object, java.lang.Object>(this.rawMap$key.size() < 1073741824 ? 1 + this.rawMap$key.size() + (this.rawMap$key.size() - 3) / 3 : java.lang.Integer.MAX_VALUE); + for (int $i = 0; $i < this.rawMap$key.size(); $i++) rawMap.put(this.rawMap$key.get($i), this.rawMap$value.get($i)); + rawMap = java.util.Collections.unmodifiableMap(rawMap); + } + java.util.Map<String, V> stringMap; + switch (this.stringMap$key == null ? 0 : this.stringMap$key.size()) { + case 0: + stringMap = java.util.Collections.emptyMap(); + break; + case 1: + stringMap = java.util.Collections.singletonMap(this.stringMap$key.get(0), this.stringMap$value.get(0)); + break; + default: + stringMap = new java.util.LinkedHashMap<String, V>(this.stringMap$key.size() < 1073741824 ? 1 + this.stringMap$key.size() + (this.stringMap$key.size() - 3) / 3 : java.lang.Integer.MAX_VALUE); + for (int $i = 0; $i < this.stringMap$key.size(); $i++) stringMap.put(this.stringMap$key.get($i), this.stringMap$value.get($i)); + stringMap = java.util.Collections.unmodifiableMap(stringMap); + } + return new BuilderSingularMaps<K, V>(women, men, rawMap, stringMap); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingularMaps.BuilderSingularMapsBuilder(women$key=" + this.women$key + ", women$value=" + this.women$value + ", men$key=" + this.men$key + ", men$value=" + this.men$value + ", rawMap$key=" + this.rawMap$key + ", rawMap$value=" + this.rawMap$value + ", stringMap$key=" + this.stringMap$key + ", stringMap$value=" + this.stringMap$value + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static <K, V> BuilderSingularMapsBuilder<K, V> builder() { + return new BuilderSingularMapsBuilder<K, V>(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderSingularNoAutosingularize.java b/test/transform/resource/after-delombok/BuilderSingularNoAutosingularize.java new file mode 100644 index 00000000..07bbef9c --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularNoAutosingularize.java @@ -0,0 +1,109 @@ +import java.util.List; +class BuilderSingularNoAutosingularize { + private List<String> things; + private List<String> widgets; + private List<String> items; + @java.lang.SuppressWarnings("all") + BuilderSingularNoAutosingularize(final List<String> things, final List<String> widgets, final List<String> items) { + this.things = things; + this.widgets = widgets; + this.items = items; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSingularNoAutosingularizeBuilder { + private java.util.ArrayList<String> things; + private java.util.ArrayList<String> widgets; + private java.util.ArrayList<String> items; + @java.lang.SuppressWarnings("all") + BuilderSingularNoAutosingularizeBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularNoAutosingularizeBuilder things(final String things) { + if (this.things == null) this.things = new java.util.ArrayList<String>(); + this.things.add(things); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularNoAutosingularizeBuilder things(final java.util.Collection<? extends String> things) { + if (this.things == null) this.things = new java.util.ArrayList<String>(); + this.things.addAll(things); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularNoAutosingularizeBuilder widget(final String widget) { + if (this.widgets == null) this.widgets = new java.util.ArrayList<String>(); + this.widgets.add(widget); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularNoAutosingularizeBuilder widgets(final java.util.Collection<? extends String> widgets) { + if (this.widgets == null) this.widgets = new java.util.ArrayList<String>(); + this.widgets.addAll(widgets); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularNoAutosingularizeBuilder items(final String items) { + if (this.items == null) this.items = new java.util.ArrayList<String>(); + this.items.add(items); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularNoAutosingularizeBuilder items(final java.util.Collection<? extends String> items) { + if (this.items == null) this.items = new java.util.ArrayList<String>(); + this.items.addAll(items); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularNoAutosingularize build() { + java.util.List<String> things; + switch (this.things == null ? 0 : this.things.size()) { + case 0: + things = java.util.Collections.emptyList(); + break; + case 1: + things = java.util.Collections.singletonList(this.things.get(0)); + break; + default: + things = new java.util.ArrayList<String>(this.things.size()); + things.addAll(this.things); + things = java.util.Collections.unmodifiableList(things); + } + java.util.List<String> widgets; + switch (this.widgets == null ? 0 : this.widgets.size()) { + case 0: + widgets = java.util.Collections.emptyList(); + break; + case 1: + widgets = java.util.Collections.singletonList(this.widgets.get(0)); + break; + default: + widgets = new java.util.ArrayList<String>(this.widgets.size()); + widgets.addAll(this.widgets); + widgets = java.util.Collections.unmodifiableList(widgets); + } + java.util.List<String> items; + switch (this.items == null ? 0 : this.items.size()) { + case 0: + items = java.util.Collections.emptyList(); + break; + case 1: + items = java.util.Collections.singletonList(this.items.get(0)); + break; + default: + items = new java.util.ArrayList<String>(this.items.size()); + items.addAll(this.items); + items = java.util.Collections.unmodifiableList(items); + } + return new BuilderSingularNoAutosingularize(things, widgets, items); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingularNoAutosingularize.BuilderSingularNoAutosingularizeBuilder(things=" + this.things + ", widgets=" + this.widgets + ", items=" + this.items + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderSingularNoAutosingularizeBuilder builder() { + return new BuilderSingularNoAutosingularizeBuilder(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/BuilderSingularRedirectToGuava.java b/test/transform/resource/after-delombok/BuilderSingularRedirectToGuava.java new file mode 100644 index 00000000..84dc9a26 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularRedirectToGuava.java @@ -0,0 +1,75 @@ +import java.util.Set; +import java.util.NavigableMap; +import java.util.Collection; +class BuilderSingularRedirectToGuava { + private Set<String> dangerMice; + private NavigableMap<Integer, Number> things; + private Collection<Class<?>> doohickeys; + @java.lang.SuppressWarnings("all") + BuilderSingularRedirectToGuava(final Set<String> dangerMice, final NavigableMap<Integer, Number> things, final Collection<Class<?>> doohickeys) { + this.dangerMice = dangerMice; + this.things = things; + this.doohickeys = doohickeys; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSingularRedirectToGuavaBuilder { + private com.google.common.collect.ImmutableSet.Builder<String> dangerMice; + private com.google.common.collect.ImmutableSortedMap.Builder<Integer, Number> things; + private com.google.common.collect.ImmutableList.Builder<Class<?>> doohickeys; + @java.lang.SuppressWarnings("all") + BuilderSingularRedirectToGuavaBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularRedirectToGuavaBuilder dangerMouse(final String dangerMouse) { + if (this.dangerMice == null) this.dangerMice = com.google.common.collect.ImmutableSet.builder(); + this.dangerMice.add(dangerMouse); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularRedirectToGuavaBuilder dangerMice(final java.lang.Iterable<? extends String> dangerMice) { + if (this.dangerMice == null) this.dangerMice = com.google.common.collect.ImmutableSet.builder(); + this.dangerMice.addAll(dangerMice); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularRedirectToGuavaBuilder thing(final Integer thing$key, final Number thing$value) { + if (this.things == null) this.things = com.google.common.collect.ImmutableSortedMap.naturalOrder(); + this.things.put(thing$key, thing$value); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularRedirectToGuavaBuilder things(final java.util.Map<? extends Integer, ? extends Number> things) { + if (this.things == null) this.things = com.google.common.collect.ImmutableSortedMap.naturalOrder(); + this.things.putAll(things); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularRedirectToGuavaBuilder doohickey(final Class<?> doohickey) { + if (this.doohickeys == null) this.doohickeys = com.google.common.collect.ImmutableList.builder(); + this.doohickeys.add(doohickey); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularRedirectToGuavaBuilder doohickeys(final java.lang.Iterable<? extends Class<?>> doohickeys) { + if (this.doohickeys == null) this.doohickeys = com.google.common.collect.ImmutableList.builder(); + this.doohickeys.addAll(doohickeys); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularRedirectToGuava build() { + java.util.Set<String> dangerMice = this.dangerMice == null ? com.google.common.collect.ImmutableSet.of() : this.dangerMice.build(); + java.util.NavigableMap<Integer, Number> things = this.things == null ? com.google.common.collect.ImmutableSortedMap.of() : this.things.build(); + java.util.Collection<Class<?>> doohickeys = this.doohickeys == null ? com.google.common.collect.ImmutableList.of() : this.doohickeys.build(); + return new BuilderSingularRedirectToGuava(dangerMice, things, doohickeys); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingularRedirectToGuava.BuilderSingularRedirectToGuavaBuilder(dangerMice=" + this.dangerMice + ", things=" + this.things + ", doohickeys=" + this.doohickeys + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderSingularRedirectToGuavaBuilder builder() { + return new BuilderSingularRedirectToGuavaBuilder(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/BuilderSingularSets.java b/test/transform/resource/after-delombok/BuilderSingularSets.java new file mode 100644 index 00000000..d75c0fbf --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularSets.java @@ -0,0 +1,129 @@ +import java.util.Set; +import java.util.SortedSet; +class BuilderSingularSets<T> { + private Set<T> dangerMice; + private SortedSet<? extends Number> octopodes; + @SuppressWarnings("all") + private Set rawSet; + private Set<String> stringSet; + @java.lang.SuppressWarnings("all") + BuilderSingularSets(final Set<T> dangerMice, final SortedSet<? extends Number> octopodes, final Set rawSet, final Set<String> stringSet) { + this.dangerMice = dangerMice; + this.octopodes = octopodes; + this.rawSet = rawSet; + this.stringSet = stringSet; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSingularSetsBuilder<T> { + private java.util.ArrayList<T> dangerMice; + private java.util.ArrayList<Number> octopodes; + private java.util.ArrayList<java.lang.Object> rawSet; + private java.util.ArrayList<String> stringSet; + @java.lang.SuppressWarnings("all") + BuilderSingularSetsBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsBuilder<T> dangerMouse(final T dangerMouse) { + if (this.dangerMice == null) this.dangerMice = new java.util.ArrayList<T>(); + this.dangerMice.add(dangerMouse); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsBuilder<T> dangerMice(final java.util.Collection<? extends T> dangerMice) { + if (this.dangerMice == null) this.dangerMice = new java.util.ArrayList<T>(); + this.dangerMice.addAll(dangerMice); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsBuilder<T> octopus(final Number octopus) { + if (this.octopodes == null) this.octopodes = new java.util.ArrayList<Number>(); + this.octopodes.add(octopus); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsBuilder<T> octopodes(final java.util.Collection<? extends Number> octopodes) { + if (this.octopodes == null) this.octopodes = new java.util.ArrayList<Number>(); + this.octopodes.addAll(octopodes); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsBuilder<T> rawSet(final java.lang.Object rawSet) { + if (this.rawSet == null) this.rawSet = new java.util.ArrayList<java.lang.Object>(); + this.rawSet.add(rawSet); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsBuilder<T> rawSet(final java.util.Collection<?> rawSet) { + if (this.rawSet == null) this.rawSet = new java.util.ArrayList<java.lang.Object>(); + this.rawSet.addAll(rawSet); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsBuilder<T> stringSet(final String stringSet) { + if (this.stringSet == null) this.stringSet = new java.util.ArrayList<String>(); + this.stringSet.add(stringSet); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsBuilder<T> stringSet(final java.util.Collection<? extends String> stringSet) { + if (this.stringSet == null) this.stringSet = new java.util.ArrayList<String>(); + this.stringSet.addAll(stringSet); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSets<T> build() { + java.util.Set<T> dangerMice; + switch (this.dangerMice == null ? 0 : this.dangerMice.size()) { + case 0: + dangerMice = java.util.Collections.emptySet(); + break; + case 1: + dangerMice = java.util.Collections.singleton(this.dangerMice.get(0)); + break; + default: + dangerMice = new java.util.LinkedHashSet<T>(this.dangerMice.size() < 1073741824 ? 1 + this.dangerMice.size() + (this.dangerMice.size() - 3) / 3 : java.lang.Integer.MAX_VALUE); + dangerMice.addAll(this.dangerMice); + dangerMice = java.util.Collections.unmodifiableSet(dangerMice); + } + java.util.SortedSet<Number> octopodes = new java.util.TreeSet<Number>(); + if (this.octopodes != null) octopodes.addAll(this.octopodes); + octopodes = java.util.Collections.unmodifiableSortedSet(octopodes); + java.util.Set<java.lang.Object> rawSet; + switch (this.rawSet == null ? 0 : this.rawSet.size()) { + case 0: + rawSet = java.util.Collections.emptySet(); + break; + case 1: + rawSet = java.util.Collections.singleton(this.rawSet.get(0)); + break; + default: + rawSet = new java.util.LinkedHashSet<java.lang.Object>(this.rawSet.size() < 1073741824 ? 1 + this.rawSet.size() + (this.rawSet.size() - 3) / 3 : java.lang.Integer.MAX_VALUE); + rawSet.addAll(this.rawSet); + rawSet = java.util.Collections.unmodifiableSet(rawSet); + } + java.util.Set<String> stringSet; + switch (this.stringSet == null ? 0 : this.stringSet.size()) { + case 0: + stringSet = java.util.Collections.emptySet(); + break; + case 1: + stringSet = java.util.Collections.singleton(this.stringSet.get(0)); + break; + default: + stringSet = new java.util.LinkedHashSet<String>(this.stringSet.size() < 1073741824 ? 1 + this.stringSet.size() + (this.stringSet.size() - 3) / 3 : java.lang.Integer.MAX_VALUE); + stringSet.addAll(this.stringSet); + stringSet = java.util.Collections.unmodifiableSet(stringSet); + } + return new BuilderSingularSets<T>(dangerMice, octopodes, rawSet, stringSet); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingularSets.BuilderSingularSetsBuilder(dangerMice=" + this.dangerMice + ", octopodes=" + this.octopodes + ", rawSet=" + this.rawSet + ", stringSet=" + this.stringSet + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static <T> BuilderSingularSetsBuilder<T> builder() { + return new BuilderSingularSetsBuilder<T>(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/BuilderSingularGuavaListsSets.java b/test/transform/resource/after-ecj/BuilderSingularGuavaListsSets.java new file mode 100644 index 00000000..f95ce1ea --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularGuavaListsSets.java @@ -0,0 +1,88 @@ +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableCollection; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.ImmutableSortedSet; +import lombok.Singular; +@lombok.Builder class BuilderSingularGuavaListsSets<T> { + public static @java.lang.SuppressWarnings("all") class BuilderSingularGuavaListsSetsBuilder<T> { + private com.google.common.collect.ImmutableList.Builder<T> cards; + private com.google.common.collect.ImmutableList.Builder<Number> frogs; + private com.google.common.collect.ImmutableSet.Builder<java.lang.Object> rawSet; + private com.google.common.collect.ImmutableSortedSet.Builder<String> passes; + @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> card(T card) { + if ((this.cards == null)) + this.cards = com.google.common.collect.ImmutableList.builder(); + this.cards.add(card); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> cards(java.lang.Iterable<? extends T> cards) { + if ((this.cards == null)) + this.cards = com.google.common.collect.ImmutableList.builder(); + this.cards.addAll(cards); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> frog(Number frog) { + if ((this.frogs == null)) + this.frogs = com.google.common.collect.ImmutableList.builder(); + this.frogs.add(frog); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> frogs(java.lang.Iterable<? extends Number> frogs) { + if ((this.frogs == null)) + this.frogs = com.google.common.collect.ImmutableList.builder(); + this.frogs.addAll(frogs); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> rawSet(java.lang.Object rawSet) { + if ((this.rawSet == null)) + this.rawSet = com.google.common.collect.ImmutableSet.builder(); + this.rawSet.add(rawSet); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> rawSet(java.lang.Iterable<?> rawSet) { + if ((this.rawSet == null)) + this.rawSet = com.google.common.collect.ImmutableSet.builder(); + this.rawSet.addAll(rawSet); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> pass(String pass) { + if ((this.passes == null)) + this.passes = com.google.common.collect.ImmutableSortedSet.naturalOrder(); + this.passes.add(pass); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> passes(java.lang.Iterable<? extends String> passes) { + if ((this.passes == null)) + this.passes = com.google.common.collect.ImmutableSortedSet.naturalOrder(); + this.passes.addAll(passes); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSets<T> build() { + com.google.common.collect.ImmutableList<T> cards = ((this.cards == null) ? com.google.common.collect.ImmutableList.of() : this.cards.build()); + com.google.common.collect.ImmutableCollection<Number> frogs = ((this.frogs == null) ? com.google.common.collect.ImmutableList.of() : this.frogs.build()); + com.google.common.collect.ImmutableSet<java.lang.Object> rawSet = ((this.rawSet == null) ? com.google.common.collect.ImmutableSet.of() : this.rawSet.build()); + com.google.common.collect.ImmutableSortedSet<String> passes = ((this.passes == null) ? com.google.common.collect.ImmutableSortedSet.of() : this.passes.build()); + return new BuilderSingularGuavaListsSets<T>(cards, frogs, rawSet, passes); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((((("BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder(cards=" + this.cards) + ", frogs=") + this.frogs) + ", rawSet=") + this.rawSet) + ", passes=") + this.passes) + ")"); + } + } + private @Singular ImmutableList<T> cards; + private @Singular ImmutableCollection<? extends Number> frogs; + private @SuppressWarnings("all") @Singular("rawSet") ImmutableSet rawSet; + private @Singular ImmutableSortedSet<String> passes; + @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSets(final ImmutableList<T> cards, final ImmutableCollection<? extends Number> frogs, final ImmutableSet rawSet, final ImmutableSortedSet<String> passes) { + super(); + this.cards = cards; + this.frogs = frogs; + this.rawSet = rawSet; + this.passes = passes; + } + public static @java.lang.SuppressWarnings("all") <T>BuilderSingularGuavaListsSetsBuilder<T> builder() { + return new BuilderSingularGuavaListsSetsBuilder<T>(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularGuavaMaps.java b/test/transform/resource/after-ecj/BuilderSingularGuavaMaps.java new file mode 100644 index 00000000..64f287bf --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularGuavaMaps.java @@ -0,0 +1,71 @@ +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableBiMap; +import com.google.common.collect.ImmutableSortedMap; +import lombok.Singular; +@lombok.Builder class BuilderSingularGuavaMaps<K, V> { + public static @java.lang.SuppressWarnings("all") class BuilderSingularGuavaMapsBuilder<K, V> { + private com.google.common.collect.ImmutableMap.Builder<K, V> battleaxes; + private com.google.common.collect.ImmutableSortedMap.Builder<Integer, V> vertices; + private com.google.common.collect.ImmutableBiMap.Builder<java.lang.Object, java.lang.Object> rawMap; + @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder<K, V> battleaxe(K battleaxe$key, V battleaxe$value) { + if ((this.battleaxes == null)) + this.battleaxes = com.google.common.collect.ImmutableMap.builder(); + this.battleaxes.put(battleaxe$key, battleaxe$value); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder<K, V> battleaxes(java.util.Map<? extends K, ? extends V> battleaxes) { + if ((this.battleaxes == null)) + this.battleaxes = com.google.common.collect.ImmutableMap.builder(); + this.battleaxes.putAll(battleaxes); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder<K, V> vertex(Integer vertex$key, V vertex$value) { + if ((this.vertices == null)) + this.vertices = com.google.common.collect.ImmutableSortedMap.naturalOrder(); + this.vertices.put(vertex$key, vertex$value); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder<K, V> vertices(java.util.Map<? extends Integer, ? extends V> vertices) { + if ((this.vertices == null)) + this.vertices = com.google.common.collect.ImmutableSortedMap.naturalOrder(); + this.vertices.putAll(vertices); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder<K, V> rawMap(java.lang.Object rawMap$key, java.lang.Object rawMap$value) { + if ((this.rawMap == null)) + this.rawMap = com.google.common.collect.ImmutableBiMap.builder(); + this.rawMap.put(rawMap$key, rawMap$value); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder<K, V> rawMap(java.util.Map<?, ?> rawMap) { + if ((this.rawMap == null)) + this.rawMap = com.google.common.collect.ImmutableBiMap.builder(); + this.rawMap.putAll(rawMap); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMaps<K, V> build() { + com.google.common.collect.ImmutableMap<K, V> battleaxes = ((this.battleaxes == null) ? com.google.common.collect.ImmutableMap.of() : this.battleaxes.build()); + com.google.common.collect.ImmutableSortedMap<Integer, V> vertices = ((this.vertices == null) ? com.google.common.collect.ImmutableSortedMap.of() : this.vertices.build()); + com.google.common.collect.ImmutableBiMap<java.lang.Object, java.lang.Object> rawMap = ((this.rawMap == null) ? com.google.common.collect.ImmutableBiMap.of() : this.rawMap.build()); + return new BuilderSingularGuavaMaps<K, V>(battleaxes, vertices, rawMap); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("BuilderSingularGuavaMaps.BuilderSingularGuavaMapsBuilder(battleaxes=" + this.battleaxes) + ", vertices=") + this.vertices) + ", rawMap=") + this.rawMap) + ")"); + } + } + private @Singular ImmutableMap<K, V> battleaxes; + private @Singular ImmutableSortedMap<Integer, ? extends V> vertices; + private @SuppressWarnings("all") @Singular("rawMap") ImmutableBiMap rawMap; + @java.lang.SuppressWarnings("all") BuilderSingularGuavaMaps(final ImmutableMap<K, V> battleaxes, final ImmutableSortedMap<Integer, ? extends V> vertices, final ImmutableBiMap rawMap) { + super(); + this.battleaxes = battleaxes; + this.vertices = vertices; + this.rawMap = rawMap; + } + public static @java.lang.SuppressWarnings("all") <K, V>BuilderSingularGuavaMapsBuilder<K, V> builder() { + return new BuilderSingularGuavaMapsBuilder<K, V>(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularLists.java b/test/transform/resource/after-ecj/BuilderSingularLists.java new file mode 100644 index 00000000..c0a3ef9a --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularLists.java @@ -0,0 +1,107 @@ +import java.util.List; +import java.util.Collection; + +import lombok.Singular; +@lombok.Builder class BuilderSingularLists<T> { + public static @java.lang.SuppressWarnings("all") class BuilderSingularListsBuilder<T> { + private java.util.ArrayList<T> children; + private java.util.ArrayList<Number> scarves; + private java.util.ArrayList<java.lang.Object> rawList; + @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder<T> child(T child) { + if ((this.children == null)) + this.children = new java.util.ArrayList<T>(); + this.children.add(child); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder<T> children(java.util.Collection<? extends T> children) { + if ((this.children == null)) + this.children = new java.util.ArrayList<T>(); + this.children.addAll(children); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder<T> scarf(Number scarf) { + if ((this.scarves == null)) + this.scarves = new java.util.ArrayList<Number>(); + this.scarves.add(scarf); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder<T> scarves(java.util.Collection<? extends Number> scarves) { + if ((this.scarves == null)) + this.scarves = new java.util.ArrayList<Number>(); + this.scarves.addAll(scarves); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder<T> rawList(java.lang.Object rawList) { + if ((this.rawList == null)) + this.rawList = new java.util.ArrayList<java.lang.Object>(); + this.rawList.add(rawList); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder<T> rawList(java.util.Collection<?> rawList) { + if ((this.rawList == null)) + this.rawList = new java.util.ArrayList<java.lang.Object>(); + this.rawList.addAll(rawList); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularLists<T> build() { + java.util.List<T> children; + switch (((this.children == null) ? 0 : this.children.size())) { + case 0 : + children = java.util.Collections.emptyList(); + break; + case 1 : + children = java.util.Collections.singletonList(this.children.get(0)); + break; + default : + children = new java.util.ArrayList<T>(this.children.size()); + children.addAll(this.children); + children = java.util.Collections.unmodifiableList(children); + } + java.util.List<Number> scarves; + switch (((this.scarves == null) ? 0 : this.scarves.size())) { + case 0 : + scarves = java.util.Collections.emptyList(); + break; + case 1 : + scarves = java.util.Collections.singletonList(this.scarves.get(0)); + break; + default : + scarves = new java.util.ArrayList<Number>(this.scarves.size()); + scarves.addAll(this.scarves); + scarves = java.util.Collections.unmodifiableList(scarves); + } + java.util.List<java.lang.Object> rawList; + switch (((this.rawList == null) ? 0 : this.rawList.size())) { + case 0 : + rawList = java.util.Collections.emptyList(); + break; + case 1 : + rawList = java.util.Collections.singletonList(this.rawList.get(0)); + break; + default : + rawList = new java.util.ArrayList<java.lang.Object>(this.rawList.size()); + rawList.addAll(this.rawList); + rawList = java.util.Collections.unmodifiableList(rawList); + } + return new BuilderSingularLists<T>(children, scarves, rawList); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("BuilderSingularLists.BuilderSingularListsBuilder(children=" + this.children) + ", scarves=") + this.scarves) + ", rawList=") + this.rawList) + ")"); + } + } + private @Singular List<T> children; + private @Singular Collection<? extends Number> scarves; + private @SuppressWarnings("all") @Singular("rawList") List rawList; + @java.lang.SuppressWarnings("all") BuilderSingularLists(final List<T> children, final Collection<? extends Number> scarves, final List rawList) { + super(); + this.children = children; + this.scarves = scarves; + this.rawList = rawList; + } + public static @java.lang.SuppressWarnings("all") <T>BuilderSingularListsBuilder<T> builder() { + return new BuilderSingularListsBuilder<T>(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/BuilderSingularMaps.java b/test/transform/resource/after-ecj/BuilderSingularMaps.java new file mode 100644 index 00000000..0ce5a0a9 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularMaps.java @@ -0,0 +1,177 @@ +import java.util.Map; +import java.util.SortedMap; +import lombok.Singular; +@lombok.Builder class BuilderSingularMaps<K, V> { + public static @java.lang.SuppressWarnings("all") class BuilderSingularMapsBuilder<K, V> { + private java.util.ArrayList<K> women$key; + private java.util.ArrayList<V> women$value; + private java.util.ArrayList<K> men$key; + private java.util.ArrayList<Number> men$value; + private java.util.ArrayList<java.lang.Object> rawMap$key; + private java.util.ArrayList<java.lang.Object> rawMap$value; + private java.util.ArrayList<String> stringMap$key; + private java.util.ArrayList<V> stringMap$value; + @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> woman(K womanKey, V womanValue) { + if ((this.women$key == null)) + { + this.women$key = new java.util.ArrayList<K>(); + this.women$value = new java.util.ArrayList<V>(); + } + this.women$key.add(womanKey); + this.women$value.add(womanValue); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> women(java.util.Map<? extends K, ? extends V> women) { + if ((this.women$key == null)) + { + this.women$key = new java.util.ArrayList<K>(); + this.women$value = new java.util.ArrayList<V>(); + } + for (java.util.Map.Entry<? extends K, ? extends V> $lombokEntry : women.entrySet()) + { + this.women$key.add($lombokEntry.getKey()); + this.women$value.add($lombokEntry.getValue()); + } + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> man(K manKey, Number manValue) { + if ((this.men$key == null)) + { + this.men$key = new java.util.ArrayList<K>(); + this.men$value = new java.util.ArrayList<Number>(); + } + this.men$key.add(manKey); + this.men$value.add(manValue); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> men(java.util.Map<? extends K, ? extends Number> men) { + if ((this.men$key == null)) + { + this.men$key = new java.util.ArrayList<K>(); + this.men$value = new java.util.ArrayList<Number>(); + } + for (java.util.Map.Entry<? extends K, ? extends Number> $lombokEntry : men.entrySet()) + { + this.men$key.add($lombokEntry.getKey()); + this.men$value.add($lombokEntry.getValue()); + } + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> rawMap(java.lang.Object rawMapKey, java.lang.Object rawMapValue) { + if ((this.rawMap$key == null)) + { + this.rawMap$key = new java.util.ArrayList<java.lang.Object>(); + this.rawMap$value = new java.util.ArrayList<java.lang.Object>(); + } + this.rawMap$key.add(rawMapKey); + this.rawMap$value.add(rawMapValue); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> rawMap(java.util.Map<?, ?> rawMap) { + if ((this.rawMap$key == null)) + { + this.rawMap$key = new java.util.ArrayList<java.lang.Object>(); + this.rawMap$value = new java.util.ArrayList<java.lang.Object>(); + } + for (java.util.Map.Entry<?, ?> $lombokEntry : rawMap.entrySet()) + { + this.rawMap$key.add($lombokEntry.getKey()); + this.rawMap$value.add($lombokEntry.getValue()); + } + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> stringMap(String stringMapKey, V stringMapValue) { + if ((this.stringMap$key == null)) + { + this.stringMap$key = new java.util.ArrayList<String>(); + this.stringMap$value = new java.util.ArrayList<V>(); + } + this.stringMap$key.add(stringMapKey); + this.stringMap$value.add(stringMapValue); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> stringMap(java.util.Map<? extends String, ? extends V> stringMap) { + if ((this.stringMap$key == null)) + { + this.stringMap$key = new java.util.ArrayList<String>(); + this.stringMap$value = new java.util.ArrayList<V>(); + } + for (java.util.Map.Entry<? extends String, ? extends V> $lombokEntry : stringMap.entrySet()) + { + this.stringMap$key.add($lombokEntry.getKey()); + this.stringMap$value.add($lombokEntry.getValue()); + } + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMaps<K, V> build() { + java.util.Map<K, V> women; + switch (((this.women$key == null) ? 0 : this.women$key.size())) { + case 0 : + women = java.util.Collections.emptyMap(); + break; + case 1 : + women = java.util.Collections.singletonMap(this.women$key.get(0), this.women$value.get(0)); + break; + default : + women = new java.util.LinkedHashMap<K, V>(((this.women$key.size() < 0x40000000) ? ((1 + this.women$key.size()) + ((this.women$key.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE)); + for (int $i = 0;; ($i < this.women$key.size()); $i ++) + women.put(this.women$key.get($i), this.women$value.get($i)); + women = java.util.Collections.unmodifiableMap(women); + } + java.util.SortedMap<K, Number> men = new java.util.TreeMap<K, Number>(); + if ((this.men$key != null)) + for (int $i = 0;; ($i < ((this.men$key == null) ? 0 : this.men$key.size())); $i ++) + men.put(this.men$key.get($i), this.men$value.get($i)); + men = java.util.Collections.unmodifiableSortedMap(men); + java.util.Map<java.lang.Object, java.lang.Object> rawMap; + switch (((this.rawMap$key == null) ? 0 : this.rawMap$key.size())) { + case 0 : + rawMap = java.util.Collections.emptyMap(); + break; + case 1 : + rawMap = java.util.Collections.singletonMap(this.rawMap$key.get(0), this.rawMap$value.get(0)); + break; + default : + rawMap = new java.util.LinkedHashMap<java.lang.Object, java.lang.Object>(((this.rawMap$key.size() < 0x40000000) ? ((1 + this.rawMap$key.size()) + ((this.rawMap$key.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE)); + for (int $i = 0;; ($i < this.rawMap$key.size()); $i ++) + rawMap.put(this.rawMap$key.get($i), this.rawMap$value.get($i)); + rawMap = java.util.Collections.unmodifiableMap(rawMap); + } + java.util.Map<String, V> stringMap; + switch (((this.stringMap$key == null) ? 0 : this.stringMap$key.size())) { + case 0 : + stringMap = java.util.Collections.emptyMap(); + break; + case 1 : + stringMap = java.util.Collections.singletonMap(this.stringMap$key.get(0), this.stringMap$value.get(0)); + break; + default : + stringMap = new java.util.LinkedHashMap<String, V>(((this.stringMap$key.size() < 0x40000000) ? ((1 + this.stringMap$key.size()) + ((this.stringMap$key.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE)); + for (int $i = 0;; ($i < this.stringMap$key.size()); $i ++) + stringMap.put(this.stringMap$key.get($i), this.stringMap$value.get($i)); + stringMap = java.util.Collections.unmodifiableMap(stringMap); + } + return new BuilderSingularMaps<K, V>(women, men, rawMap, stringMap); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((((((((((((("BuilderSingularMaps.BuilderSingularMapsBuilder(women$key=" + this.women$key) + ", women$value=") + this.women$value) + ", men$key=") + this.men$key) + ", men$value=") + this.men$value) + ", rawMap$key=") + this.rawMap$key) + ", rawMap$value=") + this.rawMap$value) + ", stringMap$key=") + this.stringMap$key) + ", stringMap$value=") + this.stringMap$value) + ")"); + } + } + private @Singular Map<K, V> women; + private @Singular SortedMap<K, ? extends Number> men; + private @SuppressWarnings("all") @Singular("rawMap") Map rawMap; + private @Singular("stringMap") Map<String, V> stringMap; + @java.lang.SuppressWarnings("all") BuilderSingularMaps(final Map<K, V> women, final SortedMap<K, ? extends Number> men, final Map rawMap, final Map<String, V> stringMap) { + super(); + this.women = women; + this.men = men; + this.rawMap = rawMap; + this.stringMap = stringMap; + } + public static @java.lang.SuppressWarnings("all") <K, V>BuilderSingularMapsBuilder<K, V> builder() { + return new BuilderSingularMapsBuilder<K, V>(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/BuilderSingularNoAutosingularize.java b/test/transform/resource/after-ecj/BuilderSingularNoAutosingularize.java new file mode 100644 index 00000000..53bed757 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularNoAutosingularize.java @@ -0,0 +1,105 @@ +import java.util.List; +import lombok.Singular; +@lombok.Builder class BuilderSingularNoAutosingularize { + public static @java.lang.SuppressWarnings("all") class BuilderSingularNoAutosingularizeBuilder { + private java.util.ArrayList<String> things; + private java.util.ArrayList<String> widgets; + private java.util.ArrayList<String> items; + @java.lang.SuppressWarnings("all") BuilderSingularNoAutosingularizeBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutosingularizeBuilder things(String things) { + if ((this.things == null)) + this.things = new java.util.ArrayList<String>(); + this.things.add(things); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutosingularizeBuilder things(java.util.Collection<? extends String> things) { + if ((this.things == null)) + this.things = new java.util.ArrayList<String>(); + this.things.addAll(things); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutosingularizeBuilder widget(String widget) { + if ((this.widgets == null)) + this.widgets = new java.util.ArrayList<String>(); + this.widgets.add(widget); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutosingularizeBuilder widgets(java.util.Collection<? extends String> widgets) { + if ((this.widgets == null)) + this.widgets = new java.util.ArrayList<String>(); + this.widgets.addAll(widgets); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutosingularizeBuilder items(String items) { + if ((this.items == null)) + this.items = new java.util.ArrayList<String>(); + this.items.add(items); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutosingularizeBuilder items(java.util.Collection<? extends String> items) { + if ((this.items == null)) + this.items = new java.util.ArrayList<String>(); + this.items.addAll(items); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutosingularize build() { + java.util.List<String> things; + switch (((this.things == null) ? 0 : this.things.size())) { + case 0 : + things = java.util.Collections.emptyList(); + break; + case 1 : + things = java.util.Collections.singletonList(this.things.get(0)); + break; + default : + things = new java.util.ArrayList<String>(this.things.size()); + things.addAll(this.things); + things = java.util.Collections.unmodifiableList(things); + } + java.util.List<String> widgets; + switch (((this.widgets == null) ? 0 : this.widgets.size())) { + case 0 : + widgets = java.util.Collections.emptyList(); + break; + case 1 : + widgets = java.util.Collections.singletonList(this.widgets.get(0)); + break; + default : + widgets = new java.util.ArrayList<String>(this.widgets.size()); + widgets.addAll(this.widgets); + widgets = java.util.Collections.unmodifiableList(widgets); + } + java.util.List<String> items; + switch (((this.items == null) ? 0 : this.items.size())) { + case 0 : + items = java.util.Collections.emptyList(); + break; + case 1 : + items = java.util.Collections.singletonList(this.items.get(0)); + break; + default : + items = new java.util.ArrayList<String>(this.items.size()); + items.addAll(this.items); + items = java.util.Collections.unmodifiableList(items); + } + return new BuilderSingularNoAutosingularize(things, widgets, items); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("BuilderSingularNoAutosingularize.BuilderSingularNoAutosingularizeBuilder(things=" + this.things) + ", widgets=") + this.widgets) + ", items=") + this.items) + ")"); + } + } + private @Singular List<String> things; + private @Singular("widget") List<String> widgets; + private @Singular List<String> items; + @java.lang.SuppressWarnings("all") BuilderSingularNoAutosingularize(final List<String> things, final List<String> widgets, final List<String> items) { + super(); + this.things = things; + this.widgets = widgets; + this.items = items; + } + public static @java.lang.SuppressWarnings("all") BuilderSingularNoAutosingularizeBuilder builder() { + return new BuilderSingularNoAutosingularizeBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularRedirectToGuava.java b/test/transform/resource/after-ecj/BuilderSingularRedirectToGuava.java new file mode 100644 index 00000000..eeff550b --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularRedirectToGuava.java @@ -0,0 +1,71 @@ +import java.util.Set; +import java.util.NavigableMap; +import java.util.Collection; +import lombok.Singular; +@lombok.Builder class BuilderSingularRedirectToGuava { + public static @java.lang.SuppressWarnings("all") class BuilderSingularRedirectToGuavaBuilder { + private com.google.common.collect.ImmutableSet.Builder<String> dangerMice; + private com.google.common.collect.ImmutableSortedMap.Builder<Integer, Number> things; + private com.google.common.collect.ImmutableList.Builder<Class<?>> doohickeys; + @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder dangerMouse(String dangerMouse) { + if ((this.dangerMice == null)) + this.dangerMice = com.google.common.collect.ImmutableSet.builder(); + this.dangerMice.add(dangerMouse); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder dangerMice(java.lang.Iterable<? extends String> dangerMice) { + if ((this.dangerMice == null)) + this.dangerMice = com.google.common.collect.ImmutableSet.builder(); + this.dangerMice.addAll(dangerMice); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder thing(Integer thing$key, Number thing$value) { + if ((this.things == null)) + this.things = com.google.common.collect.ImmutableSortedMap.naturalOrder(); + this.things.put(thing$key, thing$value); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder things(java.util.Map<? extends Integer, ? extends Number> things) { + if ((this.things == null)) + this.things = com.google.common.collect.ImmutableSortedMap.naturalOrder(); + this.things.putAll(things); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder doohickey(Class<?> doohickey) { + if ((this.doohickeys == null)) + this.doohickeys = com.google.common.collect.ImmutableList.builder(); + this.doohickeys.add(doohickey); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder doohickeys(java.lang.Iterable<? extends Class<?>> doohickeys) { + if ((this.doohickeys == null)) + this.doohickeys = com.google.common.collect.ImmutableList.builder(); + this.doohickeys.addAll(doohickeys); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuava build() { + java.util.Set<String> dangerMice = ((this.dangerMice == null) ? com.google.common.collect.ImmutableSet.of() : this.dangerMice.build()); + java.util.NavigableMap<Integer, Number> things = ((this.things == null) ? com.google.common.collect.ImmutableSortedMap.of() : this.things.build()); + java.util.Collection<Class<?>> doohickeys = ((this.doohickeys == null) ? com.google.common.collect.ImmutableList.of() : this.doohickeys.build()); + return new BuilderSingularRedirectToGuava(dangerMice, things, doohickeys); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("BuilderSingularRedirectToGuava.BuilderSingularRedirectToGuavaBuilder(dangerMice=" + this.dangerMice) + ", things=") + this.things) + ", doohickeys=") + this.doohickeys) + ")"); + } + } + private @Singular Set<String> dangerMice; + private @Singular NavigableMap<Integer, Number> things; + private @Singular Collection<Class<?>> doohickeys; + @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuava(final Set<String> dangerMice, final NavigableMap<Integer, Number> things, final Collection<Class<?>> doohickeys) { + super(); + this.dangerMice = dangerMice; + this.things = things; + this.doohickeys = doohickeys; + } + public static @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder builder() { + return new BuilderSingularRedirectToGuavaBuilder(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/BuilderSingularSets.java b/test/transform/resource/after-ecj/BuilderSingularSets.java new file mode 100644 index 00000000..5d2fcc59 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularSets.java @@ -0,0 +1,125 @@ +import java.util.Set; +import java.util.SortedSet; +import lombok.Singular; +@lombok.Builder class BuilderSingularSets<T> { + public static @java.lang.SuppressWarnings("all") class BuilderSingularSetsBuilder<T> { + private java.util.ArrayList<T> dangerMice; + private java.util.ArrayList<Number> octopodes; + private java.util.ArrayList<java.lang.Object> rawSet; + private java.util.ArrayList<String> stringSet; + @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> dangerMouse(T dangerMouse) { + if ((this.dangerMice == null)) + this.dangerMice = new java.util.ArrayList<T>(); + this.dangerMice.add(dangerMouse); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> dangerMice(java.util.Collection<? extends T> dangerMice) { + if ((this.dangerMice == null)) + this.dangerMice = new java.util.ArrayList<T>(); + this.dangerMice.addAll(dangerMice); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> octopus(Number octopus) { + if ((this.octopodes == null)) + this.octopodes = new java.util.ArrayList<Number>(); + this.octopodes.add(octopus); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> octopodes(java.util.Collection<? extends Number> octopodes) { + if ((this.octopodes == null)) + this.octopodes = new java.util.ArrayList<Number>(); + this.octopodes.addAll(octopodes); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> rawSet(java.lang.Object rawSet) { + if ((this.rawSet == null)) + this.rawSet = new java.util.ArrayList<java.lang.Object>(); + this.rawSet.add(rawSet); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> rawSet(java.util.Collection<?> rawSet) { + if ((this.rawSet == null)) + this.rawSet = new java.util.ArrayList<java.lang.Object>(); + this.rawSet.addAll(rawSet); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> stringSet(String stringSet) { + if ((this.stringSet == null)) + this.stringSet = new java.util.ArrayList<String>(); + this.stringSet.add(stringSet); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> stringSet(java.util.Collection<? extends String> stringSet) { + if ((this.stringSet == null)) + this.stringSet = new java.util.ArrayList<String>(); + this.stringSet.addAll(stringSet); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSets<T> build() { + java.util.Set<T> dangerMice; + switch (((this.dangerMice == null) ? 0 : this.dangerMice.size())) { + case 0 : + dangerMice = java.util.Collections.emptySet(); + break; + case 1 : + dangerMice = java.util.Collections.singleton(this.dangerMice.get(0)); + break; + default : + dangerMice = new java.util.LinkedHashSet<T>(((this.dangerMice.size() < 0x40000000) ? ((1 + this.dangerMice.size()) + ((this.dangerMice.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE)); + dangerMice.addAll(this.dangerMice); + dangerMice = java.util.Collections.unmodifiableSet(dangerMice); + } + java.util.SortedSet<Number> octopodes = new java.util.TreeSet<Number>(); + if ((this.octopodes != null)) + octopodes.addAll(this.octopodes); + octopodes = java.util.Collections.unmodifiableSortedSet(octopodes); + java.util.Set<java.lang.Object> rawSet; + switch (((this.rawSet == null) ? 0 : this.rawSet.size())) { + case 0 : + rawSet = java.util.Collections.emptySet(); + break; + case 1 : + rawSet = java.util.Collections.singleton(this.rawSet.get(0)); + break; + default : + rawSet = new java.util.LinkedHashSet<java.lang.Object>(((this.rawSet.size() < 0x40000000) ? ((1 + this.rawSet.size()) + ((this.rawSet.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE)); + rawSet.addAll(this.rawSet); + rawSet = java.util.Collections.unmodifiableSet(rawSet); + } + java.util.Set<String> stringSet; + switch (((this.stringSet == null) ? 0 : this.stringSet.size())) { + case 0 : + stringSet = java.util.Collections.emptySet(); + break; + case 1 : + stringSet = java.util.Collections.singleton(this.stringSet.get(0)); + break; + default : + stringSet = new java.util.LinkedHashSet<String>(((this.stringSet.size() < 0x40000000) ? ((1 + this.stringSet.size()) + ((this.stringSet.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE)); + stringSet.addAll(this.stringSet); + stringSet = java.util.Collections.unmodifiableSet(stringSet); + } + return new BuilderSingularSets<T>(dangerMice, octopodes, rawSet, stringSet); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((((("BuilderSingularSets.BuilderSingularSetsBuilder(dangerMice=" + this.dangerMice) + ", octopodes=") + this.octopodes) + ", rawSet=") + this.rawSet) + ", stringSet=") + this.stringSet) + ")"); + } + } + private @Singular Set<T> dangerMice; + private @Singular SortedSet<? extends Number> octopodes; + private @SuppressWarnings("all") @Singular("rawSet") Set rawSet; + private @Singular("stringSet") Set<String> stringSet; + @java.lang.SuppressWarnings("all") BuilderSingularSets(final Set<T> dangerMice, final SortedSet<? extends Number> octopodes, final Set rawSet, final Set<String> stringSet) { + super(); + this.dangerMice = dangerMice; + this.octopodes = octopodes; + this.rawSet = rawSet; + this.stringSet = stringSet; + } + public static @java.lang.SuppressWarnings("all") <T>BuilderSingularSetsBuilder<T> builder() { + return new BuilderSingularSetsBuilder<T>(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/BuilderWithExistingBuilderClass.java b/test/transform/resource/after-ecj/BuilderWithExistingBuilderClass.java index 38cb0038..8fb42a59 100644 --- a/test/transform/resource/after-ecj/BuilderWithExistingBuilderClass.java +++ b/test/transform/resource/after-ecj/BuilderWithExistingBuilderClass.java @@ -1,4 +1,4 @@ -import lombok.experimental.Builder; +import lombok.Builder; class BuilderWithExistingBuilderClass<T, K extends Number> { public static class BuilderWithExistingBuilderClassBuilder<Z extends Number> { private boolean arg2; diff --git a/test/transform/resource/before/BuilderSingularGuavaListsSets.java b/test/transform/resource/before/BuilderSingularGuavaListsSets.java new file mode 100644 index 00000000..995c00e8 --- /dev/null +++ b/test/transform/resource/before/BuilderSingularGuavaListsSets.java @@ -0,0 +1,14 @@ +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableCollection; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.ImmutableSortedSet; + +import lombok.Singular; + +@lombok.Builder +class BuilderSingularGuavaListsSets<T> { + @Singular private ImmutableList<T> cards; + @Singular private ImmutableCollection<? extends Number> frogs; + @SuppressWarnings("all") @Singular("rawSet") private ImmutableSet rawSet; + @Singular private ImmutableSortedSet<String> passes; +} diff --git a/test/transform/resource/before/BuilderSingularGuavaMaps.java b/test/transform/resource/before/BuilderSingularGuavaMaps.java new file mode 100644 index 00000000..64a53570 --- /dev/null +++ b/test/transform/resource/before/BuilderSingularGuavaMaps.java @@ -0,0 +1,12 @@ +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableBiMap; +import com.google.common.collect.ImmutableSortedMap; + +import lombok.Singular; + +@lombok.Builder +class BuilderSingularGuavaMaps<K, V> { + @Singular private ImmutableMap<K, V> battleaxes; + @Singular private ImmutableSortedMap<Integer, ? extends V> vertices; + @SuppressWarnings("all") @Singular("rawMap") private ImmutableBiMap rawMap; +} diff --git a/test/transform/resource/before/BuilderSingularLists.java b/test/transform/resource/before/BuilderSingularLists.java new file mode 100644 index 00000000..93fced8e --- /dev/null +++ b/test/transform/resource/before/BuilderSingularLists.java @@ -0,0 +1,11 @@ +import java.util.List; +import java.util.Collection; + +import lombok.Singular; + +@lombok.Builder +class BuilderSingularLists<T> { + @Singular private List<T> children; + @Singular private Collection<? extends Number> scarves; + @SuppressWarnings("all") @Singular("rawList") private List rawList; +} diff --git a/test/transform/resource/before/BuilderSingularMaps.java b/test/transform/resource/before/BuilderSingularMaps.java new file mode 100644 index 00000000..e17f74fc --- /dev/null +++ b/test/transform/resource/before/BuilderSingularMaps.java @@ -0,0 +1,12 @@ +import java.util.Map; +import java.util.SortedMap; + +import lombok.Singular; + +@lombok.Builder +class BuilderSingularMaps<K, V> { + @Singular private Map<K, V> women; + @Singular private SortedMap<K, ? extends Number> men; + @SuppressWarnings("all") @Singular("rawMap") private Map rawMap; + @Singular("stringMap") private Map<String, V> stringMap; +} diff --git a/test/transform/resource/before/BuilderSingularNoAutoSingularize.java b/test/transform/resource/before/BuilderSingularNoAutoSingularize.java new file mode 100644 index 00000000..31e2c3ca --- /dev/null +++ b/test/transform/resource/before/BuilderSingularNoAutoSingularize.java @@ -0,0 +1,11 @@ +//CONF: lombok.singular.auto = false +import java.util.List; + +import lombok.Singular; + +@lombok.Builder +class BuilderSingularNoAutosingularize { + @Singular private List<String> things; + @Singular("widget") private List<String> widgets; + @Singular private List<String> items; +} diff --git a/test/transform/resource/before/BuilderSingularRedirectToGuava.java b/test/transform/resource/before/BuilderSingularRedirectToGuava.java new file mode 100644 index 00000000..7e1e2c23 --- /dev/null +++ b/test/transform/resource/before/BuilderSingularRedirectToGuava.java @@ -0,0 +1,13 @@ +//CONF: lombok.builder.useGuava = true +import java.util.Set; +import java.util.NavigableMap; +import java.util.Collection; + +import lombok.Singular; + +@lombok.Builder +class BuilderSingularRedirectToGuava { + @Singular private Set<String> dangerMice; + @Singular private NavigableMap<Integer, Number> things; + @Singular private Collection<Class<?>> doohickeys; +} diff --git a/test/transform/resource/before/BuilderSingularSets.java b/test/transform/resource/before/BuilderSingularSets.java new file mode 100644 index 00000000..68c4510a --- /dev/null +++ b/test/transform/resource/before/BuilderSingularSets.java @@ -0,0 +1,12 @@ +import java.util.Set; +import java.util.SortedSet; + +import lombok.Singular; + +@lombok.Builder +class BuilderSingularSets<T> { + @Singular private Set<T> dangerMice; + @Singular private SortedSet<? extends Number> octopodes; + @SuppressWarnings("all") @Singular("rawSet") private Set rawSet; + @Singular("stringSet") private Set<String> stringSet; +} diff --git a/test/transform/resource/before/BuilderWithExistingBuilderClass.java b/test/transform/resource/before/BuilderWithExistingBuilderClass.java index 262e3b85..c8e0a24b 100644 --- a/test/transform/resource/before/BuilderWithExistingBuilderClass.java +++ b/test/transform/resource/before/BuilderWithExistingBuilderClass.java @@ -1,4 +1,4 @@ -import lombok.experimental.Builder; +import lombok.Builder; class BuilderWithExistingBuilderClass<T, K extends Number> { @Builder diff --git a/test/transform/resource/messages-delombok/BuilderSingularNoAutosingularize.java.messages b/test/transform/resource/messages-delombok/BuilderSingularNoAutosingularize.java.messages new file mode 100644 index 00000000..8719789b --- /dev/null +++ b/test/transform/resource/messages-delombok/BuilderSingularNoAutosingularize.java.messages @@ -0,0 +1,2 @@ +8 The singular must be specified explicitly (e.g. @Singular("task")) because auto singularization is disabled. +10 The singular must be specified explicitly (e.g. @Singular("task")) because auto singularization is disabled. diff --git a/test/transform/resource/messages-ecj/BuilderComplex.java.messages b/test/transform/resource/messages-ecj/BuilderComplex.java.messages new file mode 100644 index 00000000..4856a80d --- /dev/null +++ b/test/transform/resource/messages-ecj/BuilderComplex.java.messages @@ -0,0 +1 @@ +2 The type Builder is deprecated diff --git a/test/transform/resource/messages-ecj/BuilderSingularNoAutosingularize.java.messages b/test/transform/resource/messages-ecj/BuilderSingularNoAutosingularize.java.messages new file mode 100644 index 00000000..8719789b --- /dev/null +++ b/test/transform/resource/messages-ecj/BuilderSingularNoAutosingularize.java.messages @@ -0,0 +1,2 @@ +8 The singular must be specified explicitly (e.g. @Singular("task")) because auto singularization is disabled. +10 The singular must be specified explicitly (e.g. @Singular("task")) because auto singularization is disabled. |