Closed
Bug 15711
Opened 25 years ago
Closed 21 years ago
Can't call java.lang.Class methods from JS
Categories
(Rhino Graveyard :: Core, defect, P3)
Tracking
(Not tracked)
VERIFIED
FIXED
People
(Reporter: beard, Assigned: norrisboyd)
Details
If I do the following: js> o = new java.lang.Object(); js> c = o.getClass(); js> c.getName(); It doesn't work, because classes only reflect the static methods of a class, but not the instance methods of java.lang.Class. Should we fix this? If, so how? Here's one way to fix this: each java.lang.Class is wrapped in Rhino as a NativeJavaClass instance. We could create a NativeJavaObject wrapper for the class object that reflects the instance methods, and make that the prototype of the NativeJavaClass. Then we would have any public static methods defined on the class shadow methods that come from java.lang.Class, but those could be called by accessing the prototype. 0
Comment 1•25 years ago
|
||
If this is how Rhino LiveConnect works (or doesn't work, as the case may be), then Rhino acts differently from the way LiveConnect works in Mozilla and all previous releases of LiveConnect. LiveConnect has always treated 'java.lang.Object' and '(new java.lang.Object()).getClass()' as two distinctly different types of objects. The former object has as properties all the static members of the java.lang.Object class and the latter is a JS wrapper around an instance of java.lang.Class.
Assignee | ||
Updated•25 years ago
|
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Reporter | ||
Updated•25 years ago
|
Status: RESOLVED → CLOSED
Reporter | ||
Comment 2•25 years ago
|
||
I've verified that we now have the correct "LiveConnect" behavior.
Comment 3•21 years ago
|
||
Status CLOSED is deprecated as per bug 169885
Status: CLOSED → REOPENED
Resolution: FIXED → ---
Comment 4•21 years ago
|
||
Re-Resolving
Status: REOPENED → RESOLVED
Closed: 25 years ago → 21 years ago
Resolution: --- → FIXED
Comment hidden (collapsed) |
You need to log in
before you can comment on or make changes to this bug.
Description
•