gecko-dev/js/rhino
norris%netscape.com d055865e6d Fix problem found by Andrew Wason <aw@softcom.com>:
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);
1999-08-05 16:49:20 +00:00
..
examples Add new example. 1999-07-16 03:03:20 +00:00
macbuild added ImporterTopLevel.java 1999-06-19 23:38:35 +00:00
org/mozilla Fix problem found by Andrew Wason <aw@softcom.com>: 1999-08-05 16:49:20 +00:00
src/org/mozilla Fix problem found by Andrew Wason <aw@softcom.com>: 1999-08-05 16:49:20 +00:00
toolsrc/org/mozilla/javascript/tools A bunch of changes, some experimental. 1999-06-18 17:37:20 +00:00
Makefile - Added OS_TARGET-switched definition of CLASSPATHSEP, to support building under Windows NT with GNU make. Thanks to Andew Wason <aw@softcom.com> for this fix. 1999-08-03 22:15:02 +00:00
README.html Fix spelling, don't claim uniqueness. 1999-05-03 17:56:07 +00:00
manifest Remove class path for merging into a single JAR file. 1999-05-26 19:52:40 +00:00

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>