diff options
Diffstat (limited to 'test/transform/resource/before')
23 files changed, 261 insertions, 0 deletions
diff --git a/test/transform/resource/before/BuilderSimpleWithSetterPrefix.java b/test/transform/resource/before/BuilderSimpleWithSetterPrefix.java new file mode 100644 index 00000000..19ab7af1 --- /dev/null +++ b/test/transform/resource/before/BuilderSimpleWithSetterPrefix.java @@ -0,0 +1,6 @@ +import java.util.List; + +@lombok.Builder(access = lombok.AccessLevel.PROTECTED, setterPrefix = "with") +class BuilderSimpleWithSetterPrefix<T> { + private int unprefixed; +} diff --git a/test/transform/resource/before/BuilderSingularAnnotatedTypesWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularAnnotatedTypesWithSetterPrefix.java new file mode 100644 index 00000000..ef8cb2e3 --- /dev/null +++ b/test/transform/resource/before/BuilderSingularAnnotatedTypesWithSetterPrefix.java @@ -0,0 +1,14 @@ +//VERSION 8: +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; +import java.util.Set; +import java.util.Map; +import lombok.NonNull; +import lombok.Singular; +@Target(ElementType.TYPE_USE) +@interface MyAnnotation {} +@lombok.Builder(setterPrefix = "with") +class BuilderSingularAnnotatedTypesWithSetterPrefix { + @Singular private Set<@MyAnnotation @NonNull String> foos; + @Singular private Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars; +} diff --git a/test/transform/resource/before/BuilderSingularGuavaListsSetsWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularGuavaListsSetsWithSetterPrefix.java new file mode 100644 index 00000000..af02adb6 --- /dev/null +++ b/test/transform/resource/before/BuilderSingularGuavaListsSetsWithSetterPrefix.java @@ -0,0 +1,16 @@ +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableCollection; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.ImmutableSortedSet; +import com.google.common.collect.ImmutableTable; + +import lombok.Singular; + +@lombok.Builder(setterPrefix = "with") +class BuilderSingularGuavaListsSetsWithSetterPrefix<T> { + @Singular private ImmutableList<T> cards; + @Singular private ImmutableCollection<? extends Number> frogs; + @SuppressWarnings("all") @Singular("rawSet") private ImmutableSet rawSet; + @Singular private ImmutableSortedSet<String> passes; + @Singular private ImmutableTable<? extends Number, ? extends Number, String> users; +} diff --git a/test/transform/resource/before/BuilderSingularGuavaMapsWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularGuavaMapsWithSetterPrefix.java new file mode 100644 index 00000000..a2b48cb3 --- /dev/null +++ b/test/transform/resource/before/BuilderSingularGuavaMapsWithSetterPrefix.java @@ -0,0 +1,12 @@ +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableBiMap; +import com.google.common.collect.ImmutableSortedMap; + +import lombok.Singular; + +@lombok.Builder(setterPrefix = "with") +class BuilderSingularGuavaMapsWithSetterPrefix<K, V> { + @Singular private ImmutableMap<K, V> battleaxes; + @Singular private ImmutableSortedMap<Integer, ? extends V> vertices; + @SuppressWarnings("all") @Singular("rawMap") private ImmutableBiMap rawMap; +} diff --git a/test/transform/resource/before/BuilderSingularListsWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularListsWithSetterPrefix.java new file mode 100644 index 00000000..fd53d97f --- /dev/null +++ b/test/transform/resource/before/BuilderSingularListsWithSetterPrefix.java @@ -0,0 +1,11 @@ +import java.util.List; +import java.util.Collection; + +import lombok.Singular; + +@lombok.Builder(setterPrefix = "with") +class BuilderSingularListsWithSetterPrefix<T> { + @Singular private List<T> children; + @Singular private Collection<? extends Number> scarves; + @SuppressWarnings("all") @Singular("rawList") private List rawList; +} diff --git a/test/transform/resource/before/BuilderSingularMapsWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularMapsWithSetterPrefix.java new file mode 100644 index 00000000..728ad59a --- /dev/null +++ b/test/transform/resource/before/BuilderSingularMapsWithSetterPrefix.java @@ -0,0 +1,15 @@ +//FORMAT: javaLangAsFQN = skip +//FORMAT: generated = skip +//FORMAT: finalParams = skip +import java.util.Map; +import java.util.SortedMap; + +import lombok.Singular; + +@lombok.Builder(setterPrefix = "with") +class BuilderSingularMapsWithSetterPrefix<K, V> { + @Singular private Map<K, V> women; + @Singular private SortedMap<K, ? extends Number> men; + @SuppressWarnings("all") @Singular("rawMap") private Map rawMap; + @Singular("stringMap") private Map<String, V> stringMap; +} diff --git a/test/transform/resource/before/BuilderSingularNoAutoWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularNoAutoWithSetterPrefix.java new file mode 100644 index 00000000..fa55c553 --- /dev/null +++ b/test/transform/resource/before/BuilderSingularNoAutoWithSetterPrefix.java @@ -0,0 +1,11 @@ +//CONF: lombok.singular.auto = false +import java.util.List; + +import lombok.Singular; + +@lombok.Builder(setterPrefix = "with") +class BuilderSingularNoAutoWithSetterPrefix { + @Singular private List<String> things; + @Singular("widget") private List<String> widgets; + @Singular private List<String> items; +} diff --git a/test/transform/resource/before/BuilderSingularRedirectToGuavaWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularRedirectToGuavaWithSetterPrefix.java new file mode 100644 index 00000000..7281141d --- /dev/null +++ b/test/transform/resource/before/BuilderSingularRedirectToGuavaWithSetterPrefix.java @@ -0,0 +1,13 @@ +//CONF: lombok.singular.useGuava = true +import java.util.Set; +import java.util.NavigableMap; +import java.util.Collection; + +import lombok.Singular; + +@lombok.Builder(setterPrefix = "with") +class BuilderSingularRedirectToGuavaWithSetterPrefix { + @Singular private Set<String> dangerMice; + @Singular private NavigableMap<Integer, Number> things; + @Singular private Collection<Class<?>> doohickeys; +} diff --git a/test/transform/resource/before/BuilderSingularSetsWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularSetsWithSetterPrefix.java new file mode 100644 index 00000000..d2824109 --- /dev/null +++ b/test/transform/resource/before/BuilderSingularSetsWithSetterPrefix.java @@ -0,0 +1,12 @@ +import java.util.Set; +import java.util.SortedSet; + +import lombok.Singular; + +@lombok.Builder(setterPrefix = "with") +class BuilderSingularSetsWithSetterPrefix<T> { + @Singular private Set<T> dangerMice; + @Singular private SortedSet<? extends Number> octopodes; + @SuppressWarnings("all") @Singular("rawSet") private Set rawSet; + @Singular("stringSet") private Set<String> stringSet; +} diff --git a/test/transform/resource/before/BuilderSingularToBuilderWithNullWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularToBuilderWithNullWithSetterPrefix.java new file mode 100644 index 00000000..454cac97 --- /dev/null +++ b/test/transform/resource/before/BuilderSingularToBuilderWithNullWithSetterPrefix.java @@ -0,0 +1,10 @@ +import lombok.Singular; + +@lombok.Builder(toBuilder = true, setterPrefix = "with") +class BuilderSingularToBuilderWithNullWithSetterPrefix { + @Singular private java.util.List<String> elems; + + public static void test() { + new BuilderSingularToBuilderWithNullWithSetterPrefix(null).toBuilder(); + } +} diff --git a/test/transform/resource/before/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java new file mode 100644 index 00000000..cea10bab --- /dev/null +++ b/test/transform/resource/before/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java @@ -0,0 +1,10 @@ +import java.util.List; +import java.util.Collection; + +import lombok.Singular; + +@lombok.Builder(toBuilder = true, setterPrefix = "with") +class BuilderSingularWildcardListsWithToBuilderWithSetterPrefix { + @Singular private List<?> objects; + @Singular private Collection<? extends Number> numbers; +} diff --git a/test/transform/resource/before/BuilderSingularWithPrefixesWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularWithPrefixesWithSetterPrefix.java new file mode 100644 index 00000000..1b953668 --- /dev/null +++ b/test/transform/resource/before/BuilderSingularWithPrefixesWithSetterPrefix.java @@ -0,0 +1,7 @@ +import lombok.Singular; + +@lombok.Builder(setterPrefix = "with") +@lombok.experimental.Accessors(prefix = "_") +class BuilderSingularWithPrefixesWithSetterPrefix { + @Singular private java.util.List<String> _elems; +} diff --git a/test/transform/resource/before/BuilderTypeAnnosWithSetterPrefix.java b/test/transform/resource/before/BuilderTypeAnnosWithSetterPrefix.java new file mode 100644 index 00000000..4adde2a0 --- /dev/null +++ b/test/transform/resource/before/BuilderTypeAnnosWithSetterPrefix.java @@ -0,0 +1,14 @@ +//CONF: lombok.copyableAnnotations += TA +import java.lang.annotation.ElementType; +import java.lang.annotation.Target; +import java.util.List; +@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) +@interface TA { +} +@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) +@interface TB { +} +@lombok.Builder(setterPrefix = "with") +class BuilderTypeAnnosWithSetterPrefix { + private @TA @TB List<String> foo; +} diff --git a/test/transform/resource/before/BuilderValueDataWithSetterPrefix.java b/test/transform/resource/before/BuilderValueDataWithSetterPrefix.java new file mode 100644 index 00000000..530c24d2 --- /dev/null +++ b/test/transform/resource/before/BuilderValueDataWithSetterPrefix.java @@ -0,0 +1,11 @@ +import java.util.List; + +@lombok.Builder(setterPrefix = "with") @lombok.Value +class BuilderAndValueWithSetterPrefix { + private final int zero = 0; +} + +@lombok.Builder(setterPrefix = "with") @lombok.Data +class BuilderAndDataWithSetterPrefix { + private final int zero = 0; +} diff --git a/test/transform/resource/before/BuilderWithAccessorsWithSetterPrefix.java b/test/transform/resource/before/BuilderWithAccessorsWithSetterPrefix.java new file mode 100644 index 00000000..4f4ebb18 --- /dev/null +++ b/test/transform/resource/before/BuilderWithAccessorsWithSetterPrefix.java @@ -0,0 +1,7 @@ +@lombok.Builder(setterPrefix = "with") @lombok.experimental.Accessors(prefix={"p", "_"}) +class BuilderWithAccessorsWithSetterPrefix { + private final int plower; + private final int pUpper; + private int _foo; + private int __bar; +} diff --git a/test/transform/resource/before/BuilderWithBadNamesWithSetterPrefix.java b/test/transform/resource/before/BuilderWithBadNamesWithSetterPrefix.java new file mode 100644 index 00000000..69322ee3 --- /dev/null +++ b/test/transform/resource/before/BuilderWithBadNamesWithSetterPrefix.java @@ -0,0 +1,5 @@ +@lombok.Builder(setterPrefix = "with") +public class BuilderWithBadNamesWithSetterPrefix { + String build; + String toString; +} diff --git a/test/transform/resource/before/BuilderWithDeprecatedWithSetterPrefix.java b/test/transform/resource/before/BuilderWithDeprecatedWithSetterPrefix.java new file mode 100644 index 00000000..77baccd3 --- /dev/null +++ b/test/transform/resource/before/BuilderWithDeprecatedWithSetterPrefix.java @@ -0,0 +1,11 @@ +import com.google.common.collect.ImmutableList; +import lombok.Builder; +import lombok.Singular; + +@Builder(setterPrefix = "with") +public class BuilderWithDeprecatedWithSetterPrefix { + /** @deprecated since always */ String dep1; + @Deprecated int dep2; + @Singular @Deprecated java.util.List<String> strings; + @Singular @Deprecated ImmutableList<Integer> numbers; +} diff --git a/test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java b/test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java new file mode 100644 index 00000000..e30dd1ff --- /dev/null +++ b/test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java @@ -0,0 +1,15 @@ +import lombok.Builder; + +class BuilderWithExistingBuilderClassWithSetterPrefix<T, K extends Number> { + @Builder(setterPrefix = "with") + public static <Z extends Number> BuilderWithExistingBuilderClassWithSetterPrefix<String, Z> staticMethod(Z arg1, boolean arg2, String arg3) { + return null; + } + + public static class BuilderWithExistingBuilderClassWithSetterPrefixBuilder<Z extends Number> { + private Z arg1; + + public void withArg2(boolean arg) { + } + } +} diff --git a/test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java b/test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java new file mode 100644 index 00000000..80197dd3 --- /dev/null +++ b/test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java @@ -0,0 +1,5 @@ +import lombok.Builder; +@Builder(toBuilder = true, builderMethodName = "",setterPrefix = "with") +class BuilderWithNoBuilderMethodWithSetterPrefix { + private String a = ""; +} diff --git a/test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java b/test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java new file mode 100644 index 00000000..8ef1f70e --- /dev/null +++ b/test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java @@ -0,0 +1,5 @@ +@lombok.Builder(setterPrefix = "with") +class BuilderWithNonNullWithSetterPrefix { + @lombok.NonNull + private final String id; +} diff --git a/test/transform/resource/before/BuilderWithRecursiveGenericsWithSetterPrefix.java b/test/transform/resource/before/BuilderWithRecursiveGenericsWithSetterPrefix.java new file mode 100644 index 00000000..ce8803c0 --- /dev/null +++ b/test/transform/resource/before/BuilderWithRecursiveGenericsWithSetterPrefix.java @@ -0,0 +1,13 @@ +//issue #1298 +import java.util.Set; +import lombok.Builder; +import lombok.Value; + +public class BuilderWithRecursiveGenericsWithSetterPrefix { + interface Inter<T, U extends Inter<T, U>> {} + + @Builder(setterPrefix = "with") @Value public static class Test<Foo, Bar extends Set<Foo>, Quz extends Inter<Bar, Quz>> { + Foo foo; + Bar bar; + } +} diff --git a/test/transform/resource/before/BuilderWithToBuilderWithSetterPrefix.java b/test/transform/resource/before/BuilderWithToBuilderWithSetterPrefix.java new file mode 100644 index 00000000..3b442b8d --- /dev/null +++ b/test/transform/resource/before/BuilderWithToBuilderWithSetterPrefix.java @@ -0,0 +1,20 @@ +import java.util.List; +import lombok.Builder; +@Builder(toBuilder = true, setterPrefix = "with") @lombok.experimental.Accessors(prefix = "m") +class BuilderWithToBuilderWithSetterPrefix<T> { + private String mOne, mTwo; + @Builder.ObtainVia(method = "rrr", isStatic = true) private T foo; + @lombok.Singular private List<T> bars; + public static <K> K rrr(BuilderWithToBuilderWithSetterPrefix<K> x) { + return x.foo; + } +} +@lombok.experimental.Accessors(prefix = "m") +class ConstructorWithToBuilderWithSetterPrefix<T> { + private String mOne, mTwo; + private T foo; + @lombok.Singular private com.google.common.collect.ImmutableList<T> bars; + @Builder(toBuilder = true, setterPrefix = "with") + public ConstructorWithToBuilderWithSetterPrefix(String mOne, @Builder.ObtainVia(field = "foo") T baz, com.google.common.collect.ImmutableList<T> bars) { + } +} diff --git a/test/transform/resource/before/BuilderWithTolerateWithSetterPrefix.java b/test/transform/resource/before/BuilderWithTolerateWithSetterPrefix.java new file mode 100644 index 00000000..5c77e177 --- /dev/null +++ b/test/transform/resource/before/BuilderWithTolerateWithSetterPrefix.java @@ -0,0 +1,18 @@ +import lombok.Builder; +import lombok.experimental.Tolerate; + +@Builder(setterPrefix = "with") +public class BuilderWithTolerateWithSetterPrefix { + private final int value; + + public static void main(String[] args) { + BuilderWithTolerateWithSetterPrefix.builder().withValue("42").build(); + } + + public static class BuilderWithTolerateWithSetterPrefixBuilder { + @Tolerate + public BuilderWithTolerateWithSetterPrefixBuilder withValue(String s) { + return this.withValue(Integer.parseInt(s)); + } + } +} |