Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
4.0.7
Description
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).
@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) { } }
Groovy:[Static type checking] - Cannot call Example#error(java.util.Map<Example.Foo, Example.Bar>) with arguments [java.util.EnumMap<Example.Bar, Example.Bar>]