[
https://issues.apache.org/jira/browse/GROOVY-9945?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles updated GROOVY-9945:
--------------------------------
Fix Version/s: 2.5.16
> STC: Cannot find matching method when using Generics
> ----------------------------------------------------
>
> Key: GROOVY-9945
> URL: https://issues.apache.org/jira/browse/GROOVY-9945
> Project: Groovy
> Issue Type: Bug
> Components: Static compilation, Static Type Checker
> Affects Versions: 4.0.0-alpha-2
> Reporter: Stefanos Chaliasos
> Assignee: Eric Milles
> Priority: Major
> Fix For: 4.0.0-alpha-3, 3.0.9, 2.5.16
>
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> I have the following Groovy program.
> {code:groovy}
> interface I1<X, Y> {}
> interface I2 extends I1<Character, Character> {}
> class Foo<X, Y> implements I2 {
> public void foo(X x, Y y) {}
> }
> class Bar<X, Y> extends Foo<X, Y> {}
> @groovy.transform.TypeChecked
> class Main {
> public static void foo() {
> new Bar<Float, Integer>().foo((Float) 1.4, -1)
> }
> }
> {code}
> h2. Actual Behavior
> The program does not compile, and I get the following error.
> {code:java}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
> failed:
> Main.groovy: 14: [Static type checking] - Cannot find matching method
> Bar#foo(java.lang.Float, java.lang.Integer). Please check if the declared
> type is correct and if the method exists.
> @ line 14, column 5.
> new Bar<Float, Integer>().foo((Float) 1.4, -1)
> ^
> 1 error
> {code}
> h2. Expected Behavior
> Compile successfully.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)