Eric Milles created GROOVY-10282:
------------------------------------
Summary: STC: false positive for BiFunction and BinaryOperator
with same type parameter
Key: GROOVY-10282
URL: https://issues.apache.org/jira/browse/GROOVY-10282
Project: Groovy
Issue Type: Improvement
Affects Versions: 4.0.0-beta-1
Reporter: Eric Milles
Assignee: Eric Milles
Consider the following:
{code:groovy}
@groovy.transform.CompileStatic
String foo() {
def integers = java.util.stream.IntStream.range(0, 10).boxed()
integers.reduce('', (s, i) -> s + '-', String::concat)
}
{code}
{{reduce}} has the following signature in {{java.util.stream.Stream}}:
{code:java}
<U> U reduce(U identity, BiFunction<U, ? super T, U> accumulator,
BinaryOperator<U> combiner);
{code}
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.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)