Thodoris Sotiropoulos created GROOVY-11114:
----------------------------------------------
Summary: Fail to find method reference in case of chain of
polymorphic method calls
Key: GROOVY-11114
URL: https://issues.apache.org/jira/browse/GROOVY-11114
Project: Groovy
Issue Type: Bug
Components: Static Type Checker
Reporter: Thodoris Sotiropoulos
This is probably a regresssion.
I have the following program
{code}
import java.util.*;
import java.util.concurrent.*;
class Foo<K, V> {
V apply(K p) { return null; }
}
class Main {
static final void test(Foo<Map.Entry<Number, Boolean>, String> p) {
ConcurrentHashMap.KeySetView<Number, Boolean> x = null;
ConcurrentHashMap<Number, Boolean> y = x.getMap();
y.<String>reduceEntries(19, p::apply, null); // works
x.getMap().<String>reduceEntries(19, p::apply, null); // fails
}
}
{code}
h3. Actual behavior
{code}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Main.groovy: 15: Failed to find method
'apply(java.util.Map$Entry<java.lang.Object, java.lang.Object>)' for the type:
Foo<java.util.Map$Entry<java.lang.Number, java.lang.Boolean>, java.lang.String>
@ line 15, column 42.
p().<String>reduceEntries(19, p::apply,
^
1 error
{code}
h3. Expected behavior
Compile successfully
h3. Notes
Tested against master
--
This message was sent by Atlassian Jira
(v8.20.10#820010)