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/03/28 18:40:00 UTC

[jira] [Resolved] (GROOVY-10002) STC: inconsistent support for assignment of list literals

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

Eric Milles resolved GROOVY-10002.
----------------------------------
    Resolution: Fixed

> STC: inconsistent support for assignment of list literals
> ---------------------------------------------------------
>
>                 Key: GROOVY-10002
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10002
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 4.0.0-alpha-3
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Consider the following:
> {code:groovy}
> @groovy.transform.TypeChecked
> void test() {
>   List<String> a = [] // okay
>   Set<String> b = [] // okay
>   Deque<String> c = [] // GroovyCastException at runtime
>   Deque<String> d = [1,2,3] // error for unknown constructor (interfaces don't have them) and error for incompatible generics
>   ArrayDeque<String> e = [123] // ArrayDeque(int numElements); error for incompatible generics (bad)
>   Set<String> f = ['foo', 'bar', 'foo'] // error for unknown constructor (castToType would handle this at runtime if allowed) and error for incompatible generic types (wrong)
> }
> {code}



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