Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: 1.6-beta-1, 1.5.7
-
Fix Version/s: 1.6-rc-1, 1.7-beta-1
-
Component/s: Groovysh
-
Labels:None
-
Number of attachments :
Description
We currently have a problem with lazy load exceptions happening in Grails within the Groovysh command line shell. I tried to extend the shell so that we could fix the problem, however when I extend it the whole thing breaks because some of the commands access private fields of Groovysh which are not available when you subclass. For example I get an exception like this:
groovy.lang.MissingPropertyException: No such property: interp for class: org.codehaus.groovy.grails.cli.TransactionAwareGroovysh
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:49)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassGetPropertySite.getProperty(PogoMetaClassGetPropertySite.java:50)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:240)
at org.codehaus.groovy.tools.shell.commands.ImportCommand.createCompletors(ImportCommand.groovy:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
This is because ImportCommand tries to access the "interop" property in this method:
protected List createCompletors() { return [ new ImportCommandCompletor(shell.interp.classLoader), null ] }
However said property is private, and when you subclass it is not longer visible. Can you please add getters for the following private fields so that Groovysh can be subclassed:
- buffers
- parser
- interop
- imports
- runner
- history
Thanks!
interp or interop?