Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.7.5
-
None
Description
A minimal extension of groovy.io.Console throws "groovy.lang.MissingPropertyException: No such property: scriptRunning" after successfully evaluating a script.
GWLSTConsole.groovy
package com.middlewareman.mbean.weblogic.shell class GWLSTConsole extends groovy.ui.Console { GWLSTConsole() { super() } GWLSTConsole(Binding binding) { super(binding) } GWLSTConsole(ClassLoader parent, Binding binding) { super(parent, binding) } GWLSTConsole(ClassLoader parent) { super(parent) } }
Exception in thread "Thread-5" groovy.lang.MissingPropertyException: No such property: scriptRunning for class: com.middlewareman.mbean.weblogic.shell.GWLSTConsole at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:49) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.setGroovyObjectProperty(ScriptBytecodeAdapter.java:533) at groovy.ui.Console$_runScriptImpl_closure16.doCall(Console.groovy:904) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:273) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886) at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:44) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:141) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149) at groovy.ui.Console$_runScriptImpl_closure16.doCall(Console.groovy) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88) at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:273) at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886) at groovy.lang.Closure.call(Closure.java:276) at groovy.lang.Closure.call(Closure.java:271) at groovy.lang.Closure.run(Closure.java:354) at java.lang.Thread.run(Unknown Source)
In general, it would be great if groovy.ui.Console would be more flexible for adapting to your own DSLs. In my case, for example, I would like to customise the title. It is currently hard-coded in two places, and extending the class would be one way of overriding these.