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 2022/04/08 15:22:00 UTC

[jira] [Created] (GROOVY-10576) STC: map putAll fails to match "?" to "Object"

Eric Milles created GROOVY-10576:
------------------------------------

             Summary: STC: map putAll fails to match "?" to "Object"
                 Key: GROOVY-10576
                 URL: https://issues.apache.org/jira/browse/GROOVY-10576
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
            Reporter: Eric Milles
            Assignee: Eric Milles


Consider the following:
{code:groovy}
@groovy.transform.TypeChecked
class C {
  Map<String,Object> map
  void test(Map<? extends String, ?> m) {
    map.putAll(m)
  }
}
{code}

{{javac}} allows {{putAll}} in this situation.  {{groovyc}} emits an error: Cannot call {{java.util.Map#putAll(java.util.Map<? extends java.lang.String, ? extends java.lang.Object>)}} with arguments {{[java.util.Map<? extends java.lang.String, ?>]}}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)