Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.5.1
-
Fix Version/s: JRuby 1.5.3
-
Component/s: Embedding
-
Labels:None
-
Number of attachments :
Description
Global variables defined in the script engine's global bindings are not accessible. It doesn't matter if the bindings are set with scriptEngineManager.setBindings(globalBindings) or scriptEngine.setBindings(globalBindings, ScriptContext.GLOBAL_SCOPE). In either case, the bindings seem to be ignored.
I'm attaching an executable Java class that illustrates this problem.
Thanks for reporting this. I just want to make sure since the key-value pair was set to the bindings of GLOBAL_SCOPE. My understanding is that all eval() methods should see bindings of ENGINE_SCOPE unless GLOBAL_SCOPE of bindings are given explicitly. In the provided code, bindings are implicitly referenced, so just ENGINE_SCOPE should be referenced. Is my understanding wrong? Does the GLOBAL_SCOPE key-value pair work while evaluating in other languages?