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

Eric Milles updated GROOVY-10890:
---------------------------------
    Fix Version/s: 3.0.15

> Generics regression in method call
> ----------------------------------
>
>                 Key: GROOVY-10890
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10890
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 4.0.7
>            Reporter: Christopher Smith
>            Assignee: Eric Milles
>            Priority: Major
>              Labels: generics, regression
>             Fix For: 3.0.15, 4.0.8
>
>
> I'm receiving a compile-time error on an invocation that is semantically 
> correct and worked in 4.0.6. When using the {{EnumMap}} copy constructor, the 
> STC appears to misinfer the type as {{<V, V>}} instead of {{<K, V>}}. The 
> problem seems to present itself only when {{V}} is also an enum type (of 
> course, {{K}} must be an enum type).
> {code}
> @CompileStatic
> class Example {
>     enum Foo {}
>     enum Bar {}
>     void run(Map<Foo, Bar> input) {
>         error(new EnumMap<>(input))  // error here
>     }
>     void error(Map<Foo, Bar> input) {
>     }
> }
> {code}
> {code}
> Groovy:[Static type checking] - Cannot call 
> Example#error(java.util.Map<Example.Foo, Example.Bar>) with arguments 
> [java.util.EnumMap<Example.Bar, Example.Bar>]       {code}



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

Reply via email to