gecko-dev/js
norris%netscape.com 1d174dde8d 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
..
benchmarks
js2/java
jsd
jsdj
jsj
macbuild added files: mozilla/js/src/xpconnect/idl/xpctest2.idl 1999-07-16 20:35:58 +00:00
ref
rhino Fix the following problem: 1999-08-12 16:59:29 +00:00
semantics Updated for recent semantic engine changes. Changed the meaning of (?= to match Perl. 1999-07-27 01:05:59 +00:00
src Changes to the xpidl compiler - 1999-08-10 12:18:01 +00:00
tests Fixed lastIndex test - value is ignored for non-global regexp. 1999-08-11 04:31:19 +00:00
.cvsignore more anal tricks. 1999-06-26 05:01:40 +00:00
landbranch.pl
Makefile.in
makefile.win