You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/04/02 16:40:00 UTC

[jira] [Resolved] (GROOVY-8984) Can assign Collection with super wildcard to Array

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

Eric Milles resolved GROOVY-8984.
---------------------------------
    Fix Version/s: 4.0.0-alpha-3
       Resolution: Fixed

> Can assign Collection with super wildcard to Array
> --------------------------------------------------
>
>                 Key: GROOVY-8984
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8984
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 2.5.6
>            Reporter: Daniil Ovchinnikov
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 4.0.0-alpha-3
>
>
> {code:java}
> Collection<? super Runnable> foo() {[new Object()]}
> @groovy.transform.CompileStatic
> def usage() {
>   Runnable[] ar = foo() // here
>   ar
> }
> println usage()
> {code}
> Expected: compilation should fail
>  Actual: compilation completes and execution fails with {{Cannot cast object 'java.lang.Object@65e98b1c' with class 'java.lang.Object' to class 'java.lang.Runnable'}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)