[ 
https://issues.apache.org/jira/browse/GROOVY-9947?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles updated GROOVY-9947:
--------------------------------
    Priority: Minor  (was: Major)

> Cannot pass numeric constant to a method with a generic type
> ------------------------------------------------------------
>
>                 Key: GROOVY-9947
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9947
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation, Static Type Checker
>    Affects Versions: 4.0.0-alpha-2
>            Reporter: Stefanos Chaliasos
>            Priority: Minor
>
> I have the following Groovy program.
> {code:groovy}
> @groovy.transform.TypeChecked
> class Main {
>   public static final void main(String[] args) {
>     final A<Float> a = new A<Float>()
>     a.foo(10)
>     a.bar(10) // Fails here
>   }
> }
> final class A<T> {
>   final void foo(Float x) {}
>   final void bar(T x) {}
> }
> {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: 6: [Static type checking] - Cannot call A 
> <Float>#bar(java.lang.Float) with arguments [int]
>  @ line 6, column 5.
>        a.bar(10)
>        ^
> 1 error
> {code}
> h2. Expected Behavior
> Compile successfully.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to