Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-9584

CLONE - Error when creation a variable named "context"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.6
    • 4.0.0-alpha-1, 3.0.5, 2.5.13
    • Groovysh
    • None
    • Tested on windows XP SP3.

    Description

      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>

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              eniosp Enio Salgado Pereira
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: