diff options
author | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2019-12-11 00:28:37 +0100 |
---|---|---|
committer | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2019-12-11 00:28:37 +0100 |
commit | 6bab046832d9bb9bfea67a1503917a2551687453 (patch) | |
tree | 0da758f7096cbab779f2dd7d3a03d3ebc0422621 /test/transform/resource/after-ecj | |
parent | ea01e1c3199340b7e16ff75f63688eae0ca91c4b (diff) | |
parent | b7e42d13ea98e280914f09f91fc03f355ea9682b (diff) | |
download | lombok-6bab046832d9bb9bfea67a1503917a2551687453.tar.gz lombok-6bab046832d9bb9bfea67a1503917a2551687453.tar.bz2 lombok-6bab046832d9bb9bfea67a1503917a2551687453.zip |
Merge branch 'feature/builder-setter-prefixes' of git://github.com/floralvikings/lombok into floralvikings-feature/builder-setter-prefixes
Diffstat (limited to 'test/transform/resource/after-ecj')
23 files changed, 1849 insertions, 0 deletions
diff --git a/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java new file mode 100644 index 00000000..993c66da --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSimpleWithSetterPrefix.java @@ -0,0 +1,27 @@ +import java.util.List; +@lombok.Builder(access = lombok.AccessLevel.PROTECTED,setterPrefix = "with") class BuilderSimpleWithSetterPrefix<T> { + protected static @java.lang.SuppressWarnings("all") class BuilderSimpleWithSetterPrefixBuilder<T> { + private @java.lang.SuppressWarnings("all") int unprefixed; + @java.lang.SuppressWarnings("all") BuilderSimpleWithSetterPrefixBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSimpleWithSetterPrefixBuilder<T> withUnprefixed(final int unprefixed) { + this.unprefixed = unprefixed; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSimpleWithSetterPrefix<T> build() { + return new BuilderSimpleWithSetterPrefix<T>(unprefixed); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderSimpleWithSetterPrefix.BuilderSimpleWithSetterPrefixBuilder(unprefixed=" + this.unprefixed) + ")"); + } + } + private int unprefixed; + @java.lang.SuppressWarnings("all") BuilderSimpleWithSetterPrefix(final int unprefixed) { + super(); + this.unprefixed = unprefixed; + } + protected static @java.lang.SuppressWarnings("all") <T>BuilderSimpleWithSetterPrefixBuilder<T> builder() { + return new BuilderSimpleWithSetterPrefixBuilder<T>(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularAnnotatedTypesWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularAnnotatedTypesWithSetterPrefix.java new file mode 100644 index 00000000..c978ff40 --- /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 BuilderSingularAnnotatedTypesWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderSingularAnnotatedTypesWithSetterPrefixBuilder { + 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") BuilderSingularAnnotatedTypesWithSetterPrefixBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesWithSetterPrefixBuilder 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") BuilderSingularAnnotatedTypesWithSetterPrefixBuilder 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") BuilderSingularAnnotatedTypesWithSetterPrefixBuilder clearFoos() { + if ((this.foos != null)) + this.foos.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesWithSetterPrefixBuilder 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") BuilderSingularAnnotatedTypesWithSetterPrefixBuilder 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") BuilderSingularAnnotatedTypesWithSetterPrefixBuilder clearBars() { + if ((this.bars$key != null)) + { + this.bars$key.clear(); + this.bars$value.clear(); + } + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularAnnotatedTypesWithSetterPrefix 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 BuilderSingularAnnotatedTypesWithSetterPrefix(foos, bars); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("BuilderSingularAnnotatedTypesWithSetterPrefix.BuilderSingularAnnotatedTypesWithSetterPrefixBuilder(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") BuilderSingularAnnotatedTypesWithSetterPrefix(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") BuilderSingularAnnotatedTypesWithSetterPrefixBuilder builder() { + return new BuilderSingularAnnotatedTypesWithSetterPrefixBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularGuavaListsSetsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularGuavaListsSetsWithSetterPrefix.java new file mode 100644 index 00000000..ec700874 --- /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 BuilderSingularGuavaListsSetsWithSetterPrefix<T> { + public static @java.lang.SuppressWarnings("all") class BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<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") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<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") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<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") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> clearCards() { + this.cards = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<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") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<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") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> clearFrogs() { + this.frogs = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<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") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<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") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> clearRawSet() { + this.rawSet = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<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") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<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") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> clearPasses() { + this.passes = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<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") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<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") BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> clearUsers() { + this.users = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaListsSetsWithSetterPrefix<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 BuilderSingularGuavaListsSetsWithSetterPrefix<T>(cards, frogs, rawSet, passes, users); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((((((("BuilderSingularGuavaListsSetsWithSetterPrefix.BuilderSingularGuavaListsSetsWithSetterPrefixBuilder(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") BuilderSingularGuavaListsSetsWithSetterPrefix(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>BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<T> builder() { + return new BuilderSingularGuavaListsSetsWithSetterPrefixBuilder<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..0f58f7a4 --- /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 BuilderSingularGuavaMapsWithSetterPrefix<K, V> { + public static @java.lang.SuppressWarnings("all") class BuilderSingularGuavaMapsWithSetterPrefixBuilder<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") BuilderSingularGuavaMapsWithSetterPrefixBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsWithSetterPrefixBuilder<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") BuilderSingularGuavaMapsWithSetterPrefixBuilder<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") BuilderSingularGuavaMapsWithSetterPrefixBuilder<K, V> clearBattleaxes() { + this.battleaxes = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsWithSetterPrefixBuilder<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") BuilderSingularGuavaMapsWithSetterPrefixBuilder<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") BuilderSingularGuavaMapsWithSetterPrefixBuilder<K, V> clearVertices() { + this.vertices = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsWithSetterPrefixBuilder<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") BuilderSingularGuavaMapsWithSetterPrefixBuilder<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") BuilderSingularGuavaMapsWithSetterPrefixBuilder<K, V> clearRawMap() { + this.rawMap = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularGuavaMapsWithSetterPrefix<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 BuilderSingularGuavaMapsWithSetterPrefix<K, V>(battleaxes, vertices, rawMap); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("BuilderSingularGuavaMapsWithSetterPrefix.BuilderSingularGuavaMapsWithSetterPrefixBuilder(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") BuilderSingularGuavaMapsWithSetterPrefix(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>BuilderSingularGuavaMapsWithSetterPrefixBuilder<K, V> builder() { + return new BuilderSingularGuavaMapsWithSetterPrefixBuilder<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..ab90cb48 --- /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 BuilderSingularListsWithSetterPrefix<T> { + public static @java.lang.SuppressWarnings("all") class BuilderSingularListsWithSetterPrefixBuilder<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") BuilderSingularListsWithSetterPrefixBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefixBuilder<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") BuilderSingularListsWithSetterPrefixBuilder<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") BuilderSingularListsWithSetterPrefixBuilder<T> clearChildren() { + if ((this.children != null)) + this.children.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefixBuilder<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") BuilderSingularListsWithSetterPrefixBuilder<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") BuilderSingularListsWithSetterPrefixBuilder<T> clearScarves() { + if ((this.scarves != null)) + this.scarves.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefixBuilder<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") BuilderSingularListsWithSetterPrefixBuilder<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") BuilderSingularListsWithSetterPrefixBuilder<T> clearRawList() { + if ((this.rawList != null)) + this.rawList.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularListsWithSetterPrefix<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 BuilderSingularListsWithSetterPrefix<T>(children, scarves, rawList); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("BuilderSingularListsWithSetterPrefix.BuilderSingularListsWithSetterPrefixBuilder(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") BuilderSingularListsWithSetterPrefix(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>BuilderSingularListsWithSetterPrefixBuilder<T> builder() { + return new BuilderSingularListsWithSetterPrefixBuilder<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..7848b154 --- /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 BuilderSingularMapsWithSetterPrefix<K, V> { + public static @java.lang.SuppressWarnings("all") class BuilderSingularMapsWithSetterPrefixBuilder<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") BuilderSingularMapsWithSetterPrefixBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder<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") BuilderSingularMapsWithSetterPrefixBuilder<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") BuilderSingularMapsWithSetterPrefixBuilder<K, V> clearWomen() { + if ((this.women$key != null)) + { + this.women$key.clear(); + this.women$value.clear(); + } + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder<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") BuilderSingularMapsWithSetterPrefixBuilder<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") BuilderSingularMapsWithSetterPrefixBuilder<K, V> clearMen() { + if ((this.men$key != null)) + { + this.men$key.clear(); + this.men$value.clear(); + } + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder<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") BuilderSingularMapsWithSetterPrefixBuilder<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") BuilderSingularMapsWithSetterPrefixBuilder<K, V> clearRawMap() { + if ((this.rawMap$key != null)) + { + this.rawMap$key.clear(); + this.rawMap$value.clear(); + } + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefixBuilder<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") BuilderSingularMapsWithSetterPrefixBuilder<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") BuilderSingularMapsWithSetterPrefixBuilder<K, V> clearStringMap() { + if ((this.stringMap$key != null)) + { + this.stringMap$key.clear(); + this.stringMap$value.clear(); + } + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularMapsWithSetterPrefix<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 BuilderSingularMapsWithSetterPrefix<K, V>(women, men, rawMap, stringMap); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((((((((((((("BuilderSingularMapsWithSetterPrefix.BuilderSingularMapsWithSetterPrefixBuilder(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") BuilderSingularMapsWithSetterPrefix(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>BuilderSingularMapsWithSetterPrefixBuilder<K, V> builder() { + return new BuilderSingularMapsWithSetterPrefixBuilder<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..f24b1640 --- /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 BuilderSingularNoAutoWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderSingularNoAutoWithSetterPrefixBuilder { + 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") BuilderSingularNoAutoWithSetterPrefixBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefixBuilder 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") BuilderSingularNoAutoWithSetterPrefixBuilder 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") BuilderSingularNoAutoWithSetterPrefixBuilder clearThings() { + if ((this.things != null)) + this.things.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefixBuilder 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") BuilderSingularNoAutoWithSetterPrefixBuilder 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") BuilderSingularNoAutoWithSetterPrefixBuilder clearWidgets() { + if ((this.widgets != null)) + this.widgets.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefixBuilder 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") BuilderSingularNoAutoWithSetterPrefixBuilder 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") BuilderSingularNoAutoWithSetterPrefixBuilder clearItems() { + if ((this.items != null)) + this.items.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularNoAutoWithSetterPrefix 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 BuilderSingularNoAutoWithSetterPrefix(things, widgets, items); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("BuilderSingularNoAutoWithSetterPrefix.BuilderSingularNoAutoWithSetterPrefixBuilder(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") BuilderSingularNoAutoWithSetterPrefix(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") BuilderSingularNoAutoWithSetterPrefixBuilder builder() { + return new BuilderSingularNoAutoWithSetterPrefixBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularRedirectToGuavaWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularRedirectToGuavaWithSetterPrefix.java new file mode 100644 index 00000000..c6e163cb --- /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 BuilderSingularRedirectToGuavaWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderSingularRedirectToGuavaWithSetterPrefixBuilder { + 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") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder 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") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder 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") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder clearDangerMice() { + this.dangerMice = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder 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") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder 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") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder clearThings() { + this.things = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder 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") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder 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") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder clearDoohickeys() { + this.doohickeys = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularRedirectToGuavaWithSetterPrefix 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 BuilderSingularRedirectToGuavaWithSetterPrefix(dangerMice, things, doohickeys); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("BuilderSingularRedirectToGuavaWithSetterPrefix.BuilderSingularRedirectToGuavaWithSetterPrefixBuilder(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") BuilderSingularRedirectToGuavaWithSetterPrefix(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") BuilderSingularRedirectToGuavaWithSetterPrefixBuilder builder() { + return new BuilderSingularRedirectToGuavaWithSetterPrefixBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderSingularSetsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderSingularSetsWithSetterPrefix.java new file mode 100644 index 00000000..905e9190 --- /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 BuilderSingularSetsWithSetterPrefix<T> { + public static @java.lang.SuppressWarnings("all") class BuilderSingularSetsWithSetterPrefixBuilder<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") BuilderSingularSetsWithSetterPrefixBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder<T> withDangerMouse(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") BuilderSingularSetsWithSetterPrefixBuilder<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; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder<T> clearDangerMice() { + if ((this.dangerMice != null)) + this.dangerMice.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder<T> withOctopus(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") BuilderSingularSetsWithSetterPrefixBuilder<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; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder<T> clearOctopodes() { + if ((this.octopodes != null)) + this.octopodes.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder<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; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder<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; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder<T> clearRawSet() { + if ((this.rawSet != null)) + this.rawSet.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder<T> withStringSet(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") BuilderSingularSetsWithSetterPrefixBuilder<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; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefixBuilder<T> clearStringSet() { + if ((this.stringSet != null)) + this.stringSet.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularSetsWithSetterPrefix<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 BuilderSingularSetsWithSetterPrefix<T>(dangerMice, octopodes, rawSet, stringSet); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((((("BuilderSingularSetsWithSetterPrefix.BuilderSingularSetsWithSetterPrefixBuilder(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") BuilderSingularSetsWithSetterPrefix(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>BuilderSingularSetsWithSetterPrefixBuilder<T> builder() { + return new BuilderSingularSetsWithSetterPrefixBuilder<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..ef2d02a1 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingularToBuilderWithNullWithSetterPrefix.java @@ -0,0 +1,60 @@ +import lombok.Singular; +@lombok.Builder(toBuilder = true,setterPrefix = "with") class BuilderSingularToBuilderWithNullWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderSingularToBuilderWithNullWithSetterPrefixBuilder { + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> elems; + @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullWithSetterPrefixBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullWithSetterPrefixBuilder 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") BuilderSingularToBuilderWithNullWithSetterPrefixBuilder 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") BuilderSingularToBuilderWithNullWithSetterPrefixBuilder clearElems() { + if ((this.elems != null)) + this.elems.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullWithSetterPrefix 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 BuilderSingularToBuilderWithNullWithSetterPrefix(elems); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderSingularToBuilderWithNullWithSetterPrefix.BuilderSingularToBuilderWithNullWithSetterPrefixBuilder(elems=" + this.elems) + ")"); + } + } + private @Singular java.util.List<String> elems; + public static void test() { + new BuilderSingularToBuilderWithNullWithSetterPrefix(null).toBuilder(); + } + @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullWithSetterPrefix(final java.util.List<String> elems) { + super(); + this.elems = elems; + } + public static @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullWithSetterPrefixBuilder builder() { + return new BuilderSingularToBuilderWithNullWithSetterPrefixBuilder(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularToBuilderWithNullWithSetterPrefixBuilder toBuilder() { + final BuilderSingularToBuilderWithNullWithSetterPrefixBuilder builder = new BuilderSingularToBuilderWithNullWithSetterPrefixBuilder(); + if ((this.elems != null)) + builder.withElems(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..bbb10087 --- /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 BuilderSingularWildcardListsWithToBuilderWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder { + 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") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder 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") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder 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") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder clearObjects() { + if ((this.objects != null)) + this.objects.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder 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") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder 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") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder clearNumbers() { + if ((this.numbers != null)) + this.numbers.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefix 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 BuilderSingularWildcardListsWithToBuilderWithSetterPrefix(objects, numbers); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder(objects=" + this.objects) + ", numbers=") + this.numbers) + ")"); + } + } + private @Singular List<?> objects; + private @Singular Collection<? extends Number> numbers; + @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefix(final List<?> objects, final Collection<? extends Number> numbers) { + super(); + this.objects = objects; + this.numbers = numbers; + } + public static @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder builder() { + return new BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder toBuilder() { + final BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder builder = new BuilderSingularWildcardListsWithToBuilderWithSetterPrefixBuilder(); + if ((this.objects != null)) + builder.withObjects(this.objects); + if ((this.numbers != null)) + builder.withNumbers(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..f3218f27 --- /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 BuilderSingularWithPrefixesWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderSingularWithPrefixesWithSetterPrefixBuilder { + private @java.lang.SuppressWarnings("all") java.util.ArrayList<String> elems; + @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefixBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefixBuilder 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") BuilderSingularWithPrefixesWithSetterPrefixBuilder 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") BuilderSingularWithPrefixesWithSetterPrefixBuilder clearElems() { + if ((this.elems != null)) + this.elems.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefix 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 BuilderSingularWithPrefixesWithSetterPrefix(elems); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderSingularWithPrefixesWithSetterPrefix.BuilderSingularWithPrefixesWithSetterPrefixBuilder(elems=" + this.elems) + ")"); + } + } + private @Singular java.util.List<String> _elems; + @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefix(final java.util.List<String> elems) { + super(); + this._elems = elems; + } + public static @java.lang.SuppressWarnings("all") BuilderSingularWithPrefixesWithSetterPrefixBuilder builder() { + return new BuilderSingularWithPrefixesWithSetterPrefixBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderTypeAnnosWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderTypeAnnosWithSetterPrefix.java new file mode 100644 index 00000000..db44aa12 --- /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 BuilderTypeAnnosWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderTypeAnnosWithSetterPrefixBuilder { + private @java.lang.SuppressWarnings("all") List<String> foo; + @java.lang.SuppressWarnings("all") BuilderTypeAnnosWithSetterPrefixBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderTypeAnnosWithSetterPrefixBuilder withFoo(final @TA List<String> foo) { + this.foo = foo; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderTypeAnnosWithSetterPrefix build() { + return new BuilderTypeAnnosWithSetterPrefix(foo); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderTypeAnnosWithSetterPrefix.BuilderTypeAnnosWithSetterPrefixBuilder(foo=" + this.foo) + ")"); + } + } + private @TA @TB List<String> foo; + @java.lang.SuppressWarnings("all") BuilderTypeAnnosWithSetterPrefix(final @TA List<String> foo) { + super(); + this.foo = foo; + } + public static @java.lang.SuppressWarnings("all") BuilderTypeAnnosWithSetterPrefixBuilder builder() { + return new BuilderTypeAnnosWithSetterPrefixBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderValueDataWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderValueDataWithSetterPrefix.java new file mode 100644 index 00000000..065c93fe --- /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 BuilderAndValueWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderAndValueWithSetterPrefixBuilder { + @java.lang.SuppressWarnings("all") BuilderAndValueWithSetterPrefixBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderAndValueWithSetterPrefix build() { + return new BuilderAndValueWithSetterPrefix(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return "BuilderAndValueWithSetterPrefix.BuilderAndValueWithSetterPrefixBuilder()"; + } + } + private final int zero = 0; + @java.lang.SuppressWarnings("all") BuilderAndValueWithSetterPrefix() { + super(); + } + public static @java.lang.SuppressWarnings("all") BuilderAndValueWithSetterPrefixBuilder builder() { + return new BuilderAndValueWithSetterPrefixBuilder(); + } + 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 BuilderAndValueWithSetterPrefix))) + return false; + final BuilderAndValueWithSetterPrefix other = (BuilderAndValueWithSetterPrefix) 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 (("BuilderAndValueWithSetterPrefix(zero=" + this.getZero()) + ")"); + } +} +@lombok.Builder(setterPrefix = "with") @lombok.Data class BuilderAndDataWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderAndDataWithSetterPrefixBuilder { + @java.lang.SuppressWarnings("all") BuilderAndDataWithSetterPrefixBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderAndDataWithSetterPrefix build() { + return new BuilderAndDataWithSetterPrefix(); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return "BuilderAndDataWithSetterPrefix.BuilderAndDataWithSetterPrefixBuilder()"; + } + } + private final int zero = 0; + @java.lang.SuppressWarnings("all") BuilderAndDataWithSetterPrefix() { + super(); + } + public static @java.lang.SuppressWarnings("all") BuilderAndDataWithSetterPrefixBuilder builder() { + return new BuilderAndDataWithSetterPrefixBuilder(); + } + 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 BuilderAndDataWithSetterPrefix))) + return false; + final BuilderAndDataWithSetterPrefix other = (BuilderAndDataWithSetterPrefix) 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 BuilderAndDataWithSetterPrefix); + } + 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 (("BuilderAndDataWithSetterPrefix(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..d9c10e5b --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithAccessorsWithSetterPrefix.java @@ -0,0 +1,47 @@ +@lombok.Builder(setterPrefix = "with") @lombok.experimental.Accessors(prefix = {"p", "_"}) class BuilderWithAccessorsWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderWithAccessorsWithSetterPrefixBuilder { + 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") BuilderWithAccessorsWithSetterPrefixBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderWithAccessorsWithSetterPrefixBuilder withPlower(final int plower) { + this.plower = plower; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithAccessorsWithSetterPrefixBuilder withUpper(final int upper) { + this.upper = upper; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithAccessorsWithSetterPrefixBuilder withFoo(final int foo) { + this.foo = foo; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithAccessorsWithSetterPrefixBuilder with_bar(final int _bar) { + this._bar = _bar; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithAccessorsWithSetterPrefix build() { + return new BuilderWithAccessorsWithSetterPrefix(plower, upper, foo, _bar); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((((("BuilderWithAccessorsWithSetterPrefix.BuilderWithAccessorsWithSetterPrefixBuilder(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") BuilderWithAccessorsWithSetterPrefix(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") BuilderWithAccessorsWithSetterPrefixBuilder builder() { + return new BuilderWithAccessorsWithSetterPrefixBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderWithBadNamesWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithBadNamesWithSetterPrefix.java new file mode 100644 index 00000000..248c77ad --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithBadNamesWithSetterPrefix.java @@ -0,0 +1,33 @@ +public @lombok.Builder(setterPrefix = "with") class BuilderWithBadNamesWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderWithBadNamesWithSetterPrefixBuilder { + private @java.lang.SuppressWarnings("all") String build; + private @java.lang.SuppressWarnings("all") String toString; + @java.lang.SuppressWarnings("all") BuilderWithBadNamesWithSetterPrefixBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderWithBadNamesWithSetterPrefixBuilder withBuild(final String build) { + this.build = build; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithBadNamesWithSetterPrefixBuilder withToString(final String toString) { + this.toString = toString; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithBadNamesWithSetterPrefix build() { + return new BuilderWithBadNamesWithSetterPrefix(build, toString); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((("BuilderWithBadNamesWithSetterPrefix.BuilderWithBadNamesWithSetterPrefixBuilder(build=" + this.build) + ", toString=") + this.toString) + ")"); + } + } + String build; + String toString; + @java.lang.SuppressWarnings("all") BuilderWithBadNamesWithSetterPrefix(final String build, final String toString) { + super(); + this.build = build; + this.toString = toString; + } + public static @java.lang.SuppressWarnings("all") BuilderWithBadNamesWithSetterPrefixBuilder builder() { + return new BuilderWithBadNamesWithSetterPrefixBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderWithDeprecatedWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithDeprecatedWithSetterPrefix.java new file mode 100644 index 00000000..83fa2e4e --- /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 BuilderWithDeprecatedWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderWithDeprecatedWithSetterPrefixBuilder { + 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") BuilderWithDeprecatedWithSetterPrefixBuilder() { + super(); + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedWithSetterPrefixBuilder withDep1(final String dep1) { + this.dep1 = dep1; + return this; + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedWithSetterPrefixBuilder withDep2(final int dep2) { + this.dep2 = dep2; + return this; + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedWithSetterPrefixBuilder 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") BuilderWithDeprecatedWithSetterPrefixBuilder 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") BuilderWithDeprecatedWithSetterPrefixBuilder clearStrings() { + if ((this.strings != null)) + this.strings.clear(); + return this; + } + public @java.lang.Deprecated @java.lang.SuppressWarnings("all") BuilderWithDeprecatedWithSetterPrefixBuilder 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") BuilderWithDeprecatedWithSetterPrefixBuilder 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") BuilderWithDeprecatedWithSetterPrefixBuilder clearNumbers() { + this.numbers = null; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithDeprecatedWithSetterPrefix 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 BuilderWithDeprecatedWithSetterPrefix(dep1, dep2, strings, numbers); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((((("BuilderWithDeprecatedWithSetterPrefix.BuilderWithDeprecatedWithSetterPrefixBuilder(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") BuilderWithDeprecatedWithSetterPrefix(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") BuilderWithDeprecatedWithSetterPrefixBuilder builder() { + return new BuilderWithDeprecatedWithSetterPrefixBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java new file mode 100644 index 00000000..8da2f012 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithExistingBuilderClassWithSetterPrefix.java @@ -0,0 +1,36 @@ +import lombok.Builder; +class BuilderWithExistingBuilderClassWithSetterPrefix<T, K extends Number> { + public static class BuilderWithExistingBuilderClassWithSetterPrefixBuilder<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") BuilderWithExistingBuilderClassWithSetterPrefixBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassWithSetterPrefixBuilder<Z> withArg1(final Z arg1) { + this.arg1 = arg1; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassWithSetterPrefixBuilder<Z> withArg3(final String arg3) { + this.arg3 = arg3; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithExistingBuilderClassWithSetterPrefix<String, Z> build() { + return BuilderWithExistingBuilderClassWithSetterPrefix.<Z>staticMethod(arg1, arg2, arg3); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("BuilderWithExistingBuilderClassWithSetterPrefix.BuilderWithExistingBuilderClassWithSetterPrefixBuilder(arg1=" + this.arg1) + ", arg2=") + this.arg2) + ", arg3=") + this.arg3) + ")"); + } + } + BuilderWithExistingBuilderClassWithSetterPrefix() { + super(); + } + public static @Builder(setterPrefix = "with") <Z extends Number>BuilderWithExistingBuilderClassWithSetterPrefix<String, Z> staticMethod(Z arg1, boolean arg2, String arg3) { + return null; + } + public static @java.lang.SuppressWarnings("all") <Z extends Number>BuilderWithExistingBuilderClassWithSetterPrefixBuilder<Z> builder() { + return new BuilderWithExistingBuilderClassWithSetterPrefixBuilder<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..30043dd9 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithNoBuilderMethodWithSetterPrefix.java @@ -0,0 +1,27 @@ +import lombok.Builder; +@Builder(toBuilder = true,builderMethodName = "",setterPrefix = "with") class BuilderWithNoBuilderMethodWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderWithNoBuilderMethodWithSetterPrefixBuilder { + private @java.lang.SuppressWarnings("all") String a; + @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodWithSetterPrefixBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodWithSetterPrefixBuilder withA(final String a) { + this.a = a; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodWithSetterPrefix build() { + return new BuilderWithNoBuilderMethodWithSetterPrefix(a); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderWithNoBuilderMethodWithSetterPrefix.BuilderWithNoBuilderMethodWithSetterPrefixBuilder(a=" + this.a) + ")"); + } + } + private String a = ""; + @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodWithSetterPrefix(final String a) { + super(); + this.a = a; + } + public @java.lang.SuppressWarnings("all") BuilderWithNoBuilderMethodWithSetterPrefixBuilder toBuilder() { + return new BuilderWithNoBuilderMethodWithSetterPrefixBuilder().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..7f8cb80b --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithNonNullWithSetterPrefix.java @@ -0,0 +1,34 @@ +@lombok.Builder(setterPrefix = "with") class BuilderWithNonNullWithSetterPrefix { + public static @java.lang.SuppressWarnings("all") class BuilderWithNonNullWithSetterPrefixBuilder { + private @java.lang.SuppressWarnings("all") String id; + @java.lang.SuppressWarnings("all") BuilderWithNonNullWithSetterPrefixBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderWithNonNullWithSetterPrefixBuilder 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") BuilderWithNonNullWithSetterPrefix build() { + return new BuilderWithNonNullWithSetterPrefix(id); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderWithNonNullWithSetterPrefix.BuilderWithNonNullWithSetterPrefixBuilder(id=" + this.id) + ")"); + } + } + private final @lombok.NonNull String id; + @java.lang.SuppressWarnings("all") BuilderWithNonNullWithSetterPrefix(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") BuilderWithNonNullWithSetterPrefixBuilder builder() { + return new BuilderWithNonNullWithSetterPrefixBuilder(); + } +} diff --git a/test/transform/resource/after-ecj/BuilderWithRecursiveGenericsWithSetterPrefix.java b/test/transform/resource/after-ecj/BuilderWithRecursiveGenericsWithSetterPrefix.java new file mode 100644 index 00000000..7c5b191d --- /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 BuilderWithRecursiveGenericsWithSetterPrefix { + interface Inter<T, U extends Inter<T, U>> { + } + public static final @Builder(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 (((("BuilderWithRecursiveGenericsWithSetterPrefix.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 BuilderWithRecursiveGenericsWithSetterPrefix.Test))) + return false; + final BuilderWithRecursiveGenericsWithSetterPrefix.Test<?, ?, ?> other = (BuilderWithRecursiveGenericsWithSetterPrefix.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 (((("BuilderWithRecursiveGenericsWithSetterPrefix.Test(foo=" + this.getFoo()) + ", bar=") + this.getBar()) + ")"); + } + } + public BuilderWithRecursiveGenericsWithSetterPrefix() { + 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..6f3906d9 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderWithToBuilderWithSetterPrefix.java @@ -0,0 +1,124 @@ +import java.util.List; +import lombok.Builder; +@Builder(toBuilder = true,setterPrefix = "with") @lombok.experimental.Accessors(prefix = "m") class BuilderWithToBuilderWithSetterPrefix<T> { + public static @java.lang.SuppressWarnings("all") class BuilderWithToBuilderWithSetterPrefixBuilder<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") BuilderWithToBuilderWithSetterPrefixBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefixBuilder<T> withOne(final String one) { + this.one = one; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefixBuilder<T> withTwo(final String two) { + this.two = two; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefixBuilder<T> withFoo(final T foo) { + this.foo = foo; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefixBuilder<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") BuilderWithToBuilderWithSetterPrefixBuilder<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") BuilderWithToBuilderWithSetterPrefixBuilder<T> clearBars() { + if ((this.bars != null)) + this.bars.clear(); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefix<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 BuilderWithToBuilderWithSetterPrefix<T>(one, two, foo, bars); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((((("BuilderWithToBuilderWithSetterPrefix.BuilderWithToBuilderWithSetterPrefixBuilder(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(BuilderWithToBuilderWithSetterPrefix<K> x) { + return x.foo; + } + @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefix(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>BuilderWithToBuilderWithSetterPrefixBuilder<T> builder() { + return new BuilderWithToBuilderWithSetterPrefixBuilder<T>(); + } + public @java.lang.SuppressWarnings("all") BuilderWithToBuilderWithSetterPrefixBuilder<T> toBuilder() { + final BuilderWithToBuilderWithSetterPrefixBuilder<T> builder = new BuilderWithToBuilderWithSetterPrefixBuilder<T>().withOne(this.mOne).withTwo(this.mTwo).withFoo(BuilderWithToBuilderWithSetterPrefix.<T>rrr(this)); + if ((this.bars != null)) + builder.withBars(this.bars); + return builder; + } +} + +@lombok.experimental.Accessors(prefix = "m") class ConstructorWithToBuilderWithSetterPrefix<T> { + public static @java.lang.SuppressWarnings("all") class ConstructorWithToBuilderWithSetterPrefixBuilder<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") ConstructorWithToBuilderWithSetterPrefixBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") ConstructorWithToBuilderWithSetterPrefixBuilder<T> withMOne(final String mOne) { + this.mOne = mOne; + return this; + } + public @java.lang.SuppressWarnings("all") ConstructorWithToBuilderWithSetterPrefixBuilder<T> withBaz(final T baz) { + this.baz = baz; + return this; + } + public @java.lang.SuppressWarnings("all") ConstructorWithToBuilderWithSetterPrefixBuilder<T> withBars(final com.google.common.collect.ImmutableList<T> bars) { + this.bars = bars; + return this; + } + public @java.lang.SuppressWarnings("all") ConstructorWithToBuilderWithSetterPrefix<T> build() { + return new ConstructorWithToBuilderWithSetterPrefix<T>(mOne, baz, bars); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("ConstructorWithToBuilderWithSetterPrefix.ConstructorWithToBuilderWithSetterPrefixBuilder(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,setterPrefix = "with") ConstructorWithToBuilderWithSetterPrefix(String mOne, @Builder.ObtainVia(field = "foo") T baz, com.google.common.collect.ImmutableList<T> bars) { + super(); + } + public static @java.lang.SuppressWarnings("all") <T>ConstructorWithToBuilderWithSetterPrefixBuilder<T> builder() { + return new ConstructorWithToBuilderWithSetterPrefixBuilder<T>(); + } + public @java.lang.SuppressWarnings("all") ConstructorWithToBuilderWithSetterPrefixBuilder<T> toBuilder() { + return new ConstructorWithToBuilderWithSetterPrefixBuilder<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..6fa302e5 --- /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 BuilderWithTolerateWithSetterPrefix { + public static class BuilderWithTolerateWithSetterPrefixBuilder { + private @java.lang.SuppressWarnings("all") int value; + public @Tolerate BuilderWithTolerateWithSetterPrefixBuilder withValue(String s) { + return this.withValue(Integer.parseInt(s)); + } + @java.lang.SuppressWarnings("all") BuilderWithTolerateWithSetterPrefixBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderWithTolerateWithSetterPrefixBuilder withValue(final int value) { + this.value = value; + return this; + } + public @java.lang.SuppressWarnings("all") BuilderWithTolerateWithSetterPrefix build() { + return new BuilderWithTolerateWithSetterPrefix(value); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (("BuilderWithTolerateWithSetterPrefix.BuilderWithTolerateWithSetterPrefixBuilder(value=" + this.value) + ")"); + } + } + private final int value; + public static void main(String[] args) { + BuilderWithTolerateWithSetterPrefix.builder().withValue("42").build(); + } + @java.lang.SuppressWarnings("all") BuilderWithTolerateWithSetterPrefix(final int value) { + super(); + this.value = value; + } + public static @java.lang.SuppressWarnings("all") BuilderWithTolerateWithSetterPrefixBuilder builder() { + return new BuilderWithTolerateWithSetterPrefixBuilder(); + } +} |