pjs/js/rhino
norris%netscape.com abc0613496 Fix the following problem:
Subject:
        ImporterTopLevel problem
   Date:
        Fri, 6 Aug 1999 15:42:50 -0400
   From:
        "\"Howard\" Xuhua Lin" <howard@softcom.com>
     To:
        "Norris Boyd" <norris@netscape.com>
    CC:
        "Andrew Wason" <aw@softcom.com>




Hi, The following script will cause an EvaluatorException: Ambiguous import: [JavaPackage java.awt.JButton] and [JavaPackage
java.awt.Packages.javax.swing.JButton] in the js shell:

js>importPackage(java.awt);
js>importPackage(Packages.javax.swing);
js>new JButton();.

The current JS shell will not print this exception message, even though the comment says "// Already printed message, so just fall
through". I add System.err.println(ee.getMessage()); for this exception.

The problem is that in NativeJavaPackage.get(String, Scriptable) method, if a ClassNotFoundException is caught, a
NativeJavaPackage object is created and passed back to ImporterTopLevel.get Method. So in ImporterTopLevel.get method, object v
is always not NOT_FOUND and the ambiguous exception will be thrown. Object v is supposed to be a Class object but it actually is
a Package object.

The fix can be either (1) in NativeJavaPackage.get(String, Scriptable) method, if a ClassNotFoundException is caught, return a
NOT_FOUND object (you may still create a Package object) or (2) in ImporterTopLevel.get method, make sure the returned object
from NativeJavaPackage.get method is of NativeJavaClass type.

Howard
1999-08-12 16:59:29 +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 the following problem: 1999-08-12 16:59:29 +00:00
src/org/mozilla Fix the following problem: 1999-08-12 16:59:29 +00:00
toolsrc/org/mozilla/javascript/tools Fix the following problem: 1999-08-12 16:59:29 +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>