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

Harsh Gupta updated GROOVY-8285:
--------------------------------
    Priority: Critical  (was: Major)

> Static compilation does not accept subclasses for generic arguments
> -------------------------------------------------------------------
>
>                 Key: GROOVY-8285
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8285
>             Project: Groovy
>          Issue Type: Bug
>         Environment: Groovy Version: 2.4.12 JVM: 1.8.0_121 Vendor: Oracle 
> Corporation OS: Mac OS X
>            Reporter: Harsh Gupta
>            Priority: Critical
>
> This snippet does not compile.
> {code:Java}import groovy.transform.CompileStatic
> @CompileStatic
> class Scratch {
>     public static void main(String[] args) {
>         List<bar> listA
>         List<foo> listB = new ArrayList<>()
>         listB.add(new foo())
>         listA = listB
>     }
> }
> class bar {
>     public int blah() { return 12; }
> }
> class foo extends bar {
>     public int boo() { return 42; }
> }
> {code}
> Compilation errors:
> {quote}
> repro.groovy: 10: \[Static type checking\] - Incompatible generic argument 
> types. Cannot assign java.util.ArrayList <foo> to: java.util.List <bar>
>  @ line 10, column 21.
>                listA = listB
> {quote}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to