diff options
Diffstat (limited to 'test')
68 files changed, 4015 insertions, 0 deletions
diff --git a/test/transform/resource/after-delombok/BuilderWithPrefix.java b/test/transform/resource/after-delombok/BuilderSimpleWithSetterPrefix.java index c29d2a16..c29d2a16 100644 --- a/test/transform/resource/after-delombok/BuilderWithPrefix.java +++ b/test/transform/resource/after-delombok/BuilderSimpleWithSetterPrefix.java diff --git a/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypesWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypesWithSetterPrefix.java new file mode 100644 index 00000000..2d535e65 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularAnnotatedTypesWithSetterPrefix.java @@ -0,0 +1,124 @@ +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; +import java.util.Set; +import java.util.Map; +import lombok.NonNull; +@Target(ElementType.TYPE_USE) +@interface MyAnnotation { +} +class BuilderSingularAnnotatedTypes { + private Set<@MyAnnotation @NonNull String> foos; + private Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars; + @java.lang.SuppressWarnings("all") + BuilderSingularAnnotatedTypes(final Set<@MyAnnotation @NonNull String> foos, final Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars) { + this.foos = foos; + this.bars = bars; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSingularAnnotatedTypesBuilder { + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<@MyAnnotation @NonNull String> foos; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<@MyAnnotation @NonNull String> bars$key; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<@MyAnnotation @NonNull Integer> bars$value; + @java.lang.SuppressWarnings("all") + BuilderSingularAnnotatedTypesBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularAnnotatedTypesBuilder withFoo(@MyAnnotation @NonNull final String foo) { + if (foo == null) { + throw new java.lang.NullPointerException("foo is marked non-null but is null"); + } + if (this.foos == null) this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>(); + this.foos.add(foo); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularAnnotatedTypesBuilder withFoos(final java.util.Collection<? extends @MyAnnotation @NonNull String> foos) { + if (this.foos == null) this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>(); + this.foos.addAll(foos); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularAnnotatedTypesBuilder clearFoos() { + if (this.foos != null) this.foos.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularAnnotatedTypesBuilder withBar(@MyAnnotation @NonNull final String barKey, @MyAnnotation @NonNull final Integer barValue) { + if (barKey == null) { + throw new java.lang.NullPointerException("barKey is marked non-null but is null"); + } + if (barValue == null) { + throw new java.lang.NullPointerException("barValue is marked non-null but is null"); + } + if (this.bars$key == null) { + this.bars$key = new java.util.ArrayList<@MyAnnotation @NonNull String>(); + this.bars$value = new java.util.ArrayList<@MyAnnotation @NonNull Integer>(); + } + this.bars$key.add(barKey); + this.bars$value.add(barValue); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularAnnotatedTypesBuilder withBars(final java.util.Map<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> bars) { + if (this.bars$key == null) { + this.bars$key = new java.util.ArrayList<@MyAnnotation @NonNull String>(); + this.bars$value = new java.util.ArrayList<@MyAnnotation @NonNull Integer>(); + } + for (final java.util.Map.Entry<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> $lombokEntry : bars.entrySet()) { + this.bars$key.add($lombokEntry.getKey()); + this.bars$value.add($lombokEntry.getValue()); + } + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularAnnotatedTypesBuilder clearBars() { + if (this.bars$key != null) { + this.bars$key.clear(); + this.bars$value.clear(); + } + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularAnnotatedTypes build() { + java.util.Set<@MyAnnotation @NonNull String> foos; + switch (this.foos == null ? 0 : this.foos.size()) { + case 0: + foos = java.util.Collections.emptySet(); + break; + case 1: + foos = java.util.Collections.singleton(this.foos.get(0)); + break; + default: + foos = new java.util.LinkedHashSet<@MyAnnotation @NonNull String>(this.foos.size() < 1073741824 ? 1 + this.foos.size() + (this.foos.size() - 3) / 3 : java.lang.Integer.MAX_VALUE); + foos.addAll(this.foos); + foos = java.util.Collections.unmodifiableSet(foos); + } + java.util.Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars; + switch (this.bars$key == null ? 0 : this.bars$key.size()) { + case 0: + bars = java.util.Collections.emptyMap(); + break; + case 1: + bars = java.util.Collections.singletonMap(this.bars$key.get(0), this.bars$value.get(0)); + break; + default: + bars = new java.util.LinkedHashMap<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer>(this.bars$key.size() < 1073741824 ? 1 + this.bars$key.size() + (this.bars$key.size() - 3) / 3 : java.lang.Integer.MAX_VALUE); + for (int $i = 0; $i < this.bars$key.size(); $i++) bars.put(this.bars$key.get($i), (@MyAnnotation @NonNull Integer) this.bars$value.get($i)); + bars = java.util.Collections.unmodifiableMap(bars); + } + return new BuilderSingularAnnotatedTypes(foos, bars); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingularAnnotatedTypes.BuilderSingularAnnotatedTypesBuilder(foos=" + this.foos + ", bars$key=" + this.bars$key + ", bars$value=" + this.bars$value + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderSingularAnnotatedTypesBuilder builder() { + return new BuilderSingularAnnotatedTypesBuilder(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderSingularGuavaListsSetsWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularGuavaListsSetsWithSetterPrefix.java new file mode 100644 index 00000000..0e9e6dfd --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularGuavaListsSetsWithSetterPrefix.java @@ -0,0 +1,140 @@ +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 com.google.common.collect.ImmutableTable; +class BuilderSingularGuavaListsSets<T> { + private ImmutableList<T> cards; + private ImmutableCollection<? extends Number> frogs; + @SuppressWarnings("all") + private ImmutableSet rawSet; + private ImmutableSortedSet<String> passes; + private ImmutableTable<? extends Number, ? extends Number, String> users; + @java.lang.SuppressWarnings("all") + BuilderSingularGuavaListsSets(final ImmutableList<T> cards, final ImmutableCollection<? extends Number> frogs, final ImmutableSet rawSet, final ImmutableSortedSet<String> passes, final ImmutableTable<? extends Number, ? extends Number, String> users) { + this.cards = cards; + this.frogs = frogs; + this.rawSet = rawSet; + this.passes = passes; + this.users = users; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSingularGuavaListsSetsBuilder<T> { + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableList.Builder<T> cards; + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableList.Builder<Number> frogs; + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableSet.Builder<java.lang.Object> rawSet; + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableSortedSet.Builder<String> passes; + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableTable.Builder<Number, Number, String> users; + @java.lang.SuppressWarnings("all") + BuilderSingularGuavaListsSetsBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder<T> withCard(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> withCards(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> clearCards() { + this.cards = null; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder<T> withFrog(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> withFrogs(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> clearFrogs() { + this.frogs = null; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder<T> withRawSet(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> withRawSet(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> clearRawSet() { + this.rawSet = null; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder<T> withPass(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> withPasses(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 BuilderSingularGuavaListsSetsBuilder<T> clearPasses() { + this.passes = null; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder<T> withUser(final Number rowKey, final Number columnKey, final String value) { + if (this.users == null) this.users = com.google.common.collect.ImmutableTable.builder(); + this.users.put(rowKey, columnKey, value); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder<T> withUsers(final com.google.common.collect.Table<? extends Number, ? extends Number, ? extends String> users) { + if (this.users == null) this.users = com.google.common.collect.ImmutableTable.builder(); + this.users.putAll(users); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularGuavaListsSetsBuilder<T> clearUsers() { + this.users = null; + 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.<T>of() : this.cards.build(); + com.google.common.collect.ImmutableCollection<Number> frogs = this.frogs == null ? com.google.common.collect.ImmutableList.<Number>of() : this.frogs.build(); + com.google.common.collect.ImmutableSet<java.lang.Object> rawSet = this.rawSet == null ? com.google.common.collect.ImmutableSet.<java.lang.Object>of() : this.rawSet.build(); + com.google.common.collect.ImmutableSortedSet<String> passes = this.passes == null ? com.google.common.collect.ImmutableSortedSet.<String>of() : this.passes.build(); + com.google.common.collect.ImmutableTable<Number, Number, String> users = this.users == null ? com.google.common.collect.ImmutableTable.<Number, Number, String>of() : this.users.build(); + return new BuilderSingularGuavaListsSets<T>(cards, frogs, rawSet, passes, users); + } + @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 + ", users=" + this.users + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static <T> BuilderSingularGuavaListsSetsBuilder<T> builder() { + return new BuilderSingularGuavaListsSetsBuilder<T>(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderSingularListsWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularListsWithSetterPrefix.java new file mode 100644 index 00000000..1fd58406 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularListsWithSetterPrefix.java @@ -0,0 +1,123 @@ +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> { + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<T> children; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<Number> scarves; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<java.lang.Object> rawList; + @java.lang.SuppressWarnings("all") + BuilderSingularListsBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularListsBuilder<T> withChild(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> withChildren(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> clearChildren() { + if (this.children != null) this.children.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularListsBuilder<T> withScarf(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> withScarves(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> clearScarves() { + if (this.scarves != null) this.scarves.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularListsBuilder<T> withRawList(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> withRawList(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 BuilderSingularListsBuilder<T> clearRawList() { + if (this.rawList != null) this.rawList.clear(); + 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 = java.util.Collections.unmodifiableList(new java.util.ArrayList<T>(this.children)); + } + java.util.Collection<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 = java.util.Collections.unmodifiableList(new java.util.ArrayList<Number>(this.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 = java.util.Collections.unmodifiableList(new java.util.ArrayList<java.lang.Object>(this.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/BuilderSingularMapsWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularMapsWithSetterPrefix.java new file mode 100644 index 00000000..4b250994 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularMapsWithSetterPrefix.java @@ -0,0 +1,213 @@ +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; + @SuppressWarnings("all") + BuilderSingularMaps(Map<K, V> women, SortedMap<K, ? extends Number> men, Map rawMap, Map<String, V> stringMap) { + this.women = women; + this.men = men; + this.rawMap = rawMap; + this.stringMap = stringMap; + } + @SuppressWarnings("all") + public static class BuilderSingularMapsBuilder<K, V> { + @SuppressWarnings("all") + private java.util.ArrayList<K> women$key; + @SuppressWarnings("all") + private java.util.ArrayList<V> women$value; + @SuppressWarnings("all") + private java.util.ArrayList<K> men$key; + @SuppressWarnings("all") + private java.util.ArrayList<Number> men$value; + @SuppressWarnings("all") + private java.util.ArrayList<Object> rawMap$key; + @SuppressWarnings("all") + private java.util.ArrayList<Object> rawMap$value; + @SuppressWarnings("all") + private java.util.ArrayList<String> stringMap$key; + @SuppressWarnings("all") + private java.util.ArrayList<V> stringMap$value; + @SuppressWarnings("all") + BuilderSingularMapsBuilder() { + } + @SuppressWarnings("all") + public BuilderSingularMapsBuilder<K, V> withWoman(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; + } + @SuppressWarnings("all") + public BuilderSingularMapsBuilder<K, V> withWomen(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; + } + @SuppressWarnings("all") + public BuilderSingularMapsBuilder<K, V> clearWomen() { + if (this.women$key != null) { + this.women$key.clear(); + this.women$value.clear(); + } + return this; + } + @SuppressWarnings("all") + public BuilderSingularMapsBuilder<K, V> withMan(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; + } + @SuppressWarnings("all") + public BuilderSingularMapsBuilder<K, V> withMen(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; + } + @SuppressWarnings("all") + public BuilderSingularMapsBuilder<K, V> clearMen() { + if (this.men$key != null) { + this.men$key.clear(); + this.men$value.clear(); + } + return this; + } + @SuppressWarnings("all") + public BuilderSingularMapsBuilder<K, V> withRawMan(Object rawMapKey, Object rawMapValue) { + if (this.rawMap$key == null) { + this.rawMap$key = new java.util.ArrayList<Object>(); + this.rawMap$value = new java.util.ArrayList<Object>(); + } + this.rawMap$key.add(rawMapKey); + this.rawMap$value.add(rawMapValue); + return this; + } + @SuppressWarnings("all") + public BuilderSingularMapsBuilder<K, V> withRawMap(java.util.Map<?, ?> rawMap) { + if (this.rawMap$key == null) { + this.rawMap$key = new java.util.ArrayList<Object>(); + this.rawMap$value = new java.util.ArrayList<Object>(); + } + for (java.util.Map.Entry<?, ?> $lombokEntry : rawMap.entrySet()) { + this.rawMap$key.add($lombokEntry.getKey()); + this.rawMap$value.add($lombokEntry.getValue()); + } + return this; + } + @SuppressWarnings("all") + public BuilderSingularMapsBuilder<K, V> clearRawMap() { + if (this.rawMap$key != null) { + this.rawMap$key.clear(); + this.rawMap$value.clear(); + } + return this; + } + @SuppressWarnings("all") + public 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; + } + @SuppressWarnings("all") + public 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; + } + @SuppressWarnings("all") + public BuilderSingularMapsBuilder<K, V> clearStringMap() { + if (this.stringMap$key != null) { + this.stringMap$key.clear(); + this.stringMap$value.clear(); + } + return this; + } + @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 : Integer.MAX_VALUE); + for (int $i = 0; $i < this.women$key.size(); $i++) women.put(this.women$key.get($i), (V) 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), (Number) this.men$value.get($i)); + men = java.util.Collections.unmodifiableSortedMap(men); + java.util.Map<Object, 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<Object, Object>(this.rawMap$key.size() < 1073741824 ? 1 + this.rawMap$key.size() + (this.rawMap$key.size() - 3) / 3 : Integer.MAX_VALUE); + for (int $i = 0; $i < this.rawMap$key.size(); $i++) rawMap.put(this.rawMap$key.get($i), (Object) 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 : Integer.MAX_VALUE); + for (int $i = 0; $i < this.stringMap$key.size(); $i++) stringMap.put(this.stringMap$key.get($i), (V) this.stringMap$value.get($i)); + stringMap = java.util.Collections.unmodifiableMap(stringMap); + } + return new BuilderSingularMaps<K, V>(women, men, rawMap, stringMap); + } + @Override + @SuppressWarnings("all") + public 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 + ")"; + } + } + @SuppressWarnings("all") + public static <K, V> BuilderSingularMapsBuilder<K, V> builder() { + return new BuilderSingularMapsBuilder<K, V>(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java new file mode 100644 index 00000000..453b9d74 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularNoAutoWithSetterPrefix.java @@ -0,0 +1,121 @@ +import java.util.List; +class BuilderSingularNoAuto { + private List<String> things; + private List<String> widgets; + private List<String> items; + @java.lang.SuppressWarnings("all") + BuilderSingularNoAuto(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 BuilderSingularNoAutoBuilder { + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<String> things; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<String> widgets; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<String> items; + @java.lang.SuppressWarnings("all") + BuilderSingularNoAutoBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularNoAutoBuilder withThings(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 BuilderSingularNoAutoBuilder withThings(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 BuilderSingularNoAutoBuilder clearThings() { + if (this.things != null) this.things.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularNoAutoBuilder withWidget(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 BuilderSingularNoAutoBuilder withWidgets(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 BuilderSingularNoAutoBuilder clearWidgets() { + if (this.widgets != null) this.widgets.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularNoAutoBuilder withItems(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 BuilderSingularNoAutoBuilder withItems(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 BuilderSingularNoAutoBuilder clearItems() { + if (this.items != null) this.items.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularNoAuto 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 = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.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 = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.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 = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.items)); + } + return new BuilderSingularNoAuto(things, widgets, items); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingularNoAuto.BuilderSingularNoAutoBuilder(things=" + this.things + ", widgets=" + this.widgets + ", items=" + this.items + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderSingularNoAutoBuilder builder() { + return new BuilderSingularNoAutoBuilder(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderSingularRedirectToGuavaWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularRedirectToGuavaWithSetterPrefix.java new file mode 100644 index 00000000..4b1b3d70 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularRedirectToGuavaWithSetterPrefix.java @@ -0,0 +1,93 @@ +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 { + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableSet.Builder<String> dangerMice; + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableSortedMap.Builder<Integer, Number> things; + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableList.Builder<Class<?>> doohickeys; + @java.lang.SuppressWarnings("all") + BuilderSingularRedirectToGuavaBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularRedirectToGuavaBuilder withDangerMouse(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 withDangerMice(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 clearDangerMice() { + this.dangerMice = null; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularRedirectToGuavaBuilder withThing(final Integer key, final Number value) { + if (this.things == null) this.things = com.google.common.collect.ImmutableSortedMap.naturalOrder(); + this.things.put(key, value); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularRedirectToGuavaBuilder withThings(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 clearThings() { + this.things = null; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularRedirectToGuavaBuilder withDoohickey(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 withDoohickeys(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 BuilderSingularRedirectToGuavaBuilder clearDoohickeys() { + this.doohickeys = null; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularRedirectToGuava build() { + java.util.Set<String> dangerMice = this.dangerMice == null ? com.google.common.collect.ImmutableSet.<String>of() : this.dangerMice.build(); + java.util.NavigableMap<Integer, Number> things = this.things == null ? com.google.common.collect.ImmutableSortedMap.<Integer, Number>of() : this.things.build(); + java.util.Collection<Class<?>> doohickeys = this.doohickeys == null ? com.google.common.collect.ImmutableList.<Class<?>>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(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderSingularSetsWithPrefix.java b/test/transform/resource/after-delombok/BuilderSingularSetsWithPrefix.java new file mode 100644 index 00000000..e3817b59 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularSetsWithPrefix.java @@ -0,0 +1,153 @@ +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> { + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<T> dangerMice; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<Number> octopodes; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<java.lang.Object> rawSet; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<String> stringSet; + @java.lang.SuppressWarnings("all") + BuilderSingularSetsBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsBuilder<T> withDangerMouse(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> withDangerMice(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> clearDangerMice() { + if (this.dangerMice != null) this.dangerMice.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsBuilder<T> withOctopus(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> withOctopodes(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> clearOctopodes() { + if (this.octopodes != null) this.octopodes.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsBuilder<T> withRawSet(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> withRawSet(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> clearRawSet() { + if (this.rawSet != null) this.rawSet.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularSetsBuilder<T> withStringSet(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> withStringSet(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 BuilderSingularSetsBuilder<T> clearStringSet() { + if (this.stringSet != null) this.stringSet.clear(); + 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>(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNullWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNullWithSetterPrefix.java new file mode 100644 index 00000000..83e58e1d --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularToBuilderWithNullWithSetterPrefix.java @@ -0,0 +1,65 @@ +class BuilderSingularToBuilderWithNull { + private java.util.List<String> elems; + public static void test() { + new BuilderSingularToBuilderWithNull(null).toBuilder(); + } + @java.lang.SuppressWarnings("all") + BuilderSingularToBuilderWithNull(final java.util.List<String> elems) { + this.elems = elems; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSingularToBuilderWithNullBuilder { + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<String> elems; + @java.lang.SuppressWarnings("all") + BuilderSingularToBuilderWithNullBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularToBuilderWithNullBuilder withElem(final String elem) { + if (this.elems == null) this.elems = new java.util.ArrayList<String>(); + this.elems.add(elem); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularToBuilderWithNullBuilder withElems(final java.util.Collection<? extends String> elems) { + if (this.elems == null) this.elems = new java.util.ArrayList<String>(); + this.elems.addAll(elems); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularToBuilderWithNullBuilder clearElems() { + if (this.elems != null) this.elems.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularToBuilderWithNull build() { + java.util.List<String> elems; + switch (this.elems == null ? 0 : this.elems.size()) { + case 0: + elems = java.util.Collections.emptyList(); + break; + case 1: + elems = java.util.Collections.singletonList(this.elems.get(0)); + break; + default: + elems = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.elems)); + } + return new BuilderSingularToBuilderWithNull(elems); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingularToBuilderWithNull.BuilderSingularToBuilderWithNullBuilder(elems=" + this.elems + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderSingularToBuilderWithNullBuilder builder() { + return new BuilderSingularToBuilderWithNullBuilder(); + } + @java.lang.SuppressWarnings("all") + public BuilderSingularToBuilderWithNullBuilder toBuilder() { + final BuilderSingularToBuilderWithNullBuilder builder = new BuilderSingularToBuilderWithNullBuilder(); + if (this.elems != null) builder.elems(this.elems); + return builder; + } +} diff --git a/test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java new file mode 100644 index 00000000..583d4df0 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java @@ -0,0 +1,97 @@ +import java.util.List; +import java.util.Collection; +class BuilderSingularWildcardListsWithToBuilder { + private List<?> objects; + private Collection<? extends Number> numbers; + @java.lang.SuppressWarnings("all") + BuilderSingularWildcardListsWithToBuilder(final List<?> objects, final Collection<? extends Number> numbers) { + this.objects = objects; + this.numbers = numbers; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSingularWildcardListsWithToBuilderBuilder { + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<java.lang.Object> objects; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<Number> numbers; + @java.lang.SuppressWarnings("all") + BuilderSingularWildcardListsWithToBuilderBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWildcardListsWithToBuilderBuilder withObject(final java.lang.Object object) { + if (this.objects == null) this.objects = new java.util.ArrayList<java.lang.Object>(); + this.objects.add(object); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWildcardListsWithToBuilderBuilder withObjects(final java.util.Collection<?> objects) { + if (this.objects == null) this.objects = new java.util.ArrayList<java.lang.Object>(); + this.objects.addAll(objects); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWildcardListsWithToBuilderBuilder clearObjects() { + if (this.objects != null) this.objects.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWildcardListsWithToBuilderBuilder withNumber(final Number number) { + if (this.numbers == null) this.numbers = new java.util.ArrayList<Number>(); + this.numbers.add(number); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWildcardListsWithToBuilderBuilder withNumbers(final java.util.Collection<? extends Number> numbers) { + if (this.numbers == null) this.numbers = new java.util.ArrayList<Number>(); + this.numbers.addAll(numbers); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWildcardListsWithToBuilderBuilder clearNumbers() { + if (this.numbers != null) this.numbers.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWildcardListsWithToBuilder build() { + java.util.List<java.lang.Object> objects; + switch (this.objects == null ? 0 : this.objects.size()) { + case 0: + objects = java.util.Collections.emptyList(); + break; + case 1: + objects = java.util.Collections.singletonList(this.objects.get(0)); + break; + default: + objects = java.util.Collections.unmodifiableList(new java.util.ArrayList<java.lang.Object>(this.objects)); + } + java.util.Collection<Number> numbers; + switch (this.numbers == null ? 0 : this.numbers.size()) { + case 0: + numbers = java.util.Collections.emptyList(); + break; + case 1: + numbers = java.util.Collections.singletonList(this.numbers.get(0)); + break; + default: + numbers = java.util.Collections.unmodifiableList(new java.util.ArrayList<Number>(this.numbers)); + } + return new BuilderSingularWildcardListsWithToBuilder(objects, numbers); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingularWildcardListsWithToBuilder.BuilderSingularWildcardListsWithToBuilderBuilder(objects=" + this.objects + ", numbers=" + this.numbers + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderSingularWildcardListsWithToBuilderBuilder builder() { + return new BuilderSingularWildcardListsWithToBuilderBuilder(); + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWildcardListsWithToBuilderBuilder toBuilder() { + final BuilderSingularWildcardListsWithToBuilderBuilder builder = new BuilderSingularWildcardListsWithToBuilderBuilder(); + if (this.objects != null) builder.objects(this.objects); + if (this.numbers != null) builder.numbers(this.numbers); + return builder; + } +} diff --git a/test/transform/resource/after-delombok/BuilderSingularWithPrefixesWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderSingularWithPrefixesWithSetterPrefix.java new file mode 100644 index 00000000..216cd01f --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingularWithPrefixesWithSetterPrefix.java @@ -0,0 +1,56 @@ +class BuilderSingularWithPrefixes { + private java.util.List<String> _elems; + @java.lang.SuppressWarnings("all") + BuilderSingularWithPrefixes(final java.util.List<String> elems) { + this._elems = elems; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSingularWithPrefixesBuilder { + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<String> elems; + @java.lang.SuppressWarnings("all") + BuilderSingularWithPrefixesBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWithPrefixesBuilder withElem(final String elem) { + if (this.elems == null) this.elems = new java.util.ArrayList<String>(); + this.elems.add(elem); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWithPrefixesBuilder withElems(final java.util.Collection<? extends String> elems) { + if (this.elems == null) this.elems = new java.util.ArrayList<String>(); + this.elems.addAll(elems); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWithPrefixesBuilder clearElems() { + if (this.elems != null) this.elems.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingularWithPrefixes build() { + java.util.List<String> elems; + switch (this.elems == null ? 0 : this.elems.size()) { + case 0: + elems = java.util.Collections.emptyList(); + break; + case 1: + elems = java.util.Collections.singletonList(this.elems.get(0)); + break; + default: + elems = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.elems)); + } + return new BuilderSingularWithPrefixes(elems); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingularWithPrefixes.BuilderSingularWithPrefixesBuilder(elems=" + this.elems + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderSingularWithPrefixesBuilder builder() { + return new BuilderSingularWithPrefixesBuilder(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderTypeAnnosWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderTypeAnnosWithSetterPrefix.java new file mode 100644 index 00000000..b8bb81b7 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderTypeAnnosWithSetterPrefix.java @@ -0,0 +1,45 @@ +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; +import java.util.List; +@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) +@interface TA { +} +@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) +@interface TB { +} +class BuilderTypeAnnos { + @TA + @TB + private List<String> foo; + @java.lang.SuppressWarnings("all") + BuilderTypeAnnos(@TA final List<String> foo) { + this.foo = foo; + } + @java.lang.SuppressWarnings("all") + public static class BuilderTypeAnnosBuilder { + @java.lang.SuppressWarnings("all") + private List<String> foo; + @java.lang.SuppressWarnings("all") + BuilderTypeAnnosBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderTypeAnnosBuilder withFoo(@TA final List<String> foo) { + this.foo = foo; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderTypeAnnos build() { + return new BuilderTypeAnnos(foo); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderTypeAnnos.BuilderTypeAnnosBuilder(foo=" + this.foo + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderTypeAnnosBuilder builder() { + return new BuilderTypeAnnosBuilder(); + } +} + diff --git a/test/transform/resource/after-delombok/BuilderValueDataWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderValueDataWithSetterPrefix.java new file mode 100644 index 00000000..e1c107da --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderValueDataWithSetterPrefix.java @@ -0,0 +1,109 @@ +import java.util.List; +final class BuilderAndValue { + private final int zero = 0; + @java.lang.SuppressWarnings("all") + BuilderAndValue() { + } + @java.lang.SuppressWarnings("all") + public static class BuilderAndValueBuilder { + @java.lang.SuppressWarnings("all") + BuilderAndValueBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderAndValue build() { + return new BuilderAndValue(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderAndValue.BuilderAndValueBuilder()"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderAndValueBuilder builder() { + return new BuilderAndValueBuilder(); + } + @java.lang.SuppressWarnings("all") + public int getZero() { + return this.zero; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof BuilderAndValue)) return false; + final BuilderAndValue other = (BuilderAndValue) o; + if (this.getZero() != other.getZero()) return false; + return true; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + final int PRIME = 59; + int result = 1; + result = result * PRIME + this.getZero(); + return result; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderAndValue(zero=" + this.getZero() + ")"; + } +} + +class BuilderAndData { + private final int zero = 0; + @java.lang.SuppressWarnings("all") + BuilderAndData() { + } + @java.lang.SuppressWarnings("all") + public static class BuilderAndDataBuilder { + @java.lang.SuppressWarnings("all") + BuilderAndDataBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderAndData build() { + return new BuilderAndData(); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderAndData.BuilderAndDataBuilder()"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderAndDataBuilder builder() { + return new BuilderAndDataBuilder(); + } + @java.lang.SuppressWarnings("all") + public int getZero() { + return this.zero; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof BuilderAndData)) return false; + final BuilderAndData other = (BuilderAndData) o; + if (!other.canEqual((java.lang.Object) this)) return false; + if (this.getZero() != other.getZero()) return false; + return true; + } + @java.lang.SuppressWarnings("all") + protected boolean canEqual(final java.lang.Object other) { + return other instanceof BuilderAndData; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + final int PRIME = 59; + int result = 1; + result = result * PRIME + this.getZero(); + return result; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderAndData(zero=" + this.getZero() + ")"; + } +} diff --git a/test/transform/resource/after-delombok/BuilderWithAccessorsWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithAccessorsWithSetterPrefix.java new file mode 100644 index 00000000..d8e075b8 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderWithAccessorsWithSetterPrefix.java @@ -0,0 +1,60 @@ +class BuilderWithAccessors { + private final int plower; + private final int pUpper; + private int _foo; + private int __bar; + @java.lang.SuppressWarnings("all") + BuilderWithAccessors(final int plower, final int upper, final int foo, final int _bar) { + this.plower = plower; + this.pUpper = upper; + this._foo = foo; + this.__bar = _bar; + } + @java.lang.SuppressWarnings("all") + public static class BuilderWithAccessorsBuilder { + @java.lang.SuppressWarnings("all") + private int plower; + @java.lang.SuppressWarnings("all") + private int upper; + @java.lang.SuppressWarnings("all") + private int foo; + @java.lang.SuppressWarnings("all") + private int _bar; + @java.lang.SuppressWarnings("all") + BuilderWithAccessorsBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderWithAccessorsBuilder withPlower(final int plower) { + this.plower = plower; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithAccessorsBuilder withUpper(final int upper) { + this.upper = upper; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithAccessorsBuilder withFoo(final int foo) { + this.foo = foo; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithAccessorsBuilder with_Bar(final int _bar) { + this._bar = _bar; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithAccessors build() { + return new BuilderWithAccessors(plower, upper, foo, _bar); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderWithAccessors.BuilderWithAccessorsBuilder(plower=" + this.plower + ", upper=" + this.upper + ", foo=" + this.foo + ", _bar=" + this._bar + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderWithAccessorsBuilder builder() { + return new BuilderWithAccessorsBuilder(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderWithBadNamesWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithBadNamesWithSetterPrefix.java new file mode 100644 index 00000000..d19bf947 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderWithBadNamesWithSetterPrefix.java @@ -0,0 +1,42 @@ +public class BuilderWithBadNames { + String build; + String toString; + @java.lang.SuppressWarnings("all") + BuilderWithBadNames(final String build, final String toString) { + this.build = build; + this.toString = toString; + } + @java.lang.SuppressWarnings("all") + public static class BuilderWithBadNamesBuilder { + @java.lang.SuppressWarnings("all") + private String build; + @java.lang.SuppressWarnings("all") + private String toString; + @java.lang.SuppressWarnings("all") + BuilderWithBadNamesBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderWithBadNamesBuilder withBuild(final String build) { + this.build = build; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithBadNamesBuilder withToString(final String toString) { + this.toString = toString; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithBadNames build() { + return new BuilderWithBadNames(build, toString); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderWithBadNames.BuilderWithBadNamesBuilder(build=" + this.build + ", toString=" + this.toString + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderWithBadNamesBuilder builder() { + return new BuilderWithBadNamesBuilder(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderWithDeprecatedWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithDeprecatedWithSetterPrefix.java new file mode 100644 index 00000000..2045c1a5 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderWithDeprecatedWithSetterPrefix.java @@ -0,0 +1,114 @@ +import com.google.common.collect.ImmutableList; +public class BuilderWithDeprecated { + /** + * @deprecated since always + */ + String dep1; + @Deprecated + int dep2; + @Deprecated + java.util.List<String> strings; + @Deprecated + ImmutableList<Integer> numbers; + @java.lang.SuppressWarnings("all") + BuilderWithDeprecated(final String dep1, final int dep2, final java.util.List<String> strings, final ImmutableList<Integer> numbers) { + this.dep1 = dep1; + this.dep2 = dep2; + this.strings = strings; + this.numbers = numbers; + } + @java.lang.SuppressWarnings("all") + public static class BuilderWithDeprecatedBuilder { + @java.lang.SuppressWarnings("all") + private String dep1; + @java.lang.SuppressWarnings("all") + private int dep2; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<String> strings; + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableList.Builder<Integer> numbers; + @java.lang.SuppressWarnings("all") + BuilderWithDeprecatedBuilder() { + } + /** + * @deprecated since always + */ + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public BuilderWithDeprecatedBuilder withDep1(final String dep1) { + this.dep1 = dep1; + return this; + } + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public BuilderWithDeprecatedBuilder withDep2(final int dep2) { + this.dep2 = dep2; + return this; + } + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public BuilderWithDeprecatedBuilder withString(final String string) { + if (this.strings == null) this.strings = new java.util.ArrayList<String>(); + this.strings.add(string); + return this; + } + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public BuilderWithDeprecatedBuilder withStrings(final java.util.Collection<? extends String> strings) { + if (this.strings == null) this.strings = new java.util.ArrayList<String>(); + this.strings.addAll(strings); + return this; + } + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public BuilderWithDeprecatedBuilder clearStrings() { + if (this.strings != null) this.strings.clear(); + return this; + } + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public BuilderWithDeprecatedBuilder withNumber(final Integer number) { + if (this.numbers == null) this.numbers = com.google.common.collect.ImmutableList.builder(); + this.numbers.add(number); + return this; + } + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public BuilderWithDeprecatedBuilder withNumbers(final java.lang.Iterable<? extends Integer> numbers) { + if (this.numbers == null) this.numbers = com.google.common.collect.ImmutableList.builder(); + this.numbers.addAll(numbers); + return this; + } + @java.lang.Deprecated + @java.lang.SuppressWarnings("all") + public BuilderWithDeprecatedBuilder clearNumbers() { + this.numbers = null; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithDeprecated build() { + java.util.List<String> strings; + switch (this.strings == null ? 0 : this.strings.size()) { + case 0: + strings = java.util.Collections.emptyList(); + break; + case 1: + strings = java.util.Collections.singletonList(this.strings.get(0)); + break; + default: + strings = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.strings)); + } + com.google.common.collect.ImmutableList<Integer> numbers = this.numbers == null ? com.google.common.collect.ImmutableList.<Integer>of() : this.numbers.build(); + return new BuilderWithDeprecated(dep1, dep2, strings, numbers); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderWithDeprecated.BuilderWithDeprecatedBuilder(dep1=" + this.dep1 + ", dep2=" + this.dep2 + ", strings=" + this.strings + ", numbers=" + this.numbers + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderWithDeprecatedBuilder builder() { + return new BuilderWithDeprecatedBuilder(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderWithExistingBuilderClassWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithExistingBuilderClassWithSetterPrefix.java new file mode 100644 index 00000000..fd9504c2 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderWithExistingBuilderClassWithSetterPrefix.java @@ -0,0 +1,40 @@ +class BuilderWithExistingBuilderClass<T, K extends Number> { + public static <Z extends Number> BuilderWithExistingBuilderClass<String, Z> staticMethod(Z arg1, boolean arg2, String arg3) { + return null; + } + public static class BuilderWithExistingBuilderClassBuilder<Z extends Number> { + @java.lang.SuppressWarnings("all") + private boolean arg2; + @java.lang.SuppressWarnings("all") + private String arg3; + private Z arg1; + public void withArg2(boolean arg) { + } + @java.lang.SuppressWarnings("all") + BuilderWithExistingBuilderClassBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderWithExistingBuilderClassBuilder<Z> withArg1(final Z arg1) { + this.arg1 = arg1; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithExistingBuilderClassBuilder<Z> withArg3(final String arg3) { + this.arg3 = arg3; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithExistingBuilderClass<String, Z> build() { + return BuilderWithExistingBuilderClass.<Z>staticMethod(arg1, arg2, arg3); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderWithExistingBuilderClass.BuilderWithExistingBuilderClassBuilder(arg1=" + this.arg1 + ", arg2=" + this.arg2 + ", arg3=" + this.arg3 + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static <Z extends Number> BuilderWithExistingBuilderClassBuilder<Z> builder() { + return new BuilderWithExistingBuilderClassBuilder<Z>(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderWithNoBuilderMethodWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithNoBuilderMethodWithSetterPrefix.java new file mode 100644 index 00000000..ec0ccb28 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderWithNoBuilderMethodWithSetterPrefix.java @@ -0,0 +1,33 @@ +class BuilderWithNoBuilderMethod { + private String a = ""; + @java.lang.SuppressWarnings("all") + BuilderWithNoBuilderMethod(final String a) { + this.a = a; + } + @java.lang.SuppressWarnings("all") + public static class BuilderWithNoBuilderMethodBuilder { + @java.lang.SuppressWarnings("all") + private String a; + @java.lang.SuppressWarnings("all") + BuilderWithNoBuilderMethodBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderWithNoBuilderMethodBuilder withA(final String a) { + this.a = a; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithNoBuilderMethod build() { + return new BuilderWithNoBuilderMethod(a); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderWithNoBuilderMethod.BuilderWithNoBuilderMethodBuilder(a=" + this.a + ")"; + } + } + @java.lang.SuppressWarnings("all") + public BuilderWithNoBuilderMethodBuilder toBuilder() { + return new BuilderWithNoBuilderMethodBuilder().withA(this.a); + } +} diff --git a/test/transform/resource/after-delombok/BuilderWithNonNullWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithNonNullWithSetterPrefix.java new file mode 100644 index 00000000..29f1b792 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderWithNonNullWithSetterPrefix.java @@ -0,0 +1,40 @@ +class BuilderWithNonNull { + @lombok.NonNull + private final String id; + @java.lang.SuppressWarnings("all") + BuilderWithNonNull(@lombok.NonNull final String id) { + if (id == null) { + throw new java.lang.NullPointerException("id is marked non-null but is null"); + } + this.id = id; + } + @java.lang.SuppressWarnings("all") + public static class BuilderWithNonNullBuilder { + @java.lang.SuppressWarnings("all") + private String id; + @java.lang.SuppressWarnings("all") + BuilderWithNonNullBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderWithNonNullBuilder withId(@lombok.NonNull final String id) { + if (id == null) { + throw new java.lang.NullPointerException("id is marked non-null but is null"); + } + this.id = id; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithNonNull build() { + return new BuilderWithNonNull(id); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderWithNonNull.BuilderWithNonNullBuilder(id=" + this.id + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderWithNonNullBuilder builder() { + return new BuilderWithNonNullBuilder(); + } +} diff --git a/test/transform/resource/after-delombok/BuilderWithRecursiveGenericsWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithRecursiveGenericsWithSetterPrefix.java new file mode 100644 index 00000000..d0ca7c05 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderWithRecursiveGenericsWithSetterPrefix.java @@ -0,0 +1,85 @@ +import java.util.Set; +public class BuilderWithRecursiveGenerics { + interface Inter<T, U extends Inter<T, U>> { + } + public static final class Test<Foo, Bar extends Set<Foo>, Quz extends Inter<Bar, Quz>> { + private final Foo foo; + private final Bar bar; + @java.lang.SuppressWarnings("all") + Test(final Foo foo, final Bar bar) { + this.foo = foo; + this.bar = bar; + } + @java.lang.SuppressWarnings("all") + public static class TestBuilder<Foo, Bar extends Set<Foo>, Quz extends Inter<Bar, Quz>> { + @java.lang.SuppressWarnings("all") + private Foo foo; + @java.lang.SuppressWarnings("all") + private Bar bar; + @java.lang.SuppressWarnings("all") + TestBuilder() { + } + @java.lang.SuppressWarnings("all") + public TestBuilder<Foo, Bar, Quz> withFoo(final Foo foo) { + this.foo = foo; + return this; + } + @java.lang.SuppressWarnings("all") + public TestBuilder<Foo, Bar, Quz> withBar(final Bar bar) { + this.bar = bar; + return this; + } + @java.lang.SuppressWarnings("all") + public Test<Foo, Bar, Quz> build() { + return new Test<Foo, Bar, Quz>(foo, bar); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderWithRecursiveGenerics.Test.TestBuilder(foo=" + this.foo + ", bar=" + this.bar + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static <Foo, Bar extends Set<Foo>, Quz extends Inter<Bar, Quz>> TestBuilder<Foo, Bar, Quz> builder() { + return new TestBuilder<Foo, Bar, Quz>(); + } + @java.lang.SuppressWarnings("all") + public Foo getFoo() { + return this.foo; + } + @java.lang.SuppressWarnings("all") + public Bar getBar() { + return this.bar; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public boolean equals(final java.lang.Object o) { + if (o == this) return true; + if (!(o instanceof BuilderWithRecursiveGenerics.Test)) return false; + final BuilderWithRecursiveGenerics.Test<?, ?, ?> other = (BuilderWithRecursiveGenerics.Test<?, ?, ?>) o; + final java.lang.Object this$foo = this.getFoo(); + final java.lang.Object other$foo = other.getFoo(); + if (this$foo == null ? other$foo != null : !this$foo.equals(other$foo)) return false; + final java.lang.Object this$bar = this.getBar(); + final java.lang.Object other$bar = other.getBar(); + if (this$bar == null ? other$bar != null : !this$bar.equals(other$bar)) return false; + return true; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public int hashCode() { + final int PRIME = 59; + int result = 1; + final java.lang.Object $foo = this.getFoo(); + result = result * PRIME + ($foo == null ? 43 : $foo.hashCode()); + final java.lang.Object $bar = this.getBar(); + result = result * PRIME + ($bar == null ? 43 : $bar.hashCode()); + return result; + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderWithRecursiveGenerics.Test(foo=" + this.getFoo() + ", bar=" + this.getBar() + ")"; + } + } +} diff --git a/test/transform/resource/after-delombok/BuilderWithToBuilderWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithToBuilderWithSetterPrefix.java new file mode 100644 index 00000000..ac8264d3 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderWithToBuilderWithSetterPrefix.java @@ -0,0 +1,146 @@ +import java.util.List; +class BuilderWithToBuilder<T> { + private String mOne; + private String mTwo; + private T foo; + private List<T> bars; + public static <K> K rrr(BuilderWithToBuilder<K> x) { + return x.foo; + } + @java.lang.SuppressWarnings("all") + BuilderWithToBuilder(final String one, final String two, final T foo, final List<T> bars) { + this.mOne = one; + this.mTwo = two; + this.foo = foo; + this.bars = bars; + } + @java.lang.SuppressWarnings("all") + public static class BuilderWithToBuilderBuilder<T> { + @java.lang.SuppressWarnings("all") + private String one; + @java.lang.SuppressWarnings("all") + private String two; + @java.lang.SuppressWarnings("all") + private T foo; + @java.lang.SuppressWarnings("all") + private java.util.ArrayList<T> bars; + @java.lang.SuppressWarnings("all") + BuilderWithToBuilderBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderWithToBuilderBuilder<T> withOne(final String one) { + this.one = one; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithToBuilderBuilder<T> withTwo(final String two) { + this.two = two; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithToBuilderBuilder<T> withFoo(final T foo) { + this.foo = foo; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithToBuilderBuilder<T> withBar(final T bar) { + if (this.bars == null) this.bars = new java.util.ArrayList<T>(); + this.bars.add(bar); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithToBuilderBuilder<T> withBars(final java.util.Collection<? extends T> bars) { + if (this.bars == null) this.bars = new java.util.ArrayList<T>(); + this.bars.addAll(bars); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithToBuilderBuilder<T> clearBars() { + if (this.bars != null) this.bars.clear(); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithToBuilder<T> build() { + java.util.List<T> bars; + switch (this.bars == null ? 0 : this.bars.size()) { + case 0: + bars = java.util.Collections.emptyList(); + break; + case 1: + bars = java.util.Collections.singletonList(this.bars.get(0)); + break; + default: + bars = java.util.Collections.unmodifiableList(new java.util.ArrayList<T>(this.bars)); + } + return new BuilderWithToBuilder<T>(one, two, foo, bars); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderWithToBuilder.BuilderWithToBuilderBuilder(one=" + this.one + ", two=" + this.two + ", foo=" + this.foo + ", bars=" + this.bars + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static <T> BuilderWithToBuilderBuilder<T> builder() { + return new BuilderWithToBuilderBuilder<T>(); + } + @java.lang.SuppressWarnings("all") + public BuilderWithToBuilderBuilder<T> toBuilder() { + final BuilderWithToBuilderBuilder<T> builder = new BuilderWithToBuilderBuilder<T>().withOne(this.mOne).withTwo(this.mTwo).withFoo(BuilderWithToBuilder.<T>rrr(this)); + if (this.bars != null) builder.withBars(this.bars); + return builder; + } +} +class ConstructorWithToBuilder<T> { + private String mOne; + private String mTwo; + private T foo; + @lombok.Singular + private com.google.common.collect.ImmutableList<T> bars; + public ConstructorWithToBuilder(String mOne, T baz, com.google.common.collect.ImmutableList<T> bars) { + } + @java.lang.SuppressWarnings("all") + public static class ConstructorWithToBuilderBuilder<T> { + @java.lang.SuppressWarnings("all") + private String mOne; + @java.lang.SuppressWarnings("all") + private T baz; + @java.lang.SuppressWarnings("all") + private com.google.common.collect.ImmutableList<T> bars; + @java.lang.SuppressWarnings("all") + ConstructorWithToBuilderBuilder() { + } + @java.lang.SuppressWarnings("all") + public ConstructorWithToBuilderBuilder<T> withMOne(final String mOne) { + this.mOne = mOne; + return this; + } + @java.lang.SuppressWarnings("all") + public ConstructorWithToBuilderBuilder<T> withBaz(final T baz) { + this.baz = baz; + return this; + } + @java.lang.SuppressWarnings("all") + public ConstructorWithToBuilderBuilder<T> withBars(final com.google.common.collect.ImmutableList<T> bars) { + this.bars = bars; + return this; + } + @java.lang.SuppressWarnings("all") + public ConstructorWithToBuilder<T> build() { + return new ConstructorWithToBuilder<T>(mOne, baz, bars); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "ConstructorWithToBuilder.ConstructorWithToBuilderBuilder(mOne=" + this.mOne + ", baz=" + this.baz + ", bars=" + this.bars + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static <T> ConstructorWithToBuilderBuilder<T> builder() { + return new ConstructorWithToBuilderBuilder<T>(); + } + @java.lang.SuppressWarnings("all") + public ConstructorWithToBuilderBuilder<T> toBuilder() { + return new ConstructorWithToBuilderBuilder<T>().withMOne(this.mOne).withBaz(this.foo).withBars(this.bars); + } +} diff --git a/test/transform/resource/after-delombok/BuilderWithTolerateWithSetterPrefix.java b/test/transform/resource/after-delombok/BuilderWithTolerateWithSetterPrefix.java new file mode 100644 index 00000000..a3ae2c6d --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderWithTolerateWithSetterPrefix.java @@ -0,0 +1,40 @@ +import lombok.experimental.Tolerate; +public class BuilderWithTolerate { + private final int value; + public static void main(String[] args) { + BuilderWithTolerate.builder().withValue("42").build(); + } + public static class BuilderWithTolerateBuilder { + @java.lang.SuppressWarnings("all") + private int value; + @Tolerate + public BuilderWithTolerateBuilder withValue(String s) { + return this.withValue(Integer.parseInt(s)); + } + @java.lang.SuppressWarnings("all") + BuilderWithTolerateBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderWithTolerateBuilder withValue(final int value) { + this.value = value; + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderWithTolerate build() { + return new BuilderWithTolerate(value); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderWithTolerate.BuilderWithTolerateBuilder(value=" + this.value + ")"; + } + } + @java.lang.SuppressWarnings("all") + BuilderWithTolerate(final int value) { + this.value = value; + } + @java.lang.SuppressWarnings("all") + public static BuilderWithTolerateBuilder builder() { + return new BuilderWithTolerateBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderWithPrefix.java b/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java index 98c42fe9..98c42fe9 100644 --- a/test/transform/resource/after-ecj/BuilderWithPrefix.java +++ b/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java diff --git a/test/transform/resource/after-ecj/BuilderSingularAnnotatedTypesWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularAnnotatedTypesWithSetterPrefix.java new file mode 100644 index 00000000..02369861 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularAnnotatedTypesWithSetterPrefix.java @@ -0,0 +1,121 @@ +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; +import java.util.Set; +import java.util.Map; +import lombok.NonNull; +import lombok.Singular; +@Target(ElementType.TYPE_USE) @interface MyAnnotation { +} +@lombok.Builder(setterPrefix = "with") class BuilderSingularAnnotatedTypes { + public static @java.lang.SuppressWarnings("all") class BuilderSingularAnnotatedTypesBuilder { + private @java.lang.SuppressWarnings("all") java.util.ArrayList<@MyAnnotation @NonNull String> foos; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<@MyAnnotation @NonNull String> bars$key; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<@MyAnnotation @NonNull Integer> bars$value; + @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder withFoo(final @MyAnnotation @NonNull String foo) { + if ((foo == null)) + { + throw new java.lang.NullPointerException("foo is marked non-null but is null"); + } + if ((this.foos == null)) + this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>(); + this.foos.add(foo); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder withFoos(final java.util.Collection<? extends @MyAnnotation @NonNull String> foos) { + if ((this.foos == null)) + this.foos = new java.util.ArrayList<@MyAnnotation @NonNull String>(); + this.foos.addAll(foos); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder clearFoos() { + if ((this.foos != null)) + this.foos.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder withBar(final @MyAnnotation @NonNull String barKey, final @MyAnnotation @NonNull Integer barValue) { + if ((barKey == null)) + { + throw new java.lang.NullPointerException("barKey is marked non-null but is null"); + } + if ((barValue == null)) + { + throw new java.lang.NullPointerException("barValue is marked non-null but is null"); + } + if ((this.bars$key == null)) + { + this.bars$key = new java.util.ArrayList<@MyAnnotation @NonNull String>(); + this.bars$value = new java.util.ArrayList<@MyAnnotation @NonNull Integer>(); + } + this.bars$key.add(barKey); + this.bars$value.add(barValue); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder withBars(final java.util.Map<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> bars) { + if ((this.bars$key == null)) + { + this.bars$key = new java.util.ArrayList<@MyAnnotation @NonNull String>(); + this.bars$value = new java.util.ArrayList<@MyAnnotation @NonNull Integer>(); + } + for (java.util.Map.Entry<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> $lombokEntry : bars.entrySet()) + { + this.bars$key.add($lombokEntry.getKey()); + this.bars$value.add($lombokEntry.getValue()); + } + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder clearBars() { + if ((this.bars$key != null)) + { + this.bars$key.clear(); + this.bars$value.clear(); + } + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypes build() { + java.util.Set<@MyAnnotation @NonNull String> foos; + switch (((this.foos == null) ? 0 : this.foos.size())) { + case 0 : + foos = java.util.Collections.emptySet(); + break; + case 1 : + foos = java.util.Collections.singleton(this.foos.get(0)); + break; + default : + foos = new java.util.LinkedHashSet<@MyAnnotation @NonNull String>(((this.foos.size() < 0x40000000) ? ((1 + this.foos.size()) + ((this.foos.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE)); + foos.addAll(this.foos); + foos = java.util.Collections.unmodifiableSet(foos); + } + java.util.Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars; + switch (((this.bars$key == null) ? 0 : this.bars$key.size())) { + case 0 : + bars = java.util.Collections.emptyMap(); + break; + case 1 : + bars = java.util.Collections.singletonMap(this.bars$key.get(0), this.bars$value.get(0)); + break; + default : + bars = new java.util.LinkedHashMap<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer>(((this.bars$key.size() < 0x40000000) ? ((1 + this.bars$key.size()) + ((this.bars$key.size() - 3) / 3)) : java.lang.Integer.MAX_VALUE)); + for (int $i = 0;; ($i < this.bars$key.size()); $i ++) + bars.put(this.bars$key.get($i), this.bars$value.get($i)); + bars = java.util.Collections.unmodifiableMap(bars); + } + return new BuilderSingularAnnotatedTypes(foos, bars); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("BuilderSingularAnnotatedTypes.BuilderSingularAnnotatedTypesBuilder(foos=" + this.foos) + ", bars$key=") + this.bars$key) + ", bars$value=") + this.bars$value) + ")"); + } + } + private @Singular Set<@MyAnnotation @NonNull String> foos; + private @Singular Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars; + @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypes(final Set<@MyAnnotation @NonNull String> foos, final Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars) { + super(); + this.foos = foos; + this.bars = bars; + } + public static @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesBuilder builder() { + return new BuilderSingularAnnotatedTypesBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularGuavaListsSetsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularGuavaListsSetsWithSetterPrefix.java new file mode 100644 index 00000000..e9b0205d --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularGuavaListsSetsWithSetterPrefix.java @@ -0,0 +1,125 @@ +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 com.google.common.collect.ImmutableTable; +import lombok.Singular; +@lombok.Builder(setterPrefix = "with") class BuilderSingularGuavaListsSets<T> { + public static @java.lang.SuppressWarnings("all") class BuilderSingularGuavaListsSetsBuilder<T> { + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableList.Builder<T> cards; + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableList.Builder<Number> frogs; + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableSet.Builder<java.lang.Object> rawSet; + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableSortedSet.Builder<String> passes; + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableTable.Builder<Number, Number, String> users; + @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> withCard(final 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> withCards(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; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> clearCards() { + this.cards = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> withFrog(final 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> withFrogs(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; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> clearFrogs() { + this.frogs = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> withRawSet(final 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> withRawSet(final 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> clearRawSet() { + this.rawSet = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> withPass(final 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> withPasses(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; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> clearPasses() { + this.passes = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> withUser(final Number rowKey, final Number columnKey, final String value) { + if ((this.users == null)) + this.users = com.google.common.collect.ImmutableTable.builder(); + this.users.put(rowKey, columnKey, value); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> withUsers(final com.google.common.collect.Table<? extends Number, ? extends Number, ? extends String> users) { + if ((this.users == null)) + this.users = com.google.common.collect.ImmutableTable.builder(); + this.users.putAll(users); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsBuilder<T> clearUsers() { + this.users = null; + 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.<T>of() : this.cards.build()); + com.google.common.collect.ImmutableCollection<Number> frogs = ((this.frogs == null) ? com.google.common.collect.ImmutableList.<Number>of() : this.frogs.build()); + com.google.common.collect.ImmutableSet<java.lang.Object> rawSet = ((this.rawSet == null) ? com.google.common.collect.ImmutableSet.<java.lang.Object>of() : this.rawSet.build()); + com.google.common.collect.ImmutableSortedSet<String> passes = ((this.passes == null) ? com.google.common.collect.ImmutableSortedSet.<String>of() : this.passes.build()); + com.google.common.collect.ImmutableTable<Number, Number, String> users = ((this.users == null) ? com.google.common.collect.ImmutableTable.<Number, Number, String>of() : this.users.build()); + return new BuilderSingularGuavaListsSets<T>(cards, frogs, rawSet, passes, users); + } + 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) + ", users=") + this.users) + ")"); + } + } + private @Singular ImmutableList<T> cards; + private @Singular ImmutableCollection<? extends Number> frogs; + private @SuppressWarnings("all") @Singular("rawSet") ImmutableSet rawSet; + private @Singular ImmutableSortedSet<String> passes; + private @Singular ImmutableTable<? extends Number, ? extends Number, String> users; + @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSets(final ImmutableList<T> cards, final ImmutableCollection<? extends Number> frogs, final ImmutableSet rawSet, final ImmutableSortedSet<String> passes, final ImmutableTable<? extends Number, ? extends Number, String> users) { + super(); + this.cards = cards; + this.frogs = frogs; + this.rawSet = rawSet; + this.passes = passes; + this.users = users; + } + public static @java.lang.SuppressWarnings("all") <T>BuilderSingularGuavaListsSetsBuilder<T> builder() { + return new BuilderSingularGuavaListsSetsBuilder<T>(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularGuavaMapsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularGuavaMapsWithSetterPrefix.java new file mode 100644 index 00000000..fe1f0036 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularGuavaMapsWithSetterPrefix.java @@ -0,0 +1,83 @@ +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableBiMap; +import com.google.common.collect.ImmutableSortedMap; +import lombok.Singular; +@lombok.Builder(setterPrefix = "with") class BuilderSingularGuavaMaps<K, V> { + public static @java.lang.SuppressWarnings("all") class BuilderSingularGuavaMapsBuilder<K, V> { + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableMap.Builder<K, V> battleaxes; + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableSortedMap.Builder<Integer, V> vertices; + private @java.lang.SuppressWarnings("all") 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> withBattleaxe(final K key, final V value) { + if ((this.battleaxes == null)) + this.battleaxes = com.google.common.collect.ImmutableMap.builder(); + this.battleaxes.put(key, value); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder<K, V> withBattleaxes(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; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder<K, V> clearBattleaxes() { + this.battleaxes = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder<K, V> withVertex(final Integer key, final V value) { + if ((this.vertices == null)) + this.vertices = com.google.common.collect.ImmutableSortedMap.naturalOrder(); + this.vertices.put(key, value); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder<K, V> withVertices(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; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder<K, V> clearVertices() { + this.vertices = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder<K, V> withRawMap(final java.lang.Object key, final java.lang.Object value) { + if ((this.rawMap == null)) + this.rawMap = com.google.common.collect.ImmutableBiMap.builder(); + this.rawMap.put(key, value); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsBuilder<K, V> withRawMap(final 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") BuilderSingularGuavaMapsBuilder<K, V> clearRawMap() { + this.rawMap = null; + 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.<K, V>of() : this.battleaxes.build()); + com.google.common.collect.ImmutableSortedMap<Integer, V> vertices = ((this.vertices == null) ? com.google.common.collect.ImmutableSortedMap.<Integer, V>of() : this.vertices.build()); + com.google.common.collect.ImmutableBiMap<java.lang.Object, java.lang.Object> rawMap = ((this.rawMap == null) ? com.google.common.collect.ImmutableBiMap.<java.lang.Object, java.lang.Object>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/BuilderSingularListsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularListsWithSetterPrefix.java new file mode 100644 index 00000000..110cc2c3 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularListsWithSetterPrefix.java @@ -0,0 +1,116 @@ +import java.util.List; +import java.util.Collection; + +import lombok.Singular; +@lombok.Builder(setterPrefix = "with") class BuilderSingularLists<T> { + public static @java.lang.SuppressWarnings("all") class BuilderSingularListsBuilder<T> { + private @java.lang.SuppressWarnings("all") java.util.ArrayList<T> children; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<Number> scarves; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<java.lang.Object> rawList; + @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder<T> withChild(final 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> withChildren(final 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> clearChildren() { + if ((this.children != null)) + this.children.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder<T> withScarf(final 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> withScarves(final 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> clearScarves() { + if ((this.scarves != null)) + this.scarves.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularListsBuilder<T> withRawList(final 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> withRawList(final 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") BuilderSingularListsBuilder<T> clearRawList() { + if ((this.rawList != null)) + this.rawList.clear(); + 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 = java.util.Collections.unmodifiableList(new java.util.ArrayList<T>(this.children)); + } + java.util.Collection<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 = java.util.Collections.unmodifiableList(new java.util.ArrayList<Number>(this.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 = java.util.Collections.unmodifiableList(new java.util.ArrayList<java.lang.Object>(this.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>(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularMapsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularMapsWithSetterPrefix.java new file mode 100644 index 00000000..9193ccf9 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularMapsWithSetterPrefix.java @@ -0,0 +1,209 @@ +import java.util.Map; +import java.util.SortedMap; +import lombok.Singular; +@lombok.Builder(setterPrefix = "with") class BuilderSingularMaps<K, V> { + public static @java.lang.SuppressWarnings("all") class BuilderSingularMapsBuilder<K, V> { + private @java.lang.SuppressWarnings("all") java.util.ArrayList<K> women$key; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<V> women$value; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<K> men$key; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<Number> men$value; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<java.lang.Object> rawMap$key; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<java.lang.Object> rawMap$value; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> stringMap$key; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<V> stringMap$value; + @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> withWoman(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; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> withWomen(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 (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> clearWomen() { + if ((this.women$key != null)) + { + this.women$key.clear(); + this.women$value.clear(); + } + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> withMan(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; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> withMen(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 (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> clearMen() { + if ((this.men$key != null)) + { + this.men$key.clear(); + this.men$value.clear(); + } + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> withRawMap(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; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> withRawMap(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 (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> clearRawMap() { + if ((this.rawMap$key != null)) + { + this.rawMap$key.clear(); + this.rawMap$value.clear(); + } + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> withStringMap(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; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsBuilder<K, V> withStringMap(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 (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") BuilderSingularMapsBuilder<K, V> clearStringMap() { + if ((this.stringMap$key != null)) + { + this.stringMap$key.clear(); + this.stringMap$value.clear(); + } + 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>(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularNoAutoWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularNoAutoWithSetterPrefix.java new file mode 100644 index 00000000..a7754a99 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularNoAutoWithSetterPrefix.java @@ -0,0 +1,114 @@ +import java.util.List; +import lombok.Singular; +@lombok.Builder(setterPrefix = "with") class BuilderSingularNoAuto { + public static @java.lang.SuppressWarnings("all") class BuilderSingularNoAutoBuilder { + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> things; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> widgets; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> items; + @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder withThings(final String things) { + if ((this.things == null)) + this.things = new java.util.ArrayList<String>(); + this.things.add(things); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder withThings(final 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") BuilderSingularNoAutoBuilder clearThings() { + if ((this.things != null)) + this.things.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder withWidget(final String widget) { + if ((this.widgets == null)) + this.widgets = new java.util.ArrayList<String>(); + this.widgets.add(widget); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder withWidgets(final 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") BuilderSingularNoAutoBuilder clearWidgets() { + if ((this.widgets != null)) + this.widgets.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder withItems(final String items) { + if ((this.items == null)) + this.items = new java.util.ArrayList<String>(); + this.items.add(items); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoBuilder withItems(final 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") BuilderSingularNoAutoBuilder clearItems() { + if ((this.items != null)) + this.items.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAuto 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 = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.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 = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.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 = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.items)); + } + return new BuilderSingularNoAuto(things, widgets, items); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("BuilderSingularNoAuto.BuilderSingularNoAutoBuilder(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") BuilderSingularNoAuto(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") BuilderSingularNoAutoBuilder builder() { + return new BuilderSingularNoAutoBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularRedirectToGuavaWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularRedirectToGuavaWithSetterPrefix.java new file mode 100644 index 00000000..6f12f986 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularRedirectToGuavaWithSetterPrefix.java @@ -0,0 +1,83 @@ +import java.util.Set; +import java.util.NavigableMap; +import java.util.Collection; +import lombok.Singular; +@lombok.Builder(setterPrefix = "with") class BuilderSingularRedirectToGuava { + public static @java.lang.SuppressWarnings("all") class BuilderSingularRedirectToGuavaBuilder { + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableSet.Builder<String> dangerMice; + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableSortedMap.Builder<Integer, Number> things; + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableList.Builder<Class<?>> doohickeys; + @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder withDangerMouse(final 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 withDangerMice(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; + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder clearDangerMice() { + this.dangerMice = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder withThing(final Integer key, final Number value) { + if ((this.things == null)) + this.things = com.google.common.collect.ImmutableSortedMap.naturalOrder(); + this.things.put(key, value); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder withThings(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; + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder clearThings() { + this.things = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder withDoohickey(final 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 withDoohickeys(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; + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaBuilder clearDoohickeys() { + this.doohickeys = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuava build() { + java.util.Set<String> dangerMice = ((this.dangerMice == null) ? com.google.common.collect.ImmutableSet.<String>of() : this.dangerMice.build()); + java.util.NavigableMap<Integer, Number> things = ((this.things == null) ? com.google.common.collect.ImmutableSortedMap.<Integer, Number>of() : this.things.build()); + java.util.Collection<Class<?>> doohickeys = ((this.doohickeys == null) ? com.google.common.collect.ImmutableList.<Class<?>>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(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularSetsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularSetsWithSetterPrefix.java new file mode 100644 index 00000000..1bf552c5 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularSetsWithSetterPrefix.java @@ -0,0 +1,145 @@ +import java.util.Set; +import java.util.SortedSet; +import lombok.Singular; +@lombok.Builder(setterPrefix = "with") class BuilderSingularSets<T> { + public static @java.lang.SuppressWarnings("all") class BuilderSingularSetsBuilder<T> { + private @java.lang.SuppressWarnings("all") java.util.ArrayList<T> dangerMice; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<Number> octopodes; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<java.lang.Object> rawSet; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> stringSet; + @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> dangerMouse(final 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(final 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> clearDangerMice() { + if ((this.dangerMice != null)) + this.dangerMice.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> octopus(final 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(final 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> clearOctopodes() { + if ((this.octopodes != null)) + this.octopodes.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") 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; + } + public @java.lang.SuppressWarnings("all") 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; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> clearRawSet() { + if ((this.rawSet != null)) + this.rawSet.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsBuilder<T> stringSet(final 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(final 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") BuilderSingularSetsBuilder<T> clearStringSet() { + if ((this.stringSet != null)) + this.stringSet.clear(); + 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>(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNullWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNullWithSetterPrefix.java new file mode 100644 index 00000000..086e0701 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNullWithSetterPrefix.java @@ -0,0 +1,60 @@ +import lombok.Singular; +@lombok.Builder(toBuilder = true, setterPrefix = "with") class BuilderSingularToBuilderWithNull { + public static @java.lang.SuppressWarnings("all") class BuilderSingularToBuilderWithNullBuilder { + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> elems; + @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullBuilder withElem(final String elem) { + if ((this.elems == null)) + this.elems = new java.util.ArrayList<String>(); + this.elems.add(elem); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullBuilder withElems(final java.util.Collection<? extends String> elems) { + if ((this.elems == null)) + this.elems = new java.util.ArrayList<String>(); + this.elems.addAll(elems); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullBuilder clearElems() { + if ((this.elems != null)) + this.elems.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNull build() { + java.util.List<String> elems; + switch (((this.elems == null) ? 0 : this.elems.size())) { + case 0 : + elems = java.util.Collections.emptyList(); + break; + case 1 : + elems = java.util.Collections.singletonList(this.elems.get(0)); + break; + default : + elems = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.elems)); + } + return new BuilderSingularToBuilderWithNull(elems); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderSingularToBuilderWithNull.BuilderSingularToBuilderWithNullBuilder(elems=" + this.elems) + ")"); + } + } + private @Singular java.util.List<String> elems; + public static void test() { + new BuilderSingularToBuilderWithNull(null).toBuilder(); + } + @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNull(final java.util.List<String> elems) { + super(); + this.elems = elems; + } + public static @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullBuilder builder() { + return new BuilderSingularToBuilderWithNullBuilder(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullBuilder toBuilder() { + final BuilderSingularToBuilderWithNullBuilder builder = new BuilderSingularToBuilderWithNullBuilder(); + if ((this.elems != null)) + builder.elems(this.elems); + return builder; + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java new file mode 100644 index 00000000..635b6a79 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java @@ -0,0 +1,92 @@ +import java.util.List; +import java.util.Collection; +import lombok.Singular; +@lombok.Builder(toBuilder = true, setterPrefix = "with") class BuilderSingularWildcardListsWithToBuilder { + public static @java.lang.SuppressWarnings("all") class BuilderSingularWildcardListsWithToBuilderBuilder { + private @java.lang.SuppressWarnings("all") java.util.ArrayList<java.lang.Object> objects; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<Number> numbers; + @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderBuilder withObject(final java.lang.Object object) { + if ((this.objects == null)) + this.objects = new java.util.ArrayList<java.lang.Object>(); + this.objects.add(object); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderBuilder withObjects(final java.util.Collection<?> objects) { + if ((this.objects == null)) + this.objects = new java.util.ArrayList<java.lang.Object>(); + this.objects.addAll(objects); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderBuilder clearObjects() { + if ((this.objects != null)) + this.objects.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderBuilder withNumber(final Number number) { + if ((this.numbers == null)) + this.numbers = new java.util.ArrayList<Number>(); + this.numbers.add(number); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderBuilder withNumbers(final java.util.Collection<? extends Number> numbers) { + if ((this.numbers == null)) + this.numbers = new java.util.ArrayList<Number>(); + this.numbers.addAll(numbers); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderBuilder clearNumbers() { + if ((this.numbers != null)) + this.numbers.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilder build() { + java.util.List<java.lang.Object> objects; + switch (((this.objects == null) ? 0 : this.objects.size())) { + case 0 : + objects = java.util.Collections.emptyList(); + break; + case 1 : + objects = java.util.Collections.singletonList(this.objects.get(0)); + break; + default : + objects = java.util.Collections.unmodifiableList(new java.util.ArrayList<java.lang.Object>(this.objects)); + } + java.util.Collection<Number> numbers; + switch (((this.numbers == null) ? 0 : this.numbers.size())) { + case 0 : + numbers = java.util.Collections.emptyList(); + break; + case 1 : + numbers = java.util.Collections.singletonList(this.numbers.get(0)); + break; + default : + numbers = java.util.Collections.unmodifiableList(new java.util.ArrayList<Number>(this.numbers)); + } + return new BuilderSingularWildcardListsWithToBuilder(objects, numbers); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("BuilderSingularWildcardListsWithToBuilder.BuilderSingularWildcardListsWithToBuilderBuilder(objects=" + this.objects) + ", numbers=") + this.numbers) + ")"); + } + } + private @Singular List<?> objects; + private @Singular Collection<? extends Number> numbers; + @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilder(final List<?> objects, final Collection<? extends Number> numbers) { + super(); + this.objects = objects; + this.numbers = numbers; + } + public static @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderBuilder builder() { + return new BuilderSingularWildcardListsWithToBuilderBuilder(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderBuilder toBuilder() { + final BuilderSingularWildcardListsWithToBuilderBuilder builder = new BuilderSingularWildcardListsWithToBuilderBuilder(); + if ((this.objects != null)) + builder.objects(this.objects); + if ((this.numbers != null)) + builder.numbers(this.numbers); + return builder; + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularWithPrefixesWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularWithPrefixesWithSetterPrefix.java new file mode 100644 index 00000000..d9cea692 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularWithPrefixesWithSetterPrefix.java @@ -0,0 +1,51 @@ +import lombok.Singular; +@lombok.Builder(setterPrefix = "with") @lombok.experimental.Accessors(prefix = "_") class BuilderSingularWithPrefixes { + public static @java.lang.SuppressWarnings("all") class BuilderSingularWithPrefixesBuilder { + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> elems; + @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesBuilder withElem(final String elem) { + if ((this.elems == null)) + this.elems = new java.util.ArrayList<String>(); + this.elems.add(elem); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesBuilder withElems(final java.util.Collection<? extends String> elems) { + if ((this.elems == null)) + this.elems = new java.util.ArrayList<String>(); + this.elems.addAll(elems); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesBuilder clearElems() { + if ((this.elems != null)) + this.elems.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixes build() { + java.util.List<String> elems; + switch (((this.elems == null) ? 0 : this.elems.size())) { + case 0 : + elems = java.util.Collections.emptyList(); + break; + case 1 : + elems = java.util.Collections.singletonList(this.elems.get(0)); + break; + default : + elems = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.elems)); + } + return new BuilderSingularWithPrefixes(elems); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderSingularWithPrefixes.BuilderSingularWithPrefixesBuilder(elems=" + this.elems) + ")"); + } + } + private @Singular java.util.List<String> _elems; + @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixes(final java.util.List<String> elems) { + super(); + this._elems = elems; + } + public static @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesBuilder builder() { + return new BuilderSingularWithPrefixesBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderTypeAnnosWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderTypeAnnosWithSetterPrefix.java new file mode 100644 index 00000000..ed62dc85 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderTypeAnnosWithSetterPrefix.java @@ -0,0 +1,33 @@ +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; +import java.util.List; +@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @interface TA { +} +@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @interface TB { +} +@lombok.Builder(setterPrefix = "with") class BuilderTypeAnnos { + public static @java.lang.SuppressWarnings("all") class BuilderTypeAnnosBuilder { + private @java.lang.SuppressWarnings("all") List<String> foo; + @java.lang.SuppressWarnings("all") BuilderTypeAnnosBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderTypeAnnosBuilder withFoo(final @TA List<String> foo) { + this.foo = foo; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderTypeAnnos build() { + return new BuilderTypeAnnos(foo); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderTypeAnnos.BuilderTypeAnnosBuilder(foo=" + this.foo) + ")"); + } + } + private @TA @TB List<String> foo; + @java.lang.SuppressWarnings("all") BuilderTypeAnnos(final @TA List<String> foo) { + super(); + this.foo = foo; + } + public static @java.lang.SuppressWarnings("all") BuilderTypeAnnosBuilder builder() { + return new BuilderTypeAnnosBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderValueDataWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderValueDataWithSetterPrefix.java new file mode 100644 index 00000000..ffecad46 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderValueDataWithSetterPrefix.java @@ -0,0 +1,90 @@ +import java.util.List; +final @lombok.Builder(setterPrefix = "with") @lombok.Value class BuilderAndValue { + public static @java.lang.SuppressWarnings("all") class BuilderAndValueBuilder { + @java.lang.SuppressWarnings("all") BuilderAndValueBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderAndValue build() { + return new BuilderAndValue(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return "BuilderAndValue.BuilderAndValueBuilder()"; + } + } + private final int zero = 0; + @java.lang.SuppressWarnings("all") BuilderAndValue() { + super(); + } + public static @java.lang.SuppressWarnings("all") BuilderAndValueBuilder builder() { + return new BuilderAndValueBuilder(); + } + public @java.lang.SuppressWarnings("all") int getZero() { + return this.zero; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof BuilderAndValue))) + return false; + final BuilderAndValue other = (BuilderAndValue) o; + if ((this.getZero() != other.getZero())) + return false; + return true; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + final int PRIME = 59; + int result = 1; + result = ((result * PRIME) + this.getZero()); + return result; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderAndValue(zero=" + this.getZero()) + ")"); + } +} +@lombok.Builder @lombok.Data class BuilderAndData { + public static @java.lang.SuppressWarnings("all") class BuilderAndDataBuilder { + @java.lang.SuppressWarnings("all") BuilderAndDataBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderAndData build() { + return new BuilderAndData(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return "BuilderAndData.BuilderAndDataBuilder()"; + } + } + private final int zero = 0; + @java.lang.SuppressWarnings("all") BuilderAndData() { + super(); + } + public static @java.lang.SuppressWarnings("all") BuilderAndDataBuilder builder() { + return new BuilderAndDataBuilder(); + } + public @java.lang.SuppressWarnings("all") int getZero() { + return this.zero; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof BuilderAndData))) + return false; + final BuilderAndData other = (BuilderAndData) o; + if ((! other.canEqual((java.lang.Object) this))) + return false; + if ((this.getZero() != other.getZero())) + return false; + return true; + } + protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) { + return (other instanceof BuilderAndData); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + final int PRIME = 59; + int result = 1; + result = ((result * PRIME) + this.getZero()); + return result; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderAndData(zero=" + this.getZero()) + ")"); + } +} diff --git a/test/transform/resource/after-ecj/BuilderWithAccessorsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithAccessorsWithSetterPrefix.java new file mode 100644 index 00000000..388e813d --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithAccessorsWithSetterPrefix.java @@ -0,0 +1,47 @@ +@lombok.Builder(setterPrefix = "with") @lombok.experimental.Accessors(prefix = {"p", "_"}) class BuilderWithAccessors { + public static @java.lang.SuppressWarnings("all") class BuilderWithAccessorsBuilder { + private @java.lang.SuppressWarnings("all") int plower; + private @java.lang.SuppressWarnings("all") int upper; + private @java.lang.SuppressWarnings("all") int foo; + private @java.lang.SuppressWarnings("all") int _bar; + @java.lang.SuppressWarnings("all") BuilderWithAccessorsBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderWithAccessorsBuilder withPlower(final int plower) { + this.plower = plower; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithAccessorsBuilder withUpper(final int upper) { + this.upper = upper; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithAccessorsBuilder withFoo(final int foo) { + this.foo = foo; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithAccessorsBuilder with_Bar(final int _bar) { + this._bar = _bar; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithAccessors build() { + return new BuilderWithAccessors(plower, upper, foo, _bar); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((((("BuilderWithAccessors.BuilderWithAccessorsBuilder(plower=" + this.plower) + ", upper=") + this.upper) + ", foo=") + this.foo) + ", _bar=") + this._bar) + ")"); + } + } + private final int plower; + private final int pUpper; + private int _foo; + private int __bar; + @java.lang.SuppressWarnings("all") BuilderWithAccessors(final int plower, final int upper, final int foo, final int _bar) { + super(); + this.plower = plower; + this.pUpper = upper; + this._foo = foo; + this.__bar = _bar; + } + public static @java.lang.SuppressWarnings("all") BuilderWithAccessorsBuilder builder() { + return new BuilderWithAccessorsBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderWithBadNamesWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithBadNamesWithSetterPrefix.java new file mode 100644 index 00000000..465517f7 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithBadNamesWithSetterPrefix.java @@ -0,0 +1,33 @@ +public @lombok.Builder(setterPrefix = "with") class BuilderWithBadNames { + public static @java.lang.SuppressWarnings("all") class BuilderWithBadNamesBuilder { + private @java.lang.SuppressWarnings("all") String build; + private @java.lang.SuppressWarnings("all") String toString; + @java.lang.SuppressWarnings("all") BuilderWithBadNamesBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderWithBadNamesBuilder withBuild(final String build) { + this.build = build; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithBadNamesBuilder withToString(final String toString) { + this.toString = toString; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithBadNames build() { + return new BuilderWithBadNames(build, toString); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("BuilderWithBadNames.BuilderWithBadNamesBuilder(build=" + this.build) + ", toString=") + this.toString) + ")"); + } + } + String build; + String toString; + @java.lang.SuppressWarnings("all") BuilderWithBadNames(final String build, final String toString) { + super(); + this.build = build; + this.toString = toString; + } + public static @java.lang.SuppressWarnings("all") BuilderWithBadNamesBuilder builder() { + return new BuilderWithBadNamesBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderWithDeprecatedWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithDeprecatedWithSetterPrefix.java new file mode 100644 index 00000000..0d8e023f --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithDeprecatedWithSetterPrefix.java @@ -0,0 +1,87 @@ +import com.google.common.collect.ImmutableList; +import lombok.Builder; +import lombok.Singular; +public @Builder(setterPrefix = "with") class BuilderWithDeprecated { + public static @java.lang.SuppressWarnings("all") class BuilderWithDeprecatedBuilder { + private @java.lang.SuppressWarnings("all") String dep1; + private @java.lang.SuppressWarnings("all") int dep2; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> strings; + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableList.Builder<Integer> numbers; + @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder() { + super(); + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder withDep1(final String dep1) { + this.dep1 = dep1; + return this; + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder withDep2(final int dep2) { + this.dep2 = dep2; + return this; + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder withString(final String string) { + if ((this.strings == null)) + this.strings = new java.util.ArrayList<String>(); + this.strings.add(string); + return this; + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder withStrings(final java.util.Collection<? extends String> strings) { + if ((this.strings == null)) + this.strings = new java.util.ArrayList<String>(); + this.strings.addAll(strings); + return this; + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder clearStrings() { + if ((this.strings != null)) + this.strings.clear(); + return this; + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder withNumber(final Integer number) { + if ((this.numbers == null)) + this.numbers = com.google.common.collect.ImmutableList.builder(); + this.numbers.add(number); + return this; + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder withNumbers(final java.lang.Iterable<? extends Integer> numbers) { + if ((this.numbers == null)) + this.numbers = com.google.common.collect.ImmutableList.builder(); + this.numbers.addAll(numbers); + return this; + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder clearNumbers() { + this.numbers = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithDeprecated build() { + java.util.List<String> strings; + switch (((this.strings == null) ? 0 : this.strings.size())) { + case 0 : + strings = java.util.Collections.emptyList(); + break; + case 1 : + strings = java.util.Collections.singletonList(this.strings.get(0)); + break; + default : + strings = java.util.Collections.unmodifiableList(new java.util.ArrayList<String>(this.strings)); + } + com.google.common.collect.ImmutableList<Integer> numbers = ((this.numbers == null) ? com.google.common.collect.ImmutableList.<Integer>of() : this.numbers.build()); + return new BuilderWithDeprecated(dep1, dep2, strings, numbers); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((((("BuilderWithDeprecated.BuilderWithDeprecatedBuilder(dep1=" + this.dep1) + ", dep2=") + this.dep2) + ", strings=") + this.strings) + ", numbers=") + this.numbers) + ")"); + } + } + String dep1; + @Deprecated int dep2; + @Singular @Deprecated java.util.List<String> strings; + @Singular @Deprecated ImmutableList<Integer> numbers; + @java.lang.SuppressWarnings("all") BuilderWithDeprecated(final String dep1, final int dep2, final java.util.List<String> strings, final ImmutableList<Integer> numbers) { + super(); + this.dep1 = dep1; + this.dep2 = dep2; + this.strings = strings; + this.numbers = numbers; + } + public static @java.lang.SuppressWarnings("all") BuilderWithDeprecatedBuilder builder() { + return new BuilderWithDeprecatedBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java new file mode 100644 index 00000000..220a8a63 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java @@ -0,0 +1,36 @@ +import lombok.Builder; +class BuilderWithExistingBuilderClass<T, K extends Number> { + public static class BuilderWithExistingBuilderClassBuilder<Z extends Number> { + private @java.lang.SuppressWarnings("all") boolean arg2; + private @java.lang.SuppressWarnings("all") String arg3; + private Z arg1; + public void withArg2(boolean arg) { + } + @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassBuilder<Z> withArg1(final Z arg1) { + this.arg1 = arg1; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassBuilder<Z> withArg3(final String arg3) { + this.arg3 = arg3; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClass<String, Z> build() { + return BuilderWithExistingBuilderClass.<Z>staticMethod(arg1, arg2, arg3); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("BuilderWithExistingBuilderClass.BuilderWithExistingBuilderClassBuilder(arg1=" + this.arg1) + ", arg2=") + this.arg2) + ", arg3=") + this.arg3) + ")"); + } + } + BuilderWithExistingBuilderClass() { + super(); + } + public static @Builder(setterPrefix = "with") <Z extends Number>BuilderWithExistingBuilderClass<String, Z> staticMethod(Z arg1, boolean arg2, String arg3) { + return null; + } + public static @java.lang.SuppressWarnings("all") <Z extends Number>BuilderWithExistingBuilderClassBuilder<Z> builder() { + return new BuilderWithExistingBuilderClassBuilder<Z>(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderWithNoBuilderMethodWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithNoBuilderMethodWithSetterPrefix.java new file mode 100644 index 00000000..0b934767 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithNoBuilderMethodWithSetterPrefix.java @@ -0,0 +1,27 @@ +import lombok.Builder; +@Builder(toBuilder = true,builderMethodName = "",setterPrefix = "with") class BuilderWithNoBuilderMethod { + public static @java.lang.SuppressWarnings("all") class BuilderWithNoBuilderMethodBuilder { + private @java.lang.SuppressWarnings("all") String a; + @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodBuilder withA(final String a) { + this.a = a; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethod build() { + return new BuilderWithNoBuilderMethod(a); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderWithNoBuilderMethod.BuilderWithNoBuilderMethodBuilder(a=" + this.a) + ")"); + } + } + private String a = ""; + @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethod(final String a) { + super(); + this.a = a; + } + public @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodBuilder toBuilder() { + return new BuilderWithNoBuilderMethodBuilder().withA(this.a); + } +} diff --git a/test/transform/resource/after-ecj/BuilderWithNonNullWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithNonNullWithSetterPrefix.java new file mode 100644 index 00000000..6379e25f --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithNonNullWithSetterPrefix.java @@ -0,0 +1,34 @@ +@lombok.Builder(setterPrefix = "with") class BuilderWithNonNull { + public static @java.lang.SuppressWarnings("all") class BuilderWithNonNullBuilder { + private @java.lang.SuppressWarnings("all") String id; + @java.lang.SuppressWarnings("all") BuilderWithNonNullBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderWithNonNullBuilder withId(final @lombok.NonNull String id) { + if ((id == null)) + { + throw new java.lang.NullPointerException("id is marked non-null but is null"); + } + this.id = id; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithNonNull build() { + return new BuilderWithNonNull(id); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderWithNonNull.BuilderWithNonNullBuilder(id=" + this.id) + ")"); + } + } + private final @lombok.NonNull String id; + @java.lang.SuppressWarnings("all") BuilderWithNonNull(final @lombok.NonNull String id) { + super(); + if ((id == null)) + { + throw new java.lang.NullPointerException("id is marked non-null but is null"); + } + this.id = id; + } + public static @java.lang.SuppressWarnings("all") BuilderWithNonNullBuilder builder() { + return new BuilderWithNonNullBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderWithRecursiveGenericsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithRecursiveGenericsWithSetterPrefix.java new file mode 100644 index 00000000..32b9c20e --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithRecursiveGenericsWithSetterPrefix.java @@ -0,0 +1,78 @@ +import java.util.Set; +import lombok.Builder; +import lombok.Value; +public class BuilderWithRecursiveGenerics { + interface Inter<T, U extends Inter<T, U>> { + } + public static final @Builder(setterPrefix = "with(setterPrefix = "with")") @Value class Test<Foo, Bar extends Set<Foo>, Quz extends Inter<Bar, Quz>> { + public static @java.lang.SuppressWarnings("all") class TestBuilder<Foo, Bar extends Set<Foo>, Quz extends Inter<Bar, Quz>> { + private @java.lang.SuppressWarnings("all") Foo foo; + private @java.lang.SuppressWarnings("all") Bar bar; + @java.lang.SuppressWarnings("all") TestBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") TestBuilder<Foo, Bar, Quz> withFoo(final Foo foo) { + this.foo = foo; + return this; + } + public @java.lang.SuppressWarnings("all") TestBuilder<Foo, Bar, Quz> withBar(final Bar bar) { + this.bar = bar; + return this; + } + public @java.lang.SuppressWarnings("all") Test<Foo, Bar, Quz> build() { + return new Test<Foo, Bar, Quz>(foo, bar); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("BuilderWithRecursiveGenerics.Test.TestBuilder(foo=" + this.foo) + ", bar=") + this.bar) + ")"); + } + } + private final Foo foo; + private final Bar bar; + @java.lang.SuppressWarnings("all") Test(final Foo foo, final Bar bar) { + super(); + this.foo = foo; + this.bar = bar; + } + public static @java.lang.SuppressWarnings("all") <Foo, Bar extends Set<Foo>, Quz extends Inter<Bar, Quz>>TestBuilder<Foo, Bar, Quz> builder() { + return new TestBuilder<Foo, Bar, Quz>(); + } + public @java.lang.SuppressWarnings("all") Foo getFoo() { + return this.foo; + } + public @java.lang.SuppressWarnings("all") Bar getBar() { + return this.bar; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { + if ((o == this)) + return true; + if ((! (o instanceof BuilderWithRecursiveGenerics.Test))) + return false; + final BuilderWithRecursiveGenerics.Test<?, ?, ?> other = (BuilderWithRecursiveGenerics.Test<?, ?, ?>) o; + final java.lang.Object this$foo = this.getFoo(); + final java.lang.Object other$foo = other.getFoo(); + if (((this$foo == null) ? (other$foo != null) : (! this$foo.equals(other$foo)))) + return false; + final java.lang.Object this$bar = this.getBar(); + final java.lang.Object other$bar = other.getBar(); + if (((this$bar == null) ? (other$bar != null) : (! this$bar.equals(other$bar)))) + return false; + return true; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() { + final int PRIME = 59; + int result = 1; + final java.lang.Object $foo = this.getFoo(); + result = ((result * PRIME) + (($foo == null) ? 43 : $foo.hashCode())); + final java.lang.Object $bar = this.getBar(); + result = ((result * PRIME) + (($bar == null) ? 43 : $bar.hashCode())); + return result; + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("BuilderWithRecursiveGenerics.Test(foo=" + this.getFoo()) + ", bar=") + this.getBar()) + ")"); + } + } + public BuilderWithRecursiveGenerics() { + super(); + } +} + diff --git a/test/transform/resource/after-ecj/BuilderWithToBuilderWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithToBuilderWithSetterPrefix.java new file mode 100644 index 00000000..85378cab --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithToBuilderWithSetterPrefix.java @@ -0,0 +1,123 @@ +import java.util.List; +import lombok.Builder; +@Builder(toBuilder = true,setterPrefix = "with") @lombok.experimental.Accessors(prefix = "m") class BuilderWithToBuilder<T> { + public static @java.lang.SuppressWarnings("all") class BuilderWithToBuilderBuilder<T> { + private @java.lang.SuppressWarnings("all") String one; + private @java.lang.SuppressWarnings("all") String two; + private @java.lang.SuppressWarnings("all") T foo; + private @java.lang.SuppressWarnings("all") java.util.ArrayList<T> bars; + @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder<T> withOne(final String one) { + this.one = one; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder<T> withTwo(final String two) { + this.two = two; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder<T> withFoo(final T foo) { + this.foo = foo; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder<T> withBar(final T bar) { + if ((this.bars == null)) + this.bars = new java.util.ArrayList<T>(); + this.bars.add(bar); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder<T> withBars(final java.util.Collection<? extends T> bars) { + if ((this.bars == null)) + this.bars = new java.util.ArrayList<T>(); + this.bars.addAll(bars); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder<T> clearBars() { + if ((this.bars != null)) + this.bars.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithToBuilder<T> build() { + java.util.List<T> bars; + switch (((this.bars == null) ? 0 : this.bars.size())) { + case 0 : + bars = java.util.Collections.emptyList(); + break; + case 1 : + bars = java.util.Collections.singletonList(this.bars.get(0)); + break; + default : + bars = java.util.Collections.unmodifiableList(new java.util.ArrayList<T>(this.bars)); + } + return new BuilderWithToBuilder<T>(one, two, foo, bars); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((((("BuilderWithToBuilder.BuilderWithToBuilderBuilder(one=" + this.one) + ", two=") + this.two) + ", foo=") + this.foo) + ", bars=") + this.bars) + ")"); + } + } + private String mOne; + private String mTwo; + private @Builder.ObtainVia(method = "rrr",isStatic = true) T foo; + private @lombok.Singular List<T> bars; + public static <K>K rrr(BuilderWithToBuilder<K> x) { + return x.foo; + } + @java.lang.SuppressWarnings("all") BuilderWithToBuilder(final String one, final String two, final T foo, final List<T> bars) { + super(); + this.mOne = one; + this.mTwo = two; + this.foo = foo; + this.bars = bars; + } + public static @java.lang.SuppressWarnings("all") <T>BuilderWithToBuilderBuilder<T> builder() { + return new BuilderWithToBuilderBuilder<T>(); + } + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderBuilder<T> toBuilder() { + final BuilderWithToBuilderBuilder<T> builder = new BuilderWithToBuilderBuilder<T>().withOne(this.mOne).withTwo(this.mTwo).withFoo(BuilderWithToBuilder.<T>rrr(this)); + if ((this.bars != null)) + builder.withBars(this.bars); + return builder; + } +} +@lombok.experimental.Accessors(prefix = "m") class ConstructorWithToBuilder<T> { + public static @java.lang.SuppressWarnings("all") class ConstructorWithToBuilderBuilder<T> { + private @java.lang.SuppressWarnings("all") String mOne; + private @java.lang.SuppressWarnings("all") T baz; + private @java.lang.SuppressWarnings("all") com.google.common.collect.ImmutableList<T> bars; + @java.lang.SuppressWarnings("all") ConstructorWithToBuilderBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") ConstructorWithToBuilderBuilder<T> withMOne(final String mOne) { + this.mOne = mOne; + return this; + } + public @java.lang.SuppressWarnings("all") ConstructorWithToBuilderBuilder<T> withBaz(final T baz) { + this.baz = baz; + return this; + } + public @java.lang.SuppressWarnings("all") ConstructorWithToBuilderBuilder<T> withBars(final com.google.common.collect.ImmutableList<T> bars) { + this.bars = bars; + return this; + } + public @java.lang.SuppressWarnings("all") ConstructorWithToBuilder<T> build() { + return new ConstructorWithToBuilder<T>(mOne, baz, bars); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("ConstructorWithToBuilder.ConstructorWithToBuilderBuilder(mOne=" + this.mOne) + ", baz=") + this.baz) + ", bars=") + this.bars) + ")"); + } + } + private String mOne; + private String mTwo; + private T foo; + private @lombok.Singular com.google.common.collect.ImmutableList<T> bars; + public @Builder(toBuilder = true) ConstructorWithToBuilder(String mOne, @Builder.ObtainVia(field = "foo") T baz, com.google.common.collect.ImmutableList<T> bars) { + super(); + } + public static @java.lang.SuppressWarnings("all") <T>ConstructorWithToBuilderBuilder<T> builder() { + return new ConstructorWithToBuilderBuilder<T>(); + } + public @java.lang.SuppressWarnings("all") ConstructorWithToBuilderBuilder<T> toBuilder() { + return new ConstructorWithToBuilderBuilder<T>().withMOne(this.mOne).withBaz(this.foo).withBars(this.bars); + } +} diff --git a/test/transform/resource/after-ecj/BuilderWithTolerateWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithTolerateWithSetterPrefix.java new file mode 100644 index 00000000..a795bafc --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithTolerateWithSetterPrefix.java @@ -0,0 +1,34 @@ +import lombok.Builder; +import lombok.experimental.Tolerate; +public @Builder(setterPrefix = "with") class BuilderWithTolerate { + public static class BuilderWithTolerateBuilder { + private @java.lang.SuppressWarnings("all") int value; + public @Tolerate BuilderWithTolerateBuilder withValue(String s) { + return this.withValue(Integer.parseInt(s)); + } + @java.lang.SuppressWarnings("all") BuilderWithTolerateBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderWithTolerateBuilder withValue(final int value) { + this.value = value; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithTolerate build() { + return new BuilderWithTolerate(value); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderWithTolerate.BuilderWithTolerateBuilder(value=" + this.value) + ")"); + } + } + private final int value; + public static void main(String[] args) { + BuilderWithTolerate.builder().withValue("42").build(); + } + @java.lang.SuppressWarnings("all") BuilderWithTolerate(final int value) { + super(); + this.value = value; + } + public static @java.lang.SuppressWarnings("all") BuilderWithTolerateBuilder builder() { + return new BuilderWithTolerateBuilder(); + } +} diff --git a/test/transform/resource/before/BuilderWithPrefix.java b/test/transform/resource/before/BuilderSimpleWithSetterPrefix.java index 38f3c029..38f3c029 100644 --- a/test/transform/resource/before/BuilderWithPrefix.java +++ b/test/transform/resource/before/BuilderSimpleWithSetterPrefix.java diff --git a/test/transform/resource/before/BuilderSingularAnnotatedTypesWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularAnnotatedTypesWithSetterPrefix.java new file mode 100644 index 00000000..2ef83429 --- /dev/null +++ b/test/transform/resource/before/BuilderSingularAnnotatedTypesWithSetterPrefix.java @@ -0,0 +1,14 @@ +//VERSION 8: +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; +import java.util.Set; +import java.util.Map; +import lombok.NonNull; +import lombok.Singular; +@Target(ElementType.TYPE_USE) +@interface MyAnnotation {} +@lombok.Builder(setterPrefix = "with") +class BuilderSingularAnnotatedTypes { + @Singular private Set<@MyAnnotation @NonNull String> foos; + @Singular private Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars; +} diff --git a/test/transform/resource/before/BuilderSingularGuavaListsSetsWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularGuavaListsSetsWithSetterPrefix.java new file mode 100644 index 00000000..678b2e9f --- /dev/null +++ b/test/transform/resource/before/BuilderSingularGuavaListsSetsWithSetterPrefix.java @@ -0,0 +1,16 @@ +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 com.google.common.collect.ImmutableTable; + +import lombok.Singular; + +@lombok.Builder(setterPrefix = "with") +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; + @Singular private ImmutableTable<? extends Number, ? extends Number, String> users; +} diff --git a/test/transform/resource/before/BuilderSingularGuavaMapsWithPrefix.java b/test/transform/resource/before/BuilderSingularGuavaMapsWithPrefix.java new file mode 100644 index 00000000..89de9a9c --- /dev/null +++ b/test/transform/resource/before/BuilderSingularGuavaMapsWithPrefix.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(setterPrefix = "with") +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/BuilderSingularListsWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularListsWithSetterPrefix.java new file mode 100644 index 00000000..101e7972 --- /dev/null +++ b/test/transform/resource/before/BuilderSingularListsWithSetterPrefix.java @@ -0,0 +1,11 @@ +import java.util.List; +import java.util.Collection; + +import lombok.Singular; + +@lombok.Builder(setterPrefix = "with") +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/BuilderSingularMapsWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularMapsWithSetterPrefix.java new file mode 100644 index 00000000..e77bcf6e --- /dev/null +++ b/test/transform/resource/before/BuilderSingularMapsWithSetterPrefix.java @@ -0,0 +1,15 @@ +//FORMAT: javaLangAsFQN = skip +//FORMAT: generated = skip +//FORMAT: finalParams = skip +import java.util.Map; +import java.util.SortedMap; + +import lombok.Singular; + +@lombok.Builder(setterPrefix = "with") +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/BuilderSingularNoAutoWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularNoAutoWithSetterPrefix.java new file mode 100644 index 00000000..0474c764 --- /dev/null +++ b/test/transform/resource/before/BuilderSingularNoAutoWithSetterPrefix.java @@ -0,0 +1,11 @@ +//CONF: lombok.singular.auto = false +import java.util.List; + +import lombok.Singular; + +@lombok.Builder(setterPrefix = "with") +class BuilderSingularNoAuto { + @Singular private List<String> things; + @Singular("widget") private List<String> widgets; + @Singular private List<String> items; +} diff --git a/test/transform/resource/before/BuilderSingularRedirectToGuavaWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularRedirectToGuavaWithSetterPrefix.java new file mode 100644 index 00000000..c3fdc7c6 --- /dev/null +++ b/test/transform/resource/before/BuilderSingularRedirectToGuavaWithSetterPrefix.java @@ -0,0 +1,13 @@ +//CONF: lombok.singular.useGuava = true +import java.util.Set; +import java.util.NavigableMap; +import java.util.Collection; + +import lombok.Singular; + +@lombok.Builder(setterPrefix = "with") +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/BuilderSingularSetsWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularSetsWithSetterPrefix.java new file mode 100644 index 00000000..16026f2d --- /dev/null +++ b/test/transform/resource/before/BuilderSingularSetsWithSetterPrefix.java @@ -0,0 +1,12 @@ +import java.util.Set; +import java.util.SortedSet; + +import lombok.Singular; + +@lombok.Builder(setterPrefix = "with") +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/BuilderSingularToBuilderWithNullWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularToBuilderWithNullWithSetterPrefix.java new file mode 100644 index 00000000..f7a411f0 --- /dev/null +++ b/test/transform/resource/before/BuilderSingularToBuilderWithNullWithSetterPrefix.java @@ -0,0 +1,10 @@ +import lombok.Singular; + +@lombok.Builder(toBuilder = true, setterPrefix = "with") +class BuilderSingularToBuilderWithNull { + @Singular private java.util.List<String> elems; + + public static void test() { + new BuilderSingularToBuilderWithNull(null).toBuilder(); + } +} diff --git a/test/transform/resource/before/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java new file mode 100644 index 00000000..817f4be5 --- /dev/null +++ b/test/transform/resource/before/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java @@ -0,0 +1,10 @@ +import java.util.List; +import java.util.Collection; + +import lombok.Singular; + +@lombok.Builder(toBuilder = true, setterPrefix = "with") +class BuilderSingularWildcardListsWithToBuilder { + @Singular private List<?> objects; + @Singular private Collection<? extends Number> numbers; +} diff --git a/test/transform/resource/before/BuilderSingularWithPrefixesWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularWithPrefixesWithSetterPrefix.java new file mode 100644 index 00000000..63df4a71 --- /dev/null +++ b/test/transform/resource/before/BuilderSingularWithPrefixesWithSetterPrefix.java @@ -0,0 +1,7 @@ +import lombok.Singular; + +@lombok.Builder(setterPrefix = "with") +@lombok.experimental.Accessors(prefix = "_") +class BuilderSingularWithPrefixes { + @Singular private java.util.List<String> _elems; +} diff --git a/test/transform/resource/before/BuilderTypeAnnosWithSetterPrefix.java b/test/transform/resource/before/BuilderTypeAnnosWithSetterPrefix.java new file mode 100644 index 00000000..65faf01d --- /dev/null +++ b/test/transform/resource/before/BuilderTypeAnnosWithSetterPrefix.java @@ -0,0 +1,14 @@ +//CONF: lombok.copyableAnnotations += TA +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; +import java.util.List; +@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) +@interface TA { +} +@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) +@interface TB { +} +@lombok.Builder(setterPrefix = "with") +class BuilderTypeAnnos { + private @TA @TB List<String> foo; +} diff --git a/test/transform/resource/before/BuilderValueDataWithSetterPrefix.java b/test/transform/resource/before/BuilderValueDataWithSetterPrefix.java new file mode 100644 index 00000000..e5d9dc92 --- /dev/null +++ b/test/transform/resource/before/BuilderValueDataWithSetterPrefix.java @@ -0,0 +1,11 @@ +import java.util.List; + +@lombok.Builder @lombok.Value +class BuilderAndValue { + private final int zero = 0; +} + +@lombok.Builder(setterPrefix = "with") @lombok.Data +class BuilderAndData { + private final int zero = 0; +} diff --git a/test/transform/resource/before/BuilderWithAccessorsWithSetterPrefix.java b/test/transform/resource/before/BuilderWithAccessorsWithSetterPrefix.java new file mode 100644 index 00000000..b14527a1 --- /dev/null +++ b/test/transform/resource/before/BuilderWithAccessorsWithSetterPrefix.java @@ -0,0 +1,7 @@ +@lombok.Builder(setterPrefix = "with") @lombok.experimental.Accessors(prefix={"p", "_"}) +class BuilderWithAccessors { + private final int plower; + private final int pUpper; + private int _foo; + private int __bar; +} diff --git a/test/transform/resource/before/BuilderWithBadNamesWithSetterPrefix.java b/test/transform/resource/before/BuilderWithBadNamesWithSetterPrefix.java new file mode 100644 index 00000000..da344f76 --- /dev/null +++ b/test/transform/resource/before/BuilderWithBadNamesWithSetterPrefix.java @@ -0,0 +1,5 @@ +@lombok.Builder(setterPrefix = "with") +public class BuilderWithBadNames { + String build; + String toString; +} diff --git a/test/transform/resource/before/BuilderWithDeprecatedWithSetterPrefix.java b/test/transform/resource/before/BuilderWithDeprecatedWithSetterPrefix.java new file mode 100644 index 00000000..5047de45 --- /dev/null +++ b/test/transform/resource/before/BuilderWithDeprecatedWithSetterPrefix.java @@ -0,0 +1,11 @@ +import com.google.common.collect.ImmutableList; +import lombok.Builder; +import lombok.Singular; + +@Builder(setterPrefix = "with") +public class BuilderWithDeprecated { + /** @deprecated since always */ String dep1; + @Deprecated int dep2; + @Singular @Deprecated java.util.List<String> strings; + @Singular @Deprecated ImmutableList<Integer> numbers; +} diff --git a/test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java b/test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java new file mode 100644 index 00000000..f931d507 --- /dev/null +++ b/test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java @@ -0,0 +1,15 @@ +import lombok.Builder; + +class BuilderWithExistingBuilderClass<T, K extends Number> { + @Builder(setterPrefix = "with") + public static <Z extends Number> BuilderWithExistingBuilderClass<String, Z> staticMethod(Z arg1, boolean arg2, String arg3) { + return null; + } + + public static class BuilderWithExistingBuilderClassBuilder<Z extends Number> { + private Z arg1; + + public void withArg2(boolean arg) { + } + } +} diff --git a/test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java b/test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java new file mode 100644 index 00000000..fa8b8f09 --- /dev/null +++ b/test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java @@ -0,0 +1,5 @@ +import lombok.Builder(setterPrefix = "with"); +@Builder(toBuilder = true, builderMethodName = "", setterPrefix = "with") +class BuilderWithNoBuilderMethod { + private String a = ""; +} diff --git a/test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java b/test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java new file mode 100644 index 00000000..1a18fbc7 --- /dev/null +++ b/test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java @@ -0,0 +1,5 @@ +@lombok.Builder(setterPrefix = "with") +class BuilderWithNonNull { + @lombok.NonNull + private final String id; +} diff --git a/test/transform/resource/before/BuilderWithRecursiveGenericsWithSetterPrefix.java b/test/transform/resource/before/BuilderWithRecursiveGenericsWithSetterPrefix.java new file mode 100644 index 00000000..85129223 --- /dev/null +++ b/test/transform/resource/before/BuilderWithRecursiveGenericsWithSetterPrefix.java @@ -0,0 +1,13 @@ +//issue #1298 +import java.util.Set; +import lombok.Builder; +import lombok.Value; + +public class BuilderWithRecursiveGenerics { + interface Inter<T, U extends Inter<T, U>> {} + + @Builder(setterPrefix = "with") @Value public static class Test<Foo, Bar extends Set<Foo>, Quz extends Inter<Bar, Quz>> { + Foo foo; + Bar bar; + } +} diff --git a/test/transform/resource/before/BuilderWithToBuilderWithSetterPrefix.java b/test/transform/resource/before/BuilderWithToBuilderWithSetterPrefix.java new file mode 100644 index 00000000..8be20f58 --- /dev/null +++ b/test/transform/resource/before/BuilderWithToBuilderWithSetterPrefix.java @@ -0,0 +1,20 @@ +import java.util.List; +import lombok.Builder; +@Builder(toBuilder = true, setterPrefix = "with") @lombok.experimental.Accessors(prefix = "m") +class BuilderWithToBuilder<T> { + private String mOne, mTwo; + @Builder.ObtainVia(method = "rrr", isStatic = true) private T foo; + @lombok.Singular private List<T> bars; + public static <K> K rrr(BuilderWithToBuilder<K> x) { + return x.foo; + } +} +@lombok.experimental.Accessors(prefix = "m") +class ConstructorWithToBuilder<T> { + private String mOne, mTwo; + private T foo; + @lombok.Singular private com.google.common.collect.ImmutableList<T> bars; + @Builder(toBuilder = true) + public ConstructorWithToBuilder(String mOne, @Builder.ObtainVia(field = "foo") T baz, com.google.common.collect.ImmutableList<T> bars) { + } +} diff --git a/test/transform/resource/before/BuilderWithTolerateWithSetterPrefix.java b/test/transform/resource/before/BuilderWithTolerateWithSetterPrefix.java new file mode 100644 index 00000000..2f4db558 --- /dev/null +++ b/test/transform/resource/before/BuilderWithTolerateWithSetterPrefix.java @@ -0,0 +1,18 @@ +import lombok.Builder; +import lombok.experimental.Tolerate; + +@Builder(setterPrefix = "with") +public class BuilderWithTolerate { + private final int value; + + public static void main(String[] args) { + BuilderWithTolerate.builder().value("42").build(); + } + + public static class BuilderWithTolerateBuilder { + @Tolerate + public BuilderWithTolerateBuilder value(String s) { + return this.value(Integer.parseInt(s)); + } + } +} |