You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Pascal Schumacher (JIRA)" <ji...@apache.org> on 2015/07/08 18:34:05 UTC

[jira] [Updated] (GROOVY-3676) Explicitly dereferenced hash values created by variables return null

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

Pascal Schumacher updated GROOVY-3676:
--------------------------------------
    Affects Version/s: 2.4.3

> Explicitly dereferenced hash values created by variables return null
> --------------------------------------------------------------------
>
>                 Key: GROOVY-3676
>                 URL: https://issues.apache.org/jira/browse/GROOVY-3676
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-runtime
>    Affects Versions: 1.6, 1.6.4, 1.7-beta-1, 2.4.3
>         Environment: Linux and Windows
>            Reporter: Paul Pomerleau
>         Attachments: map_problem1.groovy
>
>
> "${key1}" as a key in a hash (left side of a ' X : X ' item) can't be dereferenced later.  As in 
>     key1 = "VARIABLE_1"
>     a1 = [ "${key1}" : "YES 3"]  // This is not accessible, later.
> The key shows a key=value pair when you move through the map using eachWithIndex
>    a1.eachWithIndex { it -> print "$it\n" }
> produces "VARIABLE_1=YES 3"
> But when you explicitly dereference it, you get a null
>    print a1["${key1}"]
> produces "null"
> This is not a minor problem if one uses groovy as a text processing/scripting language.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)