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/10/22 19:47:00 UTC

[jira] [Resolved] (GROOVY-10325) STC: error for map*.value assignment

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

Eric Milles resolved GROOVY-10325.
----------------------------------
    Fix Version/s: 4.0.0-beta-2
       Resolution: Fixed

> STC: error for map*.value assignment
> ------------------------------------
>
>                 Key: GROOVY-10325
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10325
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Minor
>             Fix For: 4.0.0-beta-2
>
>
> Consider the following:
> {code:groovy}
> @groovy.transform.TypeChecked
> void test() {
>   Map<String,Object> map = [foo:'bar']
>   map*.value = 'baz' // Incompatible generic argument types. Cannot assign java.util.List<java.lang.String> to: java.util.List<java.lang.Object>
> }
> {code}
> I believe this assignment should work since the RHS string is indeed an Object.  Not sure if the LHS type should be {{List<? extends Object>}} or the RHS type should be {{List<? super String>}}.



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