Closed
Bug 306308
Opened 19 years ago
Closed 19 years ago
JS function as Java interface via reflect.Proxy
Categories
(Rhino Graveyard :: Compiler, enhancement)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: igor, Assigned: igor)
Details
Attachments
(1 file)
24.13 KB,
patch
|
Details | Diff | Splinter Review |
Currently the automatic conversion of JavaScript function to Java interface is
implemented through generation of Java class implementing the interface. This is
similar to JavaAdapter code. In general it works nicely but still there are
limitations:
1. It requires the permission to create a class loader which may not be granted
to the application or applet.
2. The class loader requires that its parent loader must have access to both
Rhino classes and the interface in question. It may not be possible with loading
interfaces dynamically.
3. On some JVMs it causes memory leak.
All this problems can be addressed using java.lang.reflect.Proxy which is
available since JDK 1.3. Thus I suggest to use it for function->interface
conversion.
It would have another benefit of making feature available with smalljs.jar as
the code would no longer depend on class generation library.
Ideally it would be nice to use java.lang.reflect.Proxy for JavaAdapter as well
when it needs to implement only interfaces without subclassing Java classes, but
that is for separated bug.
Assignee | ||
Comment 1•19 years ago
|
||
Not to introduce dependency on JDK 1.3-only feature in Rhino core I factored
out that through JVMBridge
Assignee | ||
Comment 2•19 years ago
|
||
I committed the implementation.
Assignee | ||
Updated•19 years ago
|
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•