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 2021/03/28 18:55:00 UTC
[jira] [Assigned] (GROOVY-7106) Improve coercion / implicit cast of
map literals for @CompileStatic
[ https://issues.apache.org/jira/browse/GROOVY-7106?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles reassigned GROOVY-7106:
-----------------------------------
Assignee: Eric Milles
> 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
>
> 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)