You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniil Ovchinnikov (JIRA)" <ji...@apache.org> on 2019/02/08 11:43:00 UTC

[jira] [Created] (GROOVY-8983) Cannot assign Collection to Array

Daniil Ovchinnikov created GROOVY-8983:
------------------------------------------

             Summary: Cannot assign Collection to Array
                 Key: GROOVY-8983
                 URL: https://issues.apache.org/jira/browse/GROOVY-8983
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
    Affects Versions: 2.5.6
            Reporter: Daniil Ovchinnikov


{code:java}
Collection<? extends Runnable> foo() {}

@groovy.transform.CompileStatic
def usage() {
  Runnable[] ar = foo() // OK as expected
}

@groovy.transform.CompileStatic
def usage(Collection<? extends Runnable> cr) {
  Runnable[] ar = cr // [Static type checking] - Cannot assign value of type java.util.Collection <? extends java.lang.Runnable> to variable of type java.lang.Runnable[]
}
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)