Closed
Bug 618780
Opened 15 years ago
Closed 14 years ago
org.mozilla.javascript.Scriptable methods not invoked with java 1.6
Categories
(Rhino Graveyard :: Core, defect)
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: vesa.luomala, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; fi; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13
Build Identifier: 1.7R2
Hi!
We utilize Rhino Script Engine to evaluate values in our server that runs on Java 1.5. We have our own custom class that implements org.mozilla.javascript.Scriptable, and it works fine. Now we would like to update to Java 1.6, but it does not work anymore (any methods of this class extending org.mozilla.javascript.Scriptable are not invoked while evaluating the script).
While testing around, I noticed that if our custom class is changed to extend sun.org.mozilla.javascript.internal.Scriptable, it starts to work again. I was able to test this in Eclipse, but it seems that usage of sun.org.mozilla.javascript.internal.Scriptable is restricted and should not be used?
My test code (simplified) looks like this:
Context ctx = org.mozilla.javascript.Context.enter();
ScriptEngineManager manager = new javax.script.ScriptEngineManager();
List<ScriptEngineFactory> list = manager.getEngineFactories();
ScriptEngineFactory factory = list.get(0);
ScriptEngine engine = factory.getScriptEngine();
Bindings b = engine.createBindings();
TestScriptable call = new TestScriptable();
b.put("call", call);
Object result = engine.eval("call.eval.value == '1'", b);
...
where TestScriptable would be:
public class TestScriptable implements Scriptable {
public Object get(String name, Scriptable start) {
// TODO Auto-generated method stub
if(name.equals("call")) {
return new TestScriptable();
} else if(name.equals("eval")) {
return new TestScriptable();
} else if(name.equals("value")) {
return "1";
}
return null;
}
So this works with Java 1.5 and org.mozilla.javascript.Scriptable
or Java 1.6 and sun.org.mozilla.javascript.internal.Scriptable
Has something changed or is this really a bug?
Reproducible: Always
Comment 1•14 years ago
|
||
The version of Rhino included with JDK 6 has package names changed to sun.org.mozilla.* in order to avoid clashes with standard Rhino. You need to use one package prefix or the other depending on which version of Rhino you want to use, there's not much we can do about that. Closing as WONTFIX.
Status: UNCONFIRMED → RESOLVED
Closed: 14 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•