diff options
author | Rawi01 <Rawi01@users.noreply.github.com> | 2020-11-19 17:36:40 +0100 |
---|---|---|
committer | Rawi01 <Rawi01@users.noreply.github.com> | 2020-11-25 08:54:17 +0100 |
commit | db80bb0a2168245dbae2e1ec565a830e92a7c684 (patch) | |
tree | bb4156e1294595b017d1f060551dbb7d307c32c2 /test/transform/resource/before/ExtensionMethodFunctional.java | |
parent | e1f82ac4d132769cfc272dccfc916aeba7181718 (diff) | |
download | lombok-db80bb0a2168245dbae2e1ec565a830e92a7c684.tar.gz lombok-db80bb0a2168245dbae2e1ec565a830e92a7c684.tar.bz2 lombok-db80bb0a2168245dbae2e1ec565a830e92a7c684.zip |
[fixes #2648] Reset inference context, remove generic information copy
In Java >= 8 ecj uses the inference context to resolve the generic
information. This one is already set before lombok tries rewrite the
method call. Simply copying the information does not cover all the
different cases but reseting the inference contexts and running type
inference again does.
Diffstat (limited to 'test/transform/resource/before/ExtensionMethodFunctional.java')
-rw-r--r-- | test/transform/resource/before/ExtensionMethodFunctional.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/test/transform/resource/before/ExtensionMethodFunctional.java b/test/transform/resource/before/ExtensionMethodFunctional.java index 19983258..a9e7dd9f 100644 --- a/test/transform/resource/before/ExtensionMethodFunctional.java +++ b/test/transform/resource/before/ExtensionMethodFunctional.java @@ -1,10 +1,13 @@ // version 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; import lombok.experimental.ExtensionMethod; -@ExtensionMethod(ExtensionMethodFunctional.Extensions.class) +@ExtensionMethod(value = ExtensionMethodFunctional.Extensions.class, suppressBaseMethods = false) class ExtensionMethodFunctional { public void test() { String test = "test"; @@ -12,6 +15,9 @@ class ExtensionMethodFunctional { test.consume(s -> System.out.println("1: " + s), s -> System.out.println("2: " + s)); test.consume(System.out::println, System.out::println); + + Stream.of("a", "b", "c").map(String::toUpperCase).toList(); + List<Integer> i2 = Stream.of("a", "b", "c").map(String::toUpperCase).toList2(); } static class Extensions { @@ -29,5 +35,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; + } } } |