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

groovysh completion vulnerable to map types with 'class' entry

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.0-beta-2
    • Fix Version/s: 2.2.1
    • Component/s: Groovysh
    • Labels:
      None
    • Environment:
      Ubuntu Precise Java 6

      Description

      To reproduce, start groovysh, enter:

       
      groovy:000> config = new ConfigSlurper().parse(new File('foo.groovy').toURL())
      groovy:000> config.
      

      press tab
      should list properties, newline instead

      For full stack, run groovysh --debug

      org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'groovy.util.ConfigObject@6ad21538' with class 'groovy.util.ConfigObject' to class 'java.lang.Class' due to: java.lang.ClassNotFoundException: groovy.util.ConfigObject@6ad21538
      at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToClass(DefaultTypeTransformation.java:380)
      at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:249)
      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:599)
      at org.codehaus.groovy.tools.shell.completion.ReflectionCompletor.getPublicFieldsAndMethods(ReflectionCompletor.groovy:277)
      at org.codehaus.groovy.tools.shell.completion.ReflectionCompletor$getPublicFieldsAndMethods.callStatic(Unknown Source)
      at org.codehaus.groovy.tools.shell.completion.ReflectionCompletor.complete(ReflectionCompletor.groovy:74)
      at org.codehaus.groovy.tools.shell.completion.ReflectionCompletor$complete.call(Unknown Source)

      This line fails:
      Class clazz = instance.class

      I last touched the failing class ReflectionCompletor, but sadly I currently have no working environment to run all tests.

        Attachments

          Activity

            People

            • Assignee:
              pschumacher Pascal Schumacher
              Reporter:
              tkruse Thibault Kruse
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: