[ https://issues.apache.org/jira/browse/GROOVY-7106?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King closed GROOVY-7106. ----------------------------- > Improve coercion / implicit cast of map literals for @CompileStatic > ------------------------------------------------------------------- > > Key: GROOVY-7106 > URL: https://issues.apache.org/jira/browse/GROOVY-7106 > Project: Groovy > Issue Type: Improvement > Components: Static Type Checker > Affects Versions: 2.3.7 > Reporter: Jochen Eddelbuettel > Assignee: Eric Milles > Priority: Minor > Labels: @CompileStatic > Fix For: 4.0.0-alpha-3 > > Time Spent: 0.5h > Remaining Estimate: 0h > > This script fails without explicitly casting the map literal "as > Map<String,Object>". > {code} > assert testIt() == "AnyValue" > @groovy.transform.CompileStatic > def mapAccess(Map<String,Object> map) { > map["AnyKey"] > } > @groovy.transform.CompileStatic > def testIt() { > return mapAccess([ AnyKey: "AnyValue", OtherKey: new Date() ]) > } > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)