mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
1d174dde8d
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 |
||
---|---|---|
.. | ||
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>