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

Daniil Ovchinnikov updated GROOVY-9375:
---------------------------------------
    Description: 
{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}

Expected: no errors.

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}

  was:
{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}


> 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
>            Priority: Major
>
> {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}
> Expected: no errors.
> 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