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

Eric Milles resolved GROOVY-7274.
---------------------------------
    Fix Version/s: 4.0.0-alpha-3
       Resolution: Fixed

> Improve type inference for hash map -> Map<?, ?>
> ------------------------------------------------
>
>                 Key: GROOVY-7274
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7274
>             Project: Groovy
>          Issue Type: Improvement
>          Components: Static compilation
>    Affects Versions: 2.4.0
>            Reporter: Hendy Irawan
>            Assignee: Eric Milles
>            Priority: Trivial
>             Fix For: 4.0.0-alpha-3
>
>
> Currently we have to do this:
> {code}
> @CompileStatic
> ...
> inserter.createNode([v: it.value, l: it.language] as Map<String, Object>, 
> labelLabel)
> {code}
> If not we'll get:
> {code}
> Error:(81, 37) Groovyc: [Static type checking] - Cannot call 
> org.neo4j.unsafe.batchinsert.BatchInserter#createNode(java.util.Map 
> <java.lang.String, java.lang.Object>, org.neo4j.graphdb.Label[]) with 
> arguments [java.util.LinkedHashMap <java.lang.String, java.lang.String>, 
> org.neo4j.graphdb.Label]
> {code}
> But since the caller requests Map<String, Object>, Groovy can create the 
> hashmap as <String, Object> instead of <String, String>... saving us from 
> explicit type coercion even with {{@CompileStatic}}. (similar to Java7's 
> diamond operator)



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

Reply via email to