Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
4.0.0-beta-1
-
None
Description
Consider the following:
@groovy.transform.CompileStatic String foo() { def integers = java.util.stream.IntStream.range(0, 10).boxed() integers.reduce('', (s, i) -> s + '-', String::concat) }
reduce has the following signature in java.util.stream.Stream:
<U> U reduce(U identity, BiFunction<U, ? super T, U> accumulator, BinaryOperator<U> combiner);
The type parameter U is shared between the accumulator and combiner and should be resolved to java.lang.String. However, GenericsUtils#parameterizeSAM is producing java.lang.Integer as the return type since that is what is associated with T in this context.