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 14:51:00 UTC
[jira] [Created] (GROOVY-10325) STC: error for map*.value
assignment
Eric Milles created GROOVY-10325:
------------------------------------
Summary: 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
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)