aboutsummaryrefslogtreecommitdiff
path: root/test/transform/resource/after-delombok
diff options
context:
space:
mode:
Diffstat (limited to 'test/transform/resource/after-delombok')
-rw-r--r--test/transform/resource/after-delombok/ExtensionMethodFunctional.java15
-rw-r--r--test/transform/resource/after-delombok/ExtensionMethodGeneric.java33
2 files changed, 47 insertions, 1 deletions
diff --git a/test/transform/resource/after-delombok/ExtensionMethodFunctional.java b/test/transform/resource/after-delombok/ExtensionMethodFunctional.java
index bd301543..fb58eb91 100644
--- a/test/transform/resource/after-delombok/ExtensionMethodFunctional.java
+++ b/test/transform/resource/after-delombok/ExtensionMethodFunctional.java
@@ -1,5 +1,8 @@
-import java.util.function.Function;
import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
class ExtensionMethodFunctional {
public void test() {
@@ -7,6 +10,8 @@ class ExtensionMethodFunctional {
test = ExtensionMethodFunctional.Extensions.map(test, s -> ExtensionMethodFunctional.Extensions.reverse(s));
ExtensionMethodFunctional.Extensions.consume(test, s -> System.out.println("1: " + s), s -> System.out.println("2: " + s));
ExtensionMethodFunctional.Extensions.consume(test, System.out::println, System.out::println);
+ ExtensionMethodFunctional.Extensions.toList(Stream.of("a", "b", "c").map(String::toUpperCase));
+ List<Integer> i2 = ExtensionMethodFunctional.Extensions.toList2(Stream.of("a", "b", "c").map(String::toUpperCase));
}
static class Extensions {
@@ -24,5 +29,13 @@ class ExtensionMethodFunctional {
consumer[i].accept(o);
}
}
+
+ public static <T> List<T> toList(Stream<T> stream) {
+ return (List<T>) stream.collect(Collectors.toList());
+ }
+
+ public static <T, U> List<U> toList2(Stream<T> stream) {
+ return null;
+ }
}
}
diff --git a/test/transform/resource/after-delombok/ExtensionMethodGeneric.java b/test/transform/resource/after-delombok/ExtensionMethodGeneric.java
new file mode 100644
index 00000000..8559b7ff
--- /dev/null
+++ b/test/transform/resource/after-delombok/ExtensionMethodGeneric.java
@@ -0,0 +1,33 @@
+import java.util.List;
+import java.util.Map;
+
+class ExtensionMethodGeneric {
+ public void test() {
+ List<String> stringList = null;
+ List<Number> numberList = null;
+ ExtensionMethodGeneric.Extensions.test(stringList);
+ ExtensionMethodGeneric.Extensions.test(stringList, numberList);
+ ExtensionMethodGeneric.Extensions.test(ExtensionMethodGeneric.Extensions.test(stringList, stringList), numberList);
+ Integer i = ExtensionMethodGeneric.Extensions.test2(stringList);
+ Map<String, Integer> map = null;
+ List<String> l = ExtensionMethodGeneric.Extensions.test(map, stringList, numberList);
+ }
+
+ static class Extensions {
+ public static <T> List<T> test(List<String> obj, List<T> list) {
+ return null;
+ }
+
+ public static <K, V> K test(Map<String, Integer> obj, K k, V v) {
+ return k;
+ }
+
+ public static <T> T test(List<T> list) {
+ return null;
+ }
+
+ public static <T, U> U test2(List<T> list) {
+ return null;
+ }
+ }
+}