aboutsummaryrefslogtreecommitdiff
path: root/test/transform/resource/before
diff options
context:
space:
mode:
authorCaleb Brinkman <cbrinkman@sonatype.com>2019-09-12 11:27:08 -0500
committerCaleb Brinkman <cbrinkman@sonatype.com>2019-09-12 11:28:20 -0500
commit36287f2ff9ed2f809f8c1c76155919417ad04d3c (patch)
tree45f5e4da4216d95bf36935c699495a8850ae61b1 /test/transform/resource/before
parentcc070254a68331c2593c37359921854c74692661 (diff)
downloadlombok-36287f2ff9ed2f809f8c1c76155919417ad04d3c.tar.gz
lombok-36287f2ff9ed2f809f8c1c76155919417ad04d3c.tar.bz2
lombok-36287f2ff9ed2f809f8c1c76155919417ad04d3c.zip
Duplicate builder tests with setter prefix
Diffstat (limited to 'test/transform/resource/before')
-rw-r--r--test/transform/resource/before/BuilderSimpleWithSetterPrefix.java (renamed from test/transform/resource/before/BuilderWithPrefix.java)0
-rw-r--r--test/transform/resource/before/BuilderSingularAnnotatedTypesWithSetterPrefix.java14
-rw-r--r--test/transform/resource/before/BuilderSingularGuavaListsSetsWithSetterPrefix.java16
-rw-r--r--test/transform/resource/before/BuilderSingularGuavaMapsWithPrefix.java12
-rw-r--r--test/transform/resource/before/BuilderSingularListsWithSetterPrefix.java11
-rw-r--r--test/transform/resource/before/BuilderSingularMapsWithSetterPrefix.java15
-rw-r--r--test/transform/resource/before/BuilderSingularNoAutoWithSetterPrefix.java11
-rw-r--r--test/transform/resource/before/BuilderSingularRedirectToGuavaWithSetterPrefix.java13
-rw-r--r--test/transform/resource/before/BuilderSingularSetsWithSetterPrefix.java12
-rw-r--r--test/transform/resource/before/BuilderSingularToBuilderWithNullWithSetterPrefix.java10
-rw-r--r--test/transform/resource/before/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java10
-rw-r--r--test/transform/resource/before/BuilderSingularWithPrefixesWithSetterPrefix.java7
-rw-r--r--test/transform/resource/before/BuilderTypeAnnosWithSetterPrefix.java14
-rw-r--r--test/transform/resource/before/BuilderValueDataWithSetterPrefix.java11
-rw-r--r--test/transform/resource/before/BuilderWithAccessorsWithSetterPrefix.java7
-rw-r--r--test/transform/resource/before/BuilderWithBadNamesWithSetterPrefix.java5
-rw-r--r--test/transform/resource/before/BuilderWithDeprecatedWithSetterPrefix.java11
-rw-r--r--test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java15
-rw-r--r--test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java5
-rw-r--r--test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java5
-rw-r--r--test/transform/resource/before/BuilderWithRecursiveGenericsWithSetterPrefix.java13
-rw-r--r--test/transform/resource/before/BuilderWithToBuilderWithSetterPrefix.java20
-rw-r--r--test/transform/resource/before/BuilderWithTolerateWithSetterPrefix.java18
23 files changed, 255 insertions, 0 deletions
diff --git a/test/transform/resource/before/BuilderWithPrefix.java b/test/transform/resource/before/BuilderSimpleWithSetterPrefix.java
index 38f3c029..38f3c029 100644
--- a/test/transform/resource/before/BuilderWithPrefix.java
+++ b/test/transform/resource/before/BuilderSimpleWithSetterPrefix.java
diff --git a/test/transform/resource/before/BuilderSingularAnnotatedTypesWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularAnnotatedTypesWithSetterPrefix.java
new file mode 100644
index 00000000..2ef83429
--- /dev/null
+++ b/test/transform/resource/before/BuilderSingularAnnotatedTypesWithSetterPrefix.java
@@ -0,0 +1,14 @@
+//VERSION 8:
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.Set;
+import java.util.Map;
+import lombok.NonNull;
+import lombok.Singular;
+@Target(ElementType.TYPE_USE)
+@interface MyAnnotation {}
+@lombok.Builder(setterPrefix = "with")
+class BuilderSingularAnnotatedTypes {
+ @Singular private Set<@MyAnnotation @NonNull String> foos;
+ @Singular private Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars;
+}
diff --git a/test/transform/resource/before/BuilderSingularGuavaListsSetsWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularGuavaListsSetsWithSetterPrefix.java
new file mode 100644
index 00000000..678b2e9f
--- /dev/null
+++ b/test/transform/resource/before/BuilderSingularGuavaListsSetsWithSetterPrefix.java
@@ -0,0 +1,16 @@
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableCollection;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.ImmutableSortedSet;
+import com.google.common.collect.ImmutableTable;
+
+import lombok.Singular;
+
+@lombok.Builder(setterPrefix = "with")
+class BuilderSingularGuavaListsSets<T> {
+ @Singular private ImmutableList<T> cards;
+ @Singular private ImmutableCollection<? extends Number> frogs;
+ @SuppressWarnings("all") @Singular("rawSet") private ImmutableSet rawSet;
+ @Singular private ImmutableSortedSet<String> passes;
+ @Singular private ImmutableTable<? extends Number, ? extends Number, String> users;
+}
diff --git a/test/transform/resource/before/BuilderSingularGuavaMapsWithPrefix.java b/test/transform/resource/before/BuilderSingularGuavaMapsWithPrefix.java
new file mode 100644
index 00000000..89de9a9c
--- /dev/null
+++ b/test/transform/resource/before/BuilderSingularGuavaMapsWithPrefix.java
@@ -0,0 +1,12 @@
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableBiMap;
+import com.google.common.collect.ImmutableSortedMap;
+
+import lombok.Singular;
+
+@lombok.Builder(setterPrefix = "with")
+class BuilderSingularGuavaMaps<K, V> {
+ @Singular private ImmutableMap<K, V> battleaxes;
+ @Singular private ImmutableSortedMap<Integer, ? extends V> vertices;
+ @SuppressWarnings("all") @Singular("rawMap") private ImmutableBiMap rawMap;
+}
diff --git a/test/transform/resource/before/BuilderSingularListsWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularListsWithSetterPrefix.java
new file mode 100644
index 00000000..101e7972
--- /dev/null
+++ b/test/transform/resource/before/BuilderSingularListsWithSetterPrefix.java
@@ -0,0 +1,11 @@
+import java.util.List;
+import java.util.Collection;
+
+import lombok.Singular;
+
+@lombok.Builder(setterPrefix = "with")
+class BuilderSingularLists<T> {
+ @Singular private List<T> children;
+ @Singular private Collection<? extends Number> scarves;
+ @SuppressWarnings("all") @Singular("rawList") private List rawList;
+}
diff --git a/test/transform/resource/before/BuilderSingularMapsWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularMapsWithSetterPrefix.java
new file mode 100644
index 00000000..e77bcf6e
--- /dev/null
+++ b/test/transform/resource/before/BuilderSingularMapsWithSetterPrefix.java
@@ -0,0 +1,15 @@
+//FORMAT: javaLangAsFQN = skip
+//FORMAT: generated = skip
+//FORMAT: finalParams = skip
+import java.util.Map;
+import java.util.SortedMap;
+
+import lombok.Singular;
+
+@lombok.Builder(setterPrefix = "with")
+class BuilderSingularMaps<K, V> {
+ @Singular private Map<K, V> women;
+ @Singular private SortedMap<K, ? extends Number> men;
+ @SuppressWarnings("all") @Singular("rawMap") private Map rawMap;
+ @Singular("stringMap") private Map<String, V> stringMap;
+}
diff --git a/test/transform/resource/before/BuilderSingularNoAutoWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularNoAutoWithSetterPrefix.java
new file mode 100644
index 00000000..0474c764
--- /dev/null
+++ b/test/transform/resource/before/BuilderSingularNoAutoWithSetterPrefix.java
@@ -0,0 +1,11 @@
+//CONF: lombok.singular.auto = false
+import java.util.List;
+
+import lombok.Singular;
+
+@lombok.Builder(setterPrefix = "with")
+class BuilderSingularNoAuto {
+ @Singular private List<String> things;
+ @Singular("widget") private List<String> widgets;
+ @Singular private List<String> items;
+}
diff --git a/test/transform/resource/before/BuilderSingularRedirectToGuavaWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularRedirectToGuavaWithSetterPrefix.java
new file mode 100644
index 00000000..c3fdc7c6
--- /dev/null
+++ b/test/transform/resource/before/BuilderSingularRedirectToGuavaWithSetterPrefix.java
@@ -0,0 +1,13 @@
+//CONF: lombok.singular.useGuava = true
+import java.util.Set;
+import java.util.NavigableMap;
+import java.util.Collection;
+
+import lombok.Singular;
+
+@lombok.Builder(setterPrefix = "with")
+class BuilderSingularRedirectToGuava {
+ @Singular private Set<String> dangerMice;
+ @Singular private NavigableMap<Integer, Number> things;
+ @Singular private Collection<Class<?>> doohickeys;
+}
diff --git a/test/transform/resource/before/BuilderSingularSetsWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularSetsWithSetterPrefix.java
new file mode 100644
index 00000000..16026f2d
--- /dev/null
+++ b/test/transform/resource/before/BuilderSingularSetsWithSetterPrefix.java
@@ -0,0 +1,12 @@
+import java.util.Set;
+import java.util.SortedSet;
+
+import lombok.Singular;
+
+@lombok.Builder(setterPrefix = "with")
+class BuilderSingularSets<T> {
+ @Singular private Set<T> dangerMice;
+ @Singular private SortedSet<? extends Number> octopodes;
+ @SuppressWarnings("all") @Singular("rawSet") private Set rawSet;
+ @Singular("stringSet") private Set<String> stringSet;
+}
diff --git a/test/transform/resource/before/BuilderSingularToBuilderWithNullWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularToBuilderWithNullWithSetterPrefix.java
new file mode 100644
index 00000000..f7a411f0
--- /dev/null
+++ b/test/transform/resource/before/BuilderSingularToBuilderWithNullWithSetterPrefix.java
@@ -0,0 +1,10 @@
+import lombok.Singular;
+
+@lombok.Builder(toBuilder = true, setterPrefix = "with")
+class BuilderSingularToBuilderWithNull {
+ @Singular private java.util.List<String> elems;
+
+ public static void test() {
+ new BuilderSingularToBuilderWithNull(null).toBuilder();
+ }
+}
diff --git a/test/transform/resource/before/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java
new file mode 100644
index 00000000..817f4be5
--- /dev/null
+++ b/test/transform/resource/before/BuilderSingularWildcardListsWithToBuilderWithSetterPrefix.java
@@ -0,0 +1,10 @@
+import java.util.List;
+import java.util.Collection;
+
+import lombok.Singular;
+
+@lombok.Builder(toBuilder = true, setterPrefix = "with")
+class BuilderSingularWildcardListsWithToBuilder {
+ @Singular private List<?> objects;
+ @Singular private Collection<? extends Number> numbers;
+}
diff --git a/test/transform/resource/before/BuilderSingularWithPrefixesWithSetterPrefix.java b/test/transform/resource/before/BuilderSingularWithPrefixesWithSetterPrefix.java
new file mode 100644
index 00000000..63df4a71
--- /dev/null
+++ b/test/transform/resource/before/BuilderSingularWithPrefixesWithSetterPrefix.java
@@ -0,0 +1,7 @@
+import lombok.Singular;
+
+@lombok.Builder(setterPrefix = "with")
+@lombok.experimental.Accessors(prefix = "_")
+class BuilderSingularWithPrefixes {
+ @Singular private java.util.List<String> _elems;
+}
diff --git a/test/transform/resource/before/BuilderTypeAnnosWithSetterPrefix.java b/test/transform/resource/before/BuilderTypeAnnosWithSetterPrefix.java
new file mode 100644
index 00000000..65faf01d
--- /dev/null
+++ b/test/transform/resource/before/BuilderTypeAnnosWithSetterPrefix.java
@@ -0,0 +1,14 @@
+//CONF: lombok.copyableAnnotations += TA
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+import java.util.List;
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TA {
+}
+@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+@interface TB {
+}
+@lombok.Builder(setterPrefix = "with")
+class BuilderTypeAnnos {
+ private @TA @TB List<String> foo;
+}
diff --git a/test/transform/resource/before/BuilderValueDataWithSetterPrefix.java b/test/transform/resource/before/BuilderValueDataWithSetterPrefix.java
new file mode 100644
index 00000000..e5d9dc92
--- /dev/null
+++ b/test/transform/resource/before/BuilderValueDataWithSetterPrefix.java
@@ -0,0 +1,11 @@
+import java.util.List;
+
+@lombok.Builder @lombok.Value
+class BuilderAndValue {
+ private final int zero = 0;
+}
+
+@lombok.Builder(setterPrefix = "with") @lombok.Data
+class BuilderAndData {
+ private final int zero = 0;
+}
diff --git a/test/transform/resource/before/BuilderWithAccessorsWithSetterPrefix.java b/test/transform/resource/before/BuilderWithAccessorsWithSetterPrefix.java
new file mode 100644
index 00000000..b14527a1
--- /dev/null
+++ b/test/transform/resource/before/BuilderWithAccessorsWithSetterPrefix.java
@@ -0,0 +1,7 @@
+@lombok.Builder(setterPrefix = "with") @lombok.experimental.Accessors(prefix={"p", "_"})
+class BuilderWithAccessors {
+ private final int plower;
+ private final int pUpper;
+ private int _foo;
+ private int __bar;
+}
diff --git a/test/transform/resource/before/BuilderWithBadNamesWithSetterPrefix.java b/test/transform/resource/before/BuilderWithBadNamesWithSetterPrefix.java
new file mode 100644
index 00000000..da344f76
--- /dev/null
+++ b/test/transform/resource/before/BuilderWithBadNamesWithSetterPrefix.java
@@ -0,0 +1,5 @@
+@lombok.Builder(setterPrefix = "with")
+public class BuilderWithBadNames {
+ String build;
+ String toString;
+}
diff --git a/test/transform/resource/before/BuilderWithDeprecatedWithSetterPrefix.java b/test/transform/resource/before/BuilderWithDeprecatedWithSetterPrefix.java
new file mode 100644
index 00000000..5047de45
--- /dev/null
+++ b/test/transform/resource/before/BuilderWithDeprecatedWithSetterPrefix.java
@@ -0,0 +1,11 @@
+import com.google.common.collect.ImmutableList;
+import lombok.Builder;
+import lombok.Singular;
+
+@Builder(setterPrefix = "with")
+public class BuilderWithDeprecated {
+ /** @deprecated since always */ String dep1;
+ @Deprecated int dep2;
+ @Singular @Deprecated java.util.List<String> strings;
+ @Singular @Deprecated ImmutableList<Integer> numbers;
+}
diff --git a/test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java b/test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java
new file mode 100644
index 00000000..f931d507
--- /dev/null
+++ b/test/transform/resource/before/BuilderWithExistingBuilderClassWithSetterPrefix.java
@@ -0,0 +1,15 @@
+import lombok.Builder;
+
+class BuilderWithExistingBuilderClass<T, K extends Number> {
+ @Builder(setterPrefix = "with")
+ public static <Z extends Number> BuilderWithExistingBuilderClass<String, Z> staticMethod(Z arg1, boolean arg2, String arg3) {
+ return null;
+ }
+
+ public static class BuilderWithExistingBuilderClassBuilder<Z extends Number> {
+ private Z arg1;
+
+ public void withArg2(boolean arg) {
+ }
+ }
+}
diff --git a/test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java b/test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java
new file mode 100644
index 00000000..fa8b8f09
--- /dev/null
+++ b/test/transform/resource/before/BuilderWithNoBuilderMethodWithSetterPrefix.java
@@ -0,0 +1,5 @@
+import lombok.Builder(setterPrefix = "with");
+@Builder(toBuilder = true, builderMethodName = "", setterPrefix = "with")
+class BuilderWithNoBuilderMethod {
+ private String a = "";
+}
diff --git a/test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java b/test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java
new file mode 100644
index 00000000..1a18fbc7
--- /dev/null
+++ b/test/transform/resource/before/BuilderWithNonNullWithSetterPrefix.java
@@ -0,0 +1,5 @@
+@lombok.Builder(setterPrefix = "with")
+class BuilderWithNonNull {
+ @lombok.NonNull
+ private final String id;
+}
diff --git a/test/transform/resource/before/BuilderWithRecursiveGenericsWithSetterPrefix.java b/test/transform/resource/before/BuilderWithRecursiveGenericsWithSetterPrefix.java
new file mode 100644
index 00000000..85129223
--- /dev/null
+++ b/test/transform/resource/before/BuilderWithRecursiveGenericsWithSetterPrefix.java
@@ -0,0 +1,13 @@
+//issue #1298
+import java.util.Set;
+import lombok.Builder;
+import lombok.Value;
+
+public class BuilderWithRecursiveGenerics {
+ interface Inter<T, U extends Inter<T, U>> {}
+
+ @Builder(setterPrefix = "with") @Value public static class Test<Foo, Bar extends Set<Foo>, Quz extends Inter<Bar, Quz>> {
+ Foo foo;
+ Bar bar;
+ }
+}
diff --git a/test/transform/resource/before/BuilderWithToBuilderWithSetterPrefix.java b/test/transform/resource/before/BuilderWithToBuilderWithSetterPrefix.java
new file mode 100644
index 00000000..8be20f58
--- /dev/null
+++ b/test/transform/resource/before/BuilderWithToBuilderWithSetterPrefix.java
@@ -0,0 +1,20 @@
+import java.util.List;
+import lombok.Builder;
+@Builder(toBuilder = true, setterPrefix = "with") @lombok.experimental.Accessors(prefix = "m")
+class BuilderWithToBuilder<T> {
+ private String mOne, mTwo;
+ @Builder.ObtainVia(method = "rrr", isStatic = true) private T foo;
+ @lombok.Singular private List<T> bars;
+ public static <K> K rrr(BuilderWithToBuilder<K> x) {
+ return x.foo;
+ }
+}
+@lombok.experimental.Accessors(prefix = "m")
+class ConstructorWithToBuilder<T> {
+ private String mOne, mTwo;
+ private T foo;
+ @lombok.Singular private com.google.common.collect.ImmutableList<T> bars;
+ @Builder(toBuilder = true)
+ public ConstructorWithToBuilder(String mOne, @Builder.ObtainVia(field = "foo") T baz, com.google.common.collect.ImmutableList<T> bars) {
+ }
+}
diff --git a/test/transform/resource/before/BuilderWithTolerateWithSetterPrefix.java b/test/transform/resource/before/BuilderWithTolerateWithSetterPrefix.java
new file mode 100644
index 00000000..2f4db558
--- /dev/null
+++ b/test/transform/resource/before/BuilderWithTolerateWithSetterPrefix.java
@@ -0,0 +1,18 @@
+import lombok.Builder;
+import lombok.experimental.Tolerate;
+
+@Builder(setterPrefix = "with")
+public class BuilderWithTolerate {
+ private final int value;
+
+ public static void main(String[] args) {
+ BuilderWithTolerate.builder().value("42").build();
+ }
+
+ public static class BuilderWithTolerateBuilder {
+ @Tolerate
+ public BuilderWithTolerateBuilder value(String s) {
+ return this.value(Integer.parseInt(s));
+ }
+ }
+}