[ https://issues.apache.org/jira/browse/GROOVY-10082?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles reassigned GROOVY-10082: ------------------------------------ Assignee: Eric Milles > Incompatible generic argument types when combining subtyping and closures > ------------------------------------------------------------------------- > > Key: GROOVY-10082 > URL: https://issues.apache.org/jira/browse/GROOVY-10082 > Project: Groovy > Issue Type: Bug > Components: Static Type Checker > Reporter: Thodoris Sotiropoulos > Assignee: Eric Milles > Priority: Major > > I have the following program > > {code:java} > class A {} > class B extends A {} > class Main { > public static void main(String[] args) { > Closure<A> cls = { -> { > final A x = new B() > x > }} > } > } > {code} > > h3. Actual Behaviour > {code:java} > org.codehaus.groovy.control.MultipleCompilationErrorsException: startup > failed: > test.groovy: 7: [Static type checking] - Incompatible generic argument types. > Cannot assign groovy.lang.Closure<B> to: groovy.lang.Closure<A> > @ line 7, column 22. > Closure cls = { -> { > ^ > 1 error > {code} > h3. Expected Behaviour > Compile successfully > > I don't know if this behaviour is intended due to flow typing. > Tested against master > ([https://github.com/apache/groovy/commit/8830e47c3dbd5914e52330d4263c34bcfd05752d]) > -- This message was sent by Atlassian Jira (v8.3.4#803005)