All users were logged out of Bugzilla on October 13th, 2018

Can't call java.lang.Class methods from JS

VERIFIED FIXED

Status

P3
normal
VERIFIED FIXED
19 years ago
15 years ago

People

(Reporter: beard, Assigned: norrisboyd)

Tracking

Details

(Reporter)

Description

19 years ago
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

19 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

19 years ago
Status: NEW → RESOLVED
Last Resolved: 19 years ago
Resolution: --- → FIXED
(Reporter)

Updated

19 years ago
Status: RESOLVED → CLOSED
(Reporter)

Comment 2

19 years ago
I've verified that we now have the correct "LiveConnect" behavior.

Comment 3

15 years ago
Status CLOSED is deprecated as per bug 169885
Status: CLOSED → REOPENED
Resolution: FIXED → ---

Comment 4

15 years ago
Re-Resolving
Status: REOPENED → RESOLVED
Last Resolved: 19 years ago15 years ago
Resolution: --- → FIXED

Comment 5

15 years ago
verifying former CLOSED bugs
Status: RESOLVED → VERIFIED

Comment 6

15 years ago
Trageting as resolved against 1.5R5
Target Milestone: --- → 1.5R5

Comment 7

15 years ago
Untargeting wrong milestone assignment
Target Milestone: 1.5R5 → ---
You need to log in before you can comment on or make changes to this bug.