mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-06 00:55:37 +00:00
d055865e6d
Subject: reflection and illegal package access Date: Wed, 04 Aug 1999 21:56:20 -0400 From: Andrew Wason <aw@softcom.com> To: norris@netscape.com (Norris Boyd) CC: Howard Lin <howard@softcom.com> If you run Rhino under JDK1.2 with a security manager: java -Djava.security.manager=java.lang.SecurityManager org.mozilla.javascript.tools.shell.Main Then reflection fails for objects that are in a restricted access package (e.g. sun.*). Rhino is reflecting based on the dynamic type of the object instead of the declared static return type. In this example, createImage is declared to return java.awt.Image, but it returns sun.awt.image.OffScreenImage. Attempting to reflect this class results in a java.security.AccessControlException for java.lang.RuntimePermission accessClassInPackage.sun.awt.image. Here is the script. You will need to type it in because you won't be able to load it from a file due to the security manager. var f = new java.awt.Frame(); f.setVisible(true); var i = f.createImage(10,10); |
||
---|---|---|
.. | ||
examples | ||
macbuild | ||
org/mozilla | ||
src/org/mozilla | ||
toolsrc/org/mozilla/javascript/tools | ||
Makefile | ||
manifest | ||
README.html |
<html> <body> <h1> <span CLASS=LXRSHORTDESC> Rhino: JavaScript in Java<p> </span> </h1> <span CLASS=LXRLONGDESC> Rhino is an implementation of JavaScript in Java. Documentation can be found <a href="http://www.mozilla.org/js/rhino/rhino.html">here</a>. </span> </body> </html>