Thodoris Sotiropoulos created GROOVY-10499:
----------------------------------------------
Summary: Incomplete type variable substitution when using wildcard
type and diamond operator
Key: GROOVY-10499
URL: https://issues.apache.org/jira/browse/GROOVY-10499
Project: Groovy
Issue Type: Bug
Reporter: Thodoris Sotiropoulos
I have the following groovy program
{code:java}
class Foo<T> {
Foo(T x) {}
}
class Bar<T> {
Bar(Foo<? extends T> foo, T p) {
}
T m(T x) {
return null;
}
}
public class Test<T> {
void test() {
T x = null;
new Bar<>(new Foo<T>(x), x).m(x);
}
}
{code}
h3. Actual behaviour
groovyc rejects the program by raising
{code}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
test.groovy: 20: [Static type checking] - Cannot find matching method Bar#m(T).
Please check if the declared type is correct and if the method exists.
@ line 20, column 5.
new Bar<>(new Foo<T>(x), x).m(x);
^
1 error
{code}
h3. Expected behaviour
Compile successfully.
Tested against master (commit: 85676f1855bbe751bac897ea3fdd900fbbe74ecb).
--
This message was sent by Atlassian Jira
(v8.20.1#820001)