Fix in GroovyEvaluator: import all used classes when evaluating for inspector of debugger.
This makes all classes accessed without fully qualified name (vast majority
of code) accessible by the evaluator as well. Otherwise, Groovy won't be able
to resolve classes used in the code.
--- a/GroovyEvaluator.st Thu Aug 29 13:33:12 2013 +0100
+++ b/GroovyEvaluator.st Fri Aug 30 12:04:07 2013 +0100
@@ -105,7 +105,7 @@
!
evaluate: sourceObj in: context receiver: receiver notifying: requestorObj logged: logged ifFail: fail
- | shell binding result wsForWorkspace |
+ | shell binding result wsForWorkspace class |
JavaVM booted ifFalse: [
Java initialize.
@@ -137,6 +137,15 @@
].
].
shell := JAVA stx libjava groovy GroovyShell new: binding.
+ class := receiver class theNonMetaclass.
+ class isJavaClass ifTrue:[
+ "/ Import all classes used by the receriver's class.
+ class constantPool do:[:each|
+ (each isJavaRef and:[each isJavaClassRef]) ifTrue:[
+ shell addClassImport: each javaClassName asDottedJavaClassName.
+ ]
+ ]
+ ]
].
@@ -144,7 +153,7 @@
^ result class javaUnwrap: result.
"Created: / 17-08-2011 / 08:54:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 24-08-2013 / 17:18:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 30-08-2013 / 00:45:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
moreSharedPools: pools