Daniil Ovchinnikov created GROOVY-9375:
------------------------------------------

             Summary: Cannot call method with Map parameter
                 Key: GROOVY-9375
                 URL: https://issues.apache.org/jira/browse/GROOVY-9375
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
    Affects Versions: 2.5.9
            Reporter: Daniil Ovchinnikov


{code}
def foo(Map<String, Map<String, Object>> m) { m }

@groovy.transform.CompileStatic
def csUsage() {
    Map<String, Object> inner = new LinkedHashMap<>()
    inner.put("b", 42)
    Map<String, Map<String, Object>> outer = new LinkedHashMap<>()
    outer.put("a", inner)
    foo(outer)
    foo(a: inner)        // error
    foo(a: [b: 42])      // error
    foo([a: [b: 42]])    // error
}

csUsage()
{code}

The same error is reported on the lines with {{error}} comment: 
{noformat}
[Static type checking] - Cannot call script#foo(java.util.Map 
<java.lang.String, java.util.Map>) with arguments [java.util.LinkedHashMap 
<java.lang.String, java.util.LinkedHashMap>] 
{noformat}



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

Reply via email to