You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2020/07/23 14:17:05 UTC

[jira] [Closed] (GROOVY-9584) CLONE - Error when creation a variable named "context"

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

Paul King closed GROOVY-9584.
-----------------------------

> CLONE - Error when creation a variable named "context"
> ------------------------------------------------------
>
>                 Key: GROOVY-9584
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9584
>             Project: Groovy
>          Issue Type: Bug
>          Components: Groovysh
>    Affects Versions: 1.6
>         Environment: Tested on windows XP SP3.
>            Reporter: Enio Salgado Pereira
>            Assignee: Paul King
>            Priority: Minor
>             Fix For: 4.0.0-alpha-1, 3.0.5, 2.5.13
>
>
> it looks like when we create a variable with name "context" we break the shell.
> To reproduce the error just create a variable called "context" and not will work. 
> If you set the context variable to null it will work again.
> Example bellow.
> Groovy Shell (1.6.0, JVM: 1.6.0_07)
> Type 'help' or '\h' for help.
> -------------------------------------------------------------------------------
> groovy:000> //this works
> ===> true
> groovy:000> a = 1
> ===> 1
> groovy:000> //after this, error!!
> ===> true
> groovy:000> context = "context"
> ===> context
> ERROR org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast
> object 'context' with class 'java.lang.String' to class 'groovy.lang.Binding'
>         at java_lang_Runnable$run.call (Unknown Source)
> groovy:000> a = 1
> ===> 1
> ERROR org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast
> object 'context' with class 'java.lang.String' to class 'groovy.lang.Binding'
>         at java_lang_Runnable$run.call (Unknown Source)
> groovy:000> purge all
> ERROR org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast
> object 'context' with class 'java.lang.String' to class 'groovy.lang.Binding'
>         at java_lang_Runnable$run.call (Unknown Source)
> groovy:000>



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