Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Won't Fix
-
Affects Version/s: 1.0-beta-6
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:Gentoo Linux, Sun JDK 1.4.2-04, one of beta-6 snapshots
-
Number of attachments :
Description
Bug can be best illustrated by sample BSFConsole session (it uses BSFEngine.eval(..) call):
groovy% class test1{void foo(){println("test1: foo")}}; new test1().foo()
test1: foo
groovy% class test2{void foo(){println("test2: foo")}};
groovy% new test2().foo()
General error during class generation: No such class: test2 in constructor call for class: groovy_console. At [1:1] groovy_console
at org.codehaus.groovy.control.ProcessingUnit.fail(ProcessingUnit.java:466)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:939)
at org.codehaus.groovy.control.CompilationUnit.classgen(CompilationUnit.java:586)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:480)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:228)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:351)
at groovy.lang.GroovyShell.parse(GroovyShell.java:362)
at groovy.lang.GroovyShell.parse(GroovyShell.java:344)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:327)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:282)
at org.codehaus.groovy.bsf.GroovyEngine.eval(GroovyEngine.java:147)
at org.kos.bsfconsoleplugin.BSFInterpreter.eval(BSFInterpreter.java:153)
at org.kos.bsfconsoleplugin.BSFInterpreter$1.run(BSFInterpreter.java:118)
at java.lang.Thread.run(Thread.java:534)
So it allows to use defined classes inside single eval() call, but forgets them in consequent calls.
Issue Links
| This issue is depended upon by: | ||||
| GROOVY-756 | improve GroovyShell |
|
|
|
Another issue which may have the same roots:
groovy% Class.forName("org.kos.bsfconsoleplugin.BSFConsoleConfig").newInstance()
org.kos.bsfconsoleplugin.BSFConsoleConfig@5762f7ce
groovy% org.kos.bsfconsoleplugin.BSFConsoleConfig cfg = new org.kos.bsfconsoleplugin.BSFConsoleConfig()
org.kos.bsfconsoleplugin.BSFConsoleConfig@5762f7ce
groovy% import org.kos.bsfconsoleplugin.BSFConsoleConfig; new BSFConsoleConfig()
org.kos.bsfconsoleplugin.BSFConsoleConfig@5762f7ce
groovy% import org.kos.bsfconsoleplugin.BSFConsoleConfig
groovy% new BSFConsoleConfig()
General error during class generation: No such class: BSFConsoleConfig in constructor call for class: groovy_console. At [1:1] groovy_console
So 'import' statement works only in the scope of single 'eval' call