Commit Graph

150 Commits

Author SHA1 Message Date
norris%netscape.com
40f1ee60cc Changes for classfile generation. 1999-09-27 23:17:29 +00:00
rogerl%netscape.com
854aa7f8a3 Better error handling for interpreter. 1999-09-27 17:47:51 +00:00
rogerl%netscape.com
4953124561 Changes from Kurt Westerfield to improve error messages from Interpreter
by passing line/file data through bytecode.
1999-09-27 17:47:05 +00:00
rogerl%netscape.com
861193d030 Stash originating source file for error reporting 1999-09-27 17:45:26 +00:00
rogerl%netscape.com
0f93133878 ECMA 3 array length error handling. 1999-09-27 17:44:30 +00:00
rogerl%netscape.com
4238d6f520 Execute exec in the global scope. 1999-09-27 17:43:40 +00:00
rogerl%netscape.com
08abcd5436 New tokens to support better error messages from Interpreter. 1999-09-27 17:43:07 +00:00
beard%netscape.com
9675752f93 Fixed looking up 'length' property in Function objects: needed to look up prototype chain for zero arguments. Cleaned up some more, always storing Boolean.TRUE in local hash tables, rather than the method, methodKey or methodName. 1999-09-25 09:24:23 +00:00
beard%netscape.com
620e43cd95 Added ClassSignature, a key for caching generated adapter classes. Now passing superName, rather than superClass to constructor generation methods. 1999-09-25 08:11:24 +00:00
beard%netscape.com
38ef2b2d81 Fixed generateSuper when override has void return type. 1999-09-25 01:37:32 +00:00
norris%netscape.com
e6517361c6 Shorten name to make Mac developers happy. 1999-09-24 21:05:41 +00:00
norris%netscape.com
d51c86ce41 Patches from Kurt Westerfeld for JavaScript property access to JavaBeans.
Subject:
        Re: [Fwd: [Bug 13658] Changed - Rhino: null pointer exception on class with duplicate field/method]
   Date:
        Mon, 13 Sep 1999 20:57:32 -0400
   From:
        "Kurt Westerfeld" <kurt@westerfeld.com>
     To:
        "Norris Boyd" <norris@netscape.com>




I do have a patch for this, but it is intermixed with some other changes
that I have implemented for the get/set on Java instances (per my LC3
proposal).  The bug requires changes that are a little involved actually;
basically it seems that when getting the default value for a "field and
methods" (which combines the same-named entities), the prototype of the
parent scope is deref-ed, and the parent scope is null.  Hence, the scope
must be passed into the the cloned field and method values.

Also, the NativeJavaClass implementation passed "false" for isStatic on the
constructor of the FieldAndMethods Hashtable, which results in classes
having instance methods.  Bad.  I haven't filed a bug on that yet.
Additionally, I fixed a couple other NullPointerException nigglies thrown in
when exceptions are propagated in the same area.  Finally, when getting the
default value for the field, it is helpful to convert a Scriptable to string
when that is requested (as when typing in the console).

I am attaching the changed files.  The LC3++ code can be removed if you
want, which I can do for you but it will take a little longer.  What is your
preference?

-----Original Message-----
From: Norris Boyd <norris@netscape.com>
To: Kurt Westerfeld <kurt@westerfeld.com>
Date: Monday, September 13, 1999 4:54 PM
Subject: [Fwd: [Bug 13658] Changed - Rhino: null pointer exception on class
with duplicate field/method]


>Kurt,
>
>Is this the bug that your patch fixes?
>
>Thanks,
>Norris
>
1999-09-24 20:41:43 +00:00
norris%netscape.com
250df9809f Propagate files from old netscape code. 1999-09-24 20:05:59 +00:00
norris%netscape.com
ec0d89055e Implement the "cast" of java class objects so that js objects in java adapters can
use 'this' for the implemented java interface.
1999-09-24 18:20:08 +00:00
beard%netscape.com
b0a911e500 Added "generateSuper" which generates a method called "super$method()" which when called calls "super.method()." This is provided to support full sub-classing of Java classes from JavaScript. 1999-09-24 18:17:05 +00:00
beard%netscape.com
5185946b51 added a prototype field, so that a wrapped JavaAdapter can preserve the delegate object's original prototype chain. 1999-09-24 16:52:23 +00:00
beard%netscape.com
24a3e9d1a9 setAdapterProto: now splices in wrapper's prototype, rather than replacing object's original prototype chain. seems to work fine. 1999-09-24 16:51:25 +00:00
rogerl%netscape.com
167a47ffdb New error for wacky array lengths, ECMA 3 1999-09-23 23:19:00 +00:00
norris%netscape.com
faa7950d23 Fix some Array tests in the ecma suite. 1999-09-23 20:37:56 +00:00
rogerl%netscape.com
71eb1ee9d3 Can't assume object in reportConversionError is scriptable, so call more
generic java.object.toString instead.
1999-09-22 22:06:14 +00:00
norris%netscape.com
f8b25c9abd Allow a java.lang.String to be converted to a primitive string in getDefaultValue 1999-09-22 16:30:49 +00:00
norris%netscape.com
9a0f128be4 Fix "wapper". 1999-09-22 16:25:21 +00:00
beard%netscape.com
d080c25c1d JavaAdapter no longer uses FlattenedObject, since the prototype is simply the LiveConnect wrapper. 1999-09-22 08:22:53 +00:00
beard%netscape.com
1b108bb46a JavaAdapter no longer uses FlattenedObject, since the prototype is simply the LiveConnect wrapper. Simplified callMethod to only call Context.enter() if methodId property is defined in Scriptable object. 1999-09-22 08:22:47 +00:00
beard%netscape.com
0bb5087bad renamed "name" parameter "adapterName", removed explicit StringBuffer in favor of "adapter" + serial++ for clarity. 1999-09-22 03:54:00 +00:00
beard%netscape.com
ee2e476427 changed createAdapterClass() to only generate methods for properties defined in the wrapped object itself, not for properties defined in prototypes. This makes sense, as the prototype for the wrapped object becomes the LiveConnect wrapper, thus prototype properties become inaccessible anyway. 1999-09-22 01:32:05 +00:00
rogerl%netscape.com
2d8fcffd6b (Bug #13416)
Turned off 'super' keyword - was letting through some cut'n'pasted java
code quietly and blowing big chunks out of the codegen/interpreter later.
Anybody know why 'super' had an interesting value here? - there was no
support for it on any path that I could see.
1999-09-20 22:21:24 +00:00
norris%netscape.com
1cd4a572c8 Changes necessary to generate adapter classes to files with associated optimizer package. 1999-09-20 21:16:45 +00:00
norris%netscape.com
04f902243f Fix comments. 1999-09-17 16:38:51 +00:00
norris%netscape.com
dcd67f150f fix comment 1999-09-17 16:37:35 +00:00
norris%netscape.com
f032d61748 Clearer example. 1999-09-17 06:12:45 +00:00
norris%netscape.com
7e3b0bb1bc Tutorial examples. 1999-09-17 05:54:27 +00:00
norris%netscape.com
e549457121 Fix potential NullPointerException. 1999-09-10 18:39:04 +00:00
norris%netscape.com
de8bedf312 Two submissions from Kurt Westerfield <kurt@westerfield.com>:
Subject:
        Embedding the shell
   Date:
        Wed, 8 Sep 1999 16:01:44 -0400
   From:
        "Kurt Westerfeld" <kurt@westerfeld.com>
     To:
        "Norris Boyd" <norris@netscape.com>




Norris, please find the attached zip file containing the (minor)
modifications to the Rhino shell module that enables the shell to be
embedded in a host application.

There are two areas of change to be concerned about:

    1. Any and all references to System.in/out/err have been modified to use
Main.in/out/err, which default to System.in/out/err.  Methods to do a setIn,
setOut, and setErr were added.   Note that in/out/err on Main were made
static public, so that the jikes compiler wouldn't complain (I had them as
static protected, but when accessed outside of the package, a warning was
issued).

    2.  The global and sharedGlobal static variables were made protected so
that my app can make use of them (to add extensions after an initial pass
through main()).

That's it.

I have successfully used the facility to drop a remote telnet server into
the shell interpreter, effectively giving our server a remote shell
interpreter.  It's quite nice, as we have a lot of extensions to Rhino
written that blend into our server already.

PS, I am still working on the array issues, but made a lot of progress
today.  I just wanted to get this stuff off my desk.

Thanks!

________________________________________________________________________
  Kurt Westerfeld
  Managed Object Solutions
  2722 Merrilee Drive
  Suite 350
  Fairfax, VA 22031
  Phone: 703.208.3330 x225
  Fax: 703.208.3331
  http://www.mosol.com
  mailto:kurt@mosol.com



   shell.zip

             Name:
                   shell.zip
             Type:
                   Zip Compressed Data (application/x-zip-compressed)
          Encoding:
                   base64


==============================================================================

Subject:
        Rhino Array Source (Fixed)
   Date:
        Thu, 9 Sep 1999 14:12:03 -0400
   From:
        "Kurt Westerfeld" <kurt@mosol.com>
     To:
        "Norris Boyd" <norris@netscape.com>




Attached is NativeJavaObject.java, which seems to now pass the tests supplied to me by you and Scott.  Not a lot of change, but a lot of
testing and thinking was involved. <g>

PS. I also fixed a bug in reportConversionError() which was throwing an IllegalArgumentException inside of the MessageFormat class at times.
It also looks a little nicer (uses formatting from NativeJavaMethod) and closer to the C implementation.




   NativeJavaObject.java

                        Name:
                              NativeJavaObject.java
                         Type:
                              Java Source File (text/java)
                     Encoding:
                              quoted-printable
1999-09-09 18:49:58 +00:00
norris%netscape.com
d6d196e334 Long not supported here. Fix up comments so that is clear. 1999-09-02 16:48:20 +00:00
rogerl%netscape.com
a59e01d63d Fixes for ecma 2 regexp - adding context to init 1999-08-25 01:05:42 +00:00
rogerl%netscape.com
3c54401cd6 Fixes for ecma 2 regexp - adding context to init. 1999-08-25 01:03:06 +00:00
rogerl%netscape.com
bb3f4355d0 New errors for ecma 2 regexp. 1999-08-25 01:01:19 +00:00
rogerl%netscape.com
86ebd61886 Fixes for ecma 2 - add context to regexp init. 1999-08-25 01:00:09 +00:00
rogerl%netscape.com
a845f3ca48 Fixed \<digits> interpretation for ecma 2 compliance. 1999-08-25 00:59:21 +00:00
norris%netscape.com
cea0ae8198 Add a comment. 1999-08-16 18:54:47 +00:00
beard%netscape.com
efd6873119 js now propagates ThreadDeath exceptions 1999-08-14 02:32:20 +00:00
beard%netscape.com
f8e5d95fcd added mozilla/js/rhino/org/mozilla/javascript/tools/shell/SharedGlobal.java 1999-08-14 02:01:00 +00:00
norris%netscape.com
6b84d958f4 Fix more importerTopLevel problems. 1999-08-13 20:44:46 +00:00
norris%netscape.com
4751b9866b Fix problem:
The fix sort of works. But there are some new problems. I enclosed two JavaScript files, button.js and image.js.

If I load button.js first and then image.js, I got the following:

js> load("button.js");
js> load("image.js");
Ambiguous import: [JavaClass javax.swing.ImageIcon] and [JavaClass javax.swing.ImageIcon]
js> load("image.js");
Ambiguous import: [JavaClass java.net.URL] and [JavaClass java.net.URL]
js> load("image.js");
Ambiguous import: [JavaClass java.lang.System] and [JavaClass java.lang.System]
js> load("image.js");
loadImage for 0
Ambiguous import: [JavaClass java.awt.Toolkit] and [JavaClass java.awt.Toolkit]
js> load("image.js");
loadImage for 0
js>

If I load imag.js first and then button.js, I got the following:

js> load("image.js");
loadImage for 0
js: [JavaPackage java.lang.URL] is not a function.
[JavaPackage java.lang.URL] is not a function.
js> load("image.js");
js: [JavaPackage java.lang.ImageIcon] is not a function.
[JavaPackage java.lang.ImageIcon] is not a function.
js> load("image.js");
js: [JavaPackage java.lang.ImageIcon] is not a function.
[JavaPackage java.lang.ImageIcon] is not a function.
js> load("image.js");
js: [JavaPackage java.lang.ImageIcon] is not a function.
[JavaPackage java.lang.ImageIcon] is not a function.
js> load("button.js");
js: [JavaPackage java.lang.JButton] is not a function.
[JavaPackage java.lang.JButton] is not a function.
js> load("button.js");
js: [JavaPackage java.lang.JButton] is not a function.
[JavaPackage java.lang.JButton] is not a function.
js> load("image.js");
js: [JavaPackage java.lang.ImageIcon] is not a function.
[JavaPackage java.lang.ImageIcon] is not a function.
js>

It looks like something wrong in the image.js file but this should not interfere with button.js. It looks like some arbitary package objects are created, like java.lang.URL. This happened in NativeJavaPackage.get method. If a class of java.lang.URL is not found, a package object is then created. So next time the interpreter encounters URL, it somehow uses the object java.lang.URL instead of the correct class object java.net.URL.. This is one problem. The interference between button.js and jmage.js is another problem.

Howard
  ----- Original Message -----
  From: Norris Boyd
  To: \ Howard\\ Xuhua Lin
  Sent: Thursday, August 12, 1999 12:58 PM
  Subject: Re: ImporterTopLevel problem


  Sorry I've been slow. I finished up the fix this morning and have posted it on the ftp site and checked into cvs.
  Let me know if it works for you.

  --Norris

  \"Howard\" Xuhua Lin wrote:

    Hi, Norris, what's the status of the ImporterTopeLevel problem (i.e if you use importPackage twice, you will get an "Ambiguous import" exception)? Are you still working on it? Howard
1999-08-13 17:25:14 +00:00
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
rogerl%netscape.com
8135508ba4 Converting value type for setter method to match declared type. 1999-08-11 18:33:48 +00:00
rogerl%netscape.com
d9458a9429 Factored out convertArg so that it can be called from ScriptableObject
for setter methods.
1999-08-11 18:31:34 +00:00
rogerl%netscape.com
9d49971dfa Undo captures from failed OPT child 1999-08-11 04:34:52 +00:00
rogerl%netscape.com
f5682225f9 Tentative fix for allowing call to 'exec' on RegExp objects. 1999-08-11 04:34:05 +00:00