diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/transform/resource/after-delombok/BuilderSingletonMaps.java | 172 | ||||
-rw-r--r-- | test/transform/resource/after-delombok/BuilderSingletonSets.java | 128 | ||||
-rw-r--r-- | test/transform/resource/after-delombok/BuilderSingletons.java | 90 | ||||
-rw-r--r-- | test/transform/resource/before/BuilderSingletonMaps.java | 12 | ||||
-rw-r--r-- | test/transform/resource/before/BuilderSingletonSets.java (renamed from test/transform/resource/before/BuilderSingletons.java) | 2 |
5 files changed, 313 insertions, 91 deletions
diff --git a/test/transform/resource/after-delombok/BuilderSingletonMaps.java b/test/transform/resource/after-delombok/BuilderSingletonMaps.java new file mode 100644 index 00000000..3fa372d5 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingletonMaps.java @@ -0,0 +1,172 @@ +import java.util.Map; +import java.util.SortedMap; +class BuilderSingletonMaps<K, V> { + private Map<K, V> women; + private SortedMap<K, ? extends Number> men; + private Map rawMap; + private Map<String, V> stringMap; + @java.lang.SuppressWarnings("all") + BuilderSingletonMaps(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 BuilderSingletonMapsBuilder<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") + BuilderSingletonMapsBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingletonMapsBuilder<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 BuilderSingletonMapsBuilder<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 BuilderSingletonMapsBuilder<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 BuilderSingletonMapsBuilder<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 BuilderSingletonMapsBuilder<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 BuilderSingletonMapsBuilder<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 BuilderSingletonMapsBuilder<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 BuilderSingletonMapsBuilder<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 BuilderSingletonMaps<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 BuilderSingletonMaps<K, V>(women, men, rawMap, stringMap); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingletonMaps.BuilderSingletonMapsBuilder(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> BuilderSingletonMapsBuilder<K, V> builder() { + return new BuilderSingletonMapsBuilder<K, V>(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderSingletonSets.java b/test/transform/resource/after-delombok/BuilderSingletonSets.java new file mode 100644 index 00000000..1b71a56c --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingletonSets.java @@ -0,0 +1,128 @@ +import java.util.Set; +import java.util.SortedSet; +class BuilderSingletonSets<T> { + private Set<T> dangerMice; + private SortedSet<? extends Number> octopodes; + private Set rawSet; + private Set<String> stringSet; + @java.lang.SuppressWarnings("all") + BuilderSingletonSets(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 BuilderSingletonSetsBuilder<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") + BuilderSingletonSetsBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingletonSetsBuilder<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 BuilderSingletonSetsBuilder<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 BuilderSingletonSetsBuilder<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 BuilderSingletonSetsBuilder<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 BuilderSingletonSetsBuilder<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 BuilderSingletonSetsBuilder<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 BuilderSingletonSetsBuilder<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 BuilderSingletonSetsBuilder<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 BuilderSingletonSets<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 BuilderSingletonSets<T>(dangerMice, octopodes, rawSet, stringSet); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingletonSets.BuilderSingletonSetsBuilder(dangerMice=" + this.dangerMice + ", octopodes=" + this.octopodes + ", rawSet=" + this.rawSet + ", stringSet=" + this.stringSet + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static <T> BuilderSingletonSetsBuilder<T> builder() { + return new BuilderSingletonSetsBuilder<T>(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/BuilderSingletons.java b/test/transform/resource/after-delombok/BuilderSingletons.java deleted file mode 100644 index 049af0a4..00000000 --- a/test/transform/resource/after-delombok/BuilderSingletons.java +++ /dev/null @@ -1,90 +0,0 @@ -import java.util.Set; -import java.util.SortedSet; -class BuilderSingletons<T> { - private Set<T> dangerMice; - private SortedSet<? extends Number> octopodes; - private Set rawSet; - private Set<String> stringSet; - @java.lang.SuppressWarnings("all") - BuilderSingletons(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 BuilderSingletonsBuilder<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") - BuilderSingletonsBuilder() { - } - @java.lang.SuppressWarnings("all") - public BuilderSingletonsBuilder<T> dangerMouse(final T dangerMouse) { - this.dangerMice.add(dangerMouse); - return this; - } - @java.lang.SuppressWarnings("all") - public BuilderSingletonsBuilder<T> dangerMice(final java.util.Collection<? extends T> dangerMice) { - this.dangerMice.addAll(dangerMice); - return this; - } - @java.lang.SuppressWarnings("all") - public BuilderSingletonsBuilder<T> octopus(final Number octopus) { - this.octopodes.add(octopus); - return this; - } - @java.lang.SuppressWarnings("all") - public BuilderSingletonsBuilder<T> octopodes(final java.util.Collection<? extends Number> octopodes) { - this.octopodes.addAll(octopodes); - return this; - } - @java.lang.SuppressWarnings("all") - public BuilderSingletonsBuilder<T> rawSet(final java.lang.Object rawSet) { - this.rawSet.add(rawSet); - return this; - } - @java.lang.SuppressWarnings("all") - public BuilderSingletonsBuilder<T> rawSet(final java.util.Collection<?> rawSet) { - this.rawSet.addAll(rawSet); - return this; - } - @java.lang.SuppressWarnings("all") - public BuilderSingletonsBuilder<T> stringSet(final String stringSet) { - this.stringSet.add(stringSet); - return this; - } - @java.lang.SuppressWarnings("all") - public BuilderSingletonsBuilder<T> stringSet(final java.util.Collection<? extends String> stringSet) { - this.stringSet.addAll(stringSet); - return this; - } - @java.lang.SuppressWarnings("all") - public BuilderSingletons<T> build() { - java.util.Set<T> dangerMice = new java.util.LinkedHashSet<T>(this.dangerMice.size() < 1073741824 ? this.dangerMice.size() < 3 ? this.dangerMice.size() + 1 : this.dangerMice.size() + this.dangerMice.size() / 3 : java.lang.Integer.MAX_VALUE, 0.75F); - dangerMice.addAll(this.dangerMice); - dangerMice = java.util.Collections.unmodifiableSet(dangerMice); - java.util.SortedSet<Number> octopodes = new java.util.TreeSet<Number>(); - octopodes.addAll(this.octopodes); - octopodes = java.util.Collections.unmodifiableSortedSet(octopodes); - java.util.Set<java.lang.Object> rawSet = new java.util.LinkedHashSet<java.lang.Object>(this.rawSet.size() < 1073741824 ? this.rawSet.size() < 3 ? this.rawSet.size() + 1 : this.rawSet.size() + this.rawSet.size() / 3 : java.lang.Integer.MAX_VALUE, 0.75F); - rawSet.addAll(this.rawSet); - rawSet = java.util.Collections.unmodifiableSet(rawSet); - java.util.Set<String> stringSet = new java.util.LinkedHashSet<String>(this.stringSet.size() < 1073741824 ? this.stringSet.size() < 3 ? this.stringSet.size() + 1 : this.stringSet.size() + this.stringSet.size() / 3 : java.lang.Integer.MAX_VALUE, 0.75F); - stringSet.addAll(this.stringSet); - stringSet = java.util.Collections.unmodifiableSet(stringSet); - return new BuilderSingletons<T>(dangerMice, octopodes, rawSet, stringSet); - } - @java.lang.Override - @java.lang.SuppressWarnings("all") - public java.lang.String toString() { - return "BuilderSingletons.BuilderSingletonsBuilder(dangerMice=" + this.dangerMice + ", octopodes=" + this.octopodes + ", rawSet=" + this.rawSet + ", stringSet=" + this.stringSet + ")"; - } - } - @java.lang.SuppressWarnings("all") - public static <T> BuilderSingletonsBuilder<T> builder() { - return new BuilderSingletonsBuilder<T>(); - } -}
\ No newline at end of file diff --git a/test/transform/resource/before/BuilderSingletonMaps.java b/test/transform/resource/before/BuilderSingletonMaps.java new file mode 100644 index 00000000..00928e73 --- /dev/null +++ b/test/transform/resource/before/BuilderSingletonMaps.java @@ -0,0 +1,12 @@ +import java.util.Map; +import java.util.SortedMap; + +import lombok.Singular; + +@lombok.Builder +class BuilderSingletonMaps<K, V> { + @Singular private Map<K, V> women; + @Singular private SortedMap<K, ? extends Number> men; + @Singular("rawMap") private Map rawMap; + @Singular("stringMap") private Map<String, V> stringMap; +} diff --git a/test/transform/resource/before/BuilderSingletons.java b/test/transform/resource/before/BuilderSingletonSets.java index 7722f7d1..a9f12913 100644 --- a/test/transform/resource/before/BuilderSingletons.java +++ b/test/transform/resource/before/BuilderSingletonSets.java @@ -4,7 +4,7 @@ import java.util.SortedSet; import lombok.Singular; @lombok.Builder -class BuilderSingletons<T> { +class BuilderSingletonSets<T> { @Singular private Set<T> dangerMice; @Singular private SortedSet<? extends Number> octopodes; @Singular("rawSet") private Set rawSet; |