Closed
Bug 39906
Opened 25 years ago
Closed 25 years ago
Problem with JavaAdapter Scoping
Categories
(Rhino Graveyard :: Core, defect, P3)
Tracking
(Not tracked)
VERIFIED
FIXED
People
(Reporter: beard, Assigned: norrisboyd)
Details
Try the following example in Rhino's shell:
/*
runnable.js
Demonstrates use of JavaScript from JShell, implementing the
interface java.lang.Runnable using the new syntax.
by Patrick C. Beard.
*/
var runnableDate = new Date();
runnableDate.run = function() {
print('runnableDate.run() here.');
}
// create a java.lang.Runnable.
var runnable = new java.lang.Runnable(runnableDate);
Store this in "runnable.js" and type this in the shell:
js> load('runnable.js')
js> runnable
adapter0@bb070d
js> runnable.self
java.lang.NullPointerException
java.lang.NullPointerException
at
org.mozilla.javascript.ScriptableObject.getTopLevelScope(ScriptableObject.java:12
89)
at
org.mozilla.javascript.ScriptableObject.getClassPrototype(ScriptableObject.java:1
263)
at
org.mozilla.javascript.ScriptableObject.getFunctionPrototype(ScriptableObject.jav
a:1242)
at org.mozilla.javascript.JavaMembers.reflectMethod(JavaMembers.java:305)
at org.mozilla.javascript.JavaMembers.reflect(JavaMembers.java:319)
at org.mozilla.javascript.JavaMembers.<init>(JavaMembers.java:58)
at org.mozilla.javascript.JavaMembers.lookupClass(JavaMembers.java:488)
at org.mozilla.javascript.NativeJavaObject.<init>(NativeJavaObject.java:72)
at org.mozilla.javascript.NativeJavaObject.wrap(NativeJavaObject.java:191)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:215)
at
org.mozilla.javascript.ScriptableObject.getDefaultValue(ScriptableObject.java:528
)
at org.mozilla.javascript.NativeDate.getDefaultValue(NativeDate.java:101)
at org.mozilla.javascript.ScriptRuntime.toString(ScriptRuntime.java:408)
at org.mozilla.javascript.Context.toString(Context.java:1108)
at org.mozilla.javascript.tools.shell.Main.processSource(Main.java:287)
at org.mozilla.javascript.tools.shell.Main.exec(Main.java:146)
at org.mozilla.javascript.tools.shell.Main.main(Main.java:74)
at org.jxe.tools.java.Java.main(Java.java:113)
at org.jxe.kernel.Tool$ToolThread.run(Tool.java:215)
The problem seems to be that
org.mozilla.javascript.ScriptableObject.getTopLevelScope() is getting passed a
null scope to begin with.
Assignee | ||
Updated•25 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 2•25 years ago
|
||
I checked in the fix and removed the negative tests that started failing as a
result (see thread in n.p.m.jseng)
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•