зеркало из https://github.com/mozilla/pjs.git
00f712e786
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 | ||
README.html | ||
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>