Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.7.0
-
None
Description
When using GroovyScriptEngine to create classes, invoking loadScriptByName twice on the same source file will return an anonymous inner classes on the second invocation (eg, reloading classes).
class MySwingPanel extends FrameworkPanel
{
def initPanel()
{
def b = new Button('click me')
b.addActionListener( new ActionListener()
)
}
}
GroovyScriptEngine gse ...
gse.loadScriptByName('myswingpanel.groovy') // returns MySwingPanel
// now reload everything
gse.getGroovyClassLoader().clearCache();
gse.loadScriptByName('myswingpanel.groovy') // returns MySwingPanel$1
For now the workaround in my project is to just create a new instance of GroovyScriptEngine.