Граф коммитов

340 Коммитов

Автор SHA1 Сообщение Дата
norris%netscape.com 528ca6cbca Adding patch (with slight modifications for javadoc) from Andrew Wason <aw@softcom.com>:
Subject:
        Rhino reflection patch
   Date:
        Wed, 28 Jul 1999 18:14:52 -0400
   From:
        Andrew Wason <aw@softcom.com>
     To:
        norris@netscape.com
    CC:
        mccabe@netscape.com, rogerl@netscape.com, Howard Lin <howard@softcom.com>




When JavaAdapter generates an adapter class, it does not take into account
the types of method parameters when wrapping the generated methods arguments.

This means that if a non-public class implements a public interface the
non-public class type will be wrapped instead of the declared public
interface - and methods cannot be invoked via the wrapper.

I have attached sample code (reflect-demo.zip) which shows this.  The
JavaScript caller.js generates an adapter implementing the CallerInterface
interface.  CallerInterface has a method (doSomething) which takes an
argument of type pkg.Interface.  pkg.Target is a non-public class that
implements pkg.Interface.  If an instance of pkg.Target is passed to the
CallerInterface adapter doSomething method, an Error is thrown because
pkg.Target.doSomething is called (instead of pkg.Interface.doSomething) and
pkg.Target is not public.

I have attached a patch to Context.java, ScriptRuntime.java and
JavaAdapter.java.  I overloaded toObject in Context and ScriptRuntime to
take a 3rd argument which is the declared type of the object being
wrapped.  This is passed to NativeJavaObject.wrap so that it generates the
correct wrapper. I changed JavaAdapter.generateOverride to generate
bytecode calling Context.toObject passing the declared Class type of the
argument.

Context.java also includes my previously submitted patch for dealing with
SecurityExceptions and the JavaAdapter property (because this patch has not
been checked into CVS yet).

Andrew

--
Andrew Wason
SoftCom, Inc.
aw@softcom.com



   reflect-patch.txt

                Name:
                      reflect-patch.txt
                 Type:
                      Plain Text (text/plain)




   reflect-demo.zip

                   Name:
                         reflect-demo.zip
                    Type:
                         Zip Compressed Data (application/x-zip-compressed)
                Encoding:
                         base64
1999-08-03 21:24:39 +00:00
norris%netscape.com 88aa514a1b Remove unused clone() method. 1999-08-03 20:40:25 +00:00
mccabe%netscape.com 786d00b0e0 Further fix to properly include classes from the org.mozilla.classfile package in the generated .jar file.
Thanks to Andrew Wason <aw@softcom.com> for his continued work on the Rhino make system.
1999-08-03 00:25:30 +00:00
mccabe%netscape.com 7967e283d1 Add the classes defined in org/mozilla/classfile to js.jar. 1999-08-02 09:01:19 +00:00
mccabe%netscape.com 1057414fef Fix code to invoke Wrapper interfaces using INVOKEINTERFACE rather than INVOKEVIRTUAL.
Thanks go to Andrew Wason <aw@softcom.com> for finding this problem and providing the patch:



If we implement a Java interface in JavaScript, and a method in that interface returns a Java object, we get a java.lang.IncompatibleClassChangeError: org/mozilla/javascript/Wrapper  exception.

We have attached a sample JavaScript file which duplicates the error.

The problem is JavaAdapter is generating an INVOKEVIRTUAL bytecode to call Wrapper.unwrap, but Wrapper is an interface and so INVOKEINTERFACE should be used instead.  As a result of this change, the IFEQ bytecode generated needs to jump more bytes.  We have attached a patch that fixes the problem.

Andrew
--
Andrew Wason
SoftCom, Inc.
aw@softcom.com
1999-07-26 10:45:38 +00:00
mccabe%netscape.com db16cf6ac4 Added NPL. 1999-07-26 10:41:46 +00:00
mccabe%netscape.com 9306d81fba Comment fixes.
- normalized initial MPL comment to match the format of others in the tree, including an initial -*- Mode line.

- removed RCS $log$, etc. comments.  We use CVS, and they just make spurious changes...
1999-07-26 10:40:53 +00:00
norris%netscape.com 6563fb2291 Add new example. 1999-07-16 03:03:20 +00:00
norris%netscape.com e07db97ba0 Report errors for incorrect usages of varargs forms. 1999-07-08 16:32:51 +00:00
norris%netscape.com 5212cf9694 Fix javadoc bug. 1999-07-08 00:37:12 +00:00
norris%netscape.com 4369cccbf6 Fix bug in ScriptableObject that make classes with jsGet_ but not jsFunction_ work improperly.
Also update Foo example to conform to new defineClass API.
1999-07-06 17:13:33 +00:00
beard%netscape.com 48ce127df1 added ImporterTopLevel.java 1999-06-19 23:38:35 +00:00
norris%netscape.com 716b905e30 Add support for selectively filtering Java classes' visibility to JS 1999-06-18 21:35:35 +00:00
norris%netscape.com 562b4ecb1b Reduce need for a current context. 1999-06-18 21:32:18 +00:00
norris%netscape.com 75d18cd332 A bunch of changes, some experimental.
Support for jsGet_ and jsSet_ prefixes to methods for explicit getter
and setter definition.
Addition of "importClass" and "importPackage" top-level functions.
The beginnings of a history object accessible from the shell.
1999-06-18 17:37:20 +00:00
frankm%eng.sun.com 33b9d6533a Add "fast" make target, to compile only changed files. 1999-06-14 21:51:52 +00:00
frankm%eng.sun.com 7c763a58f9 Revamp NativeJavaObject.coerceType and associated methods to make code
more maintainable, and to pass lc3/JSObject/ToChar-001.js.
1999-06-12 01:41:20 +00:00
frankm%eng.sun.com a66a71b8d7 Fixes for LC3 regression tests, including:
- check static members of instances in JavaMembers.put

- do not unwrap Wrappers before calling NativeJavaMethod.findFunction
     or NativeJavaObject.coerceType; both methods may need extra information
     provided by the wrapper.

- separate Java signatures for resolving overloaded methods and script
     signatures for error messages, so we can distinguish primitive types
     from classes.

- separate Java signatures for resolving overloaded methods and script
     signatures for error messages, so we can distinguish primitive types
     from classes.

- prevent a NativeJavaClass from being treated as a wrapped instance of
     java.lang.Class

- correct bug which preferred the *less* specific of two classes in
     NativeJavaMethod.preferSignature

- add new LC3 conversion rules to  NativeJavaObject.coerceTypes.

- coerce JS numbers to Java numbers or chars only if the JS number is in
     range.
1999-06-11 01:24:40 +00:00
rogerl%netscape.com 4bf675b98a Added base to ScriptRuntime.numberToString, NativeNumber.toString()
Bug #7625
1999-06-10 01:54:28 +00:00
norris%netscape.com c3423e873f Small reduction in code size. 1999-06-08 20:57:19 +00:00
rogerl%netscape.com 4b314af77e Fixed bug #7703, typeof<var> wasn't referencing activation frame vars
correctly.
1999-06-07 22:29:41 +00:00
norris%netscape.com efa5849c1f Clean up formatting. 1999-06-07 18:14:15 +00:00
norris%netscape.com b901db9067 Optimization: avoid allocating a Vector object for every LiveConnect call. 1999-06-07 18:13:15 +00:00
beard%netscape.com 3b5126c019 added NativeJavaConstructor.java 1999-06-05 08:20:54 +00:00
frankm%eng.sun.com 19e7423849 Replace *.class with ScriptRuntime.*Class; added ScriptRuntime.ClassClass 1999-06-05 01:48:24 +00:00
mccabe%netscape.com d3889060d3 Backing out demo cvs checkin. 1999-06-04 22:27:50 +00:00
beard%netscape.com 849c2a7d1d added top-level "environment" associative array - which provides JavaScript access to Java System properties. 1999-06-04 18:06:25 +00:00
beard%netscape.com 64159943da First Checked In. 1999-06-04 18:03:06 +00:00
beard%netscape.com 2e3345c4e6 File Removed. 1999-06-04 17:43:35 +00:00
beard%netscape.com 5a9cfbbb74 added Environment.java 1999-06-04 17:43:17 +00:00
norris%netscape.com dbbafc6b60 Subject:
Re: netscape.javascript.JSObject ?
        Date:
             Thu, 03 Jun 1999 17:52:42 -0700
       From:
             Frank Mitchell <frankm@eng.Sun.COM>
 Organization:
             Java Products Engineering
         To:
             Norris Boyd <norris@netscape.com>
  References:
             1 , 2 , 3 , 4 , 5 , 6 , 7 , 8




Norris Boyd wrote:
>
> Sorry--missed the checkin of a new file. It's there now.
>
> I'd also added a small change for the "inheritance" of JavaScript array methods.

Actually, I've already done that (and for String as well).  It still
fails some LC3 regression tests, though.

I'm including a tarfile that includes the previous changes and the new
ones.

Frank
1999-06-04 16:25:41 +00:00
norris%netscape.com 5513cb38fd Add NativeJavaConstructor.java 1999-06-04 16:06:14 +00:00
mang%subcarrier.org 5b942c68c3 Added doc comment 1999-06-03 23:39:57 +00:00
norris%netscape.com 03c23c444d LC3 support: make Java arrays have Array.prototype as a prototype. 1999-06-03 23:38:47 +00:00
norris%netscape.com 8a047c315c Subject:
Re: Rhino LiveConnect: need help?
        Date:
             Wed, 02 Jun 1999 19:33:37 -0700
       From:
             Frank Mitchell <frankm@eng.Sun.COM>
 Organization:
             Java Products Engineering
         To:
             Scott Furman <fur@netscape.com>, Norris Boyd <norris@netscape.com>
         CC:
             mallen@eng.Sun.COM
  References:
             1 , 2 , 3 , 4




Scott Furman wrote:
> In order to bring Rhino LiveConnect support up to the level of the
> C-engine, the features of LiveConnect version 2 and version 3 would
> need to be added.  You can see some details of LC2 and LC3 features
> here.  I would guess that 80% of the time would be spent implementing
> one feature: LC3's new method overload resolution scheme.


OK, I think I have something that implements the new overloaded method
resolution scheme ... I'm still working on getting the regression tests
running smoothly, but from command-line testing it seems to work.  It's
not the *cleanest* code I've ever done, though: in particular, it has
too many static methods and type-checking code for my tastes.  (Hey,
should we spin the type coercion and comparison stuff to some other
module entirely?  Right now it's mostly in JavaNativeObject, with the
preference stuff in JavaNativeMethod.)  I'm also not sure why some of
this stuff is public, and whether there might be backward-compatibility
problems with what I've done, particularly in repurposing the
COMPARISON_* constants.

Would you guys be kind enough to review this for me?  I'm hoping to
check it in once I get an ID, but it wouldn't hurt to have another pair
of eyes or three (pairs, I mean).  I've attached a tar/gzip of the
source files I've changed (or added), plus a diff.

Thanks,
Frank
1999-06-03 23:38:00 +00:00
norris%netscape.com 7b7ebb5614 Subject:
Re: Rhino LiveConnect: need help?
        Date:
             Wed, 02 Jun 1999 19:33:37 -0700
       From:
             Frank Mitchell <frankm@eng.Sun.COM>
 Organization:
             Java Products Engineering
         To:
             Scott Furman <fur@netscape.com>, Norris Boyd <norris@netscape.com>
         CC:
             mallen@eng.Sun.COM
  References:
             1 , 2 , 3 , 4




Scott Furman wrote:
> In order to bring Rhino LiveConnect support up to the level of the
> C-engine, the features of LiveConnect version 2 and version 3 would
> need to be added.  You can see some details of LC2 and LC3 features
> here.  I would guess that 80% of the time would be spent implementing
> one feature: LC3's new method overload resolution scheme.


OK, I think I have something that implements the new overloaded method
resolution scheme ... I'm still working on getting the regression tests
running smoothly, but from command-line testing it seems to work.  It's
not the *cleanest* code I've ever done, though: in particular, it has
too many static methods and type-checking code for my tastes.  (Hey,
should we spin the type coercion and comparison stuff to some other
module entirely?  Right now it's mostly in JavaNativeObject, with the
preference stuff in JavaNativeMethod.)  I'm also not sure why some of
this stuff is public, and whether there might be backward-compatibility
problems with what I've done, particularly in repurposing the
COMPARISON_* constants.

Would you guys be kind enough to review this for me?  I'm hoping to
check it in once I get an ID, but it wouldn't hurt to have another pair
of eyes or three (pairs, I mean).  I've attached a tar/gzip of the
source files I've changed (or added), plus a diff.

Thanks,
Frank
1999-06-03 23:22:27 +00:00
rogerl%netscape.com b4b5620952 Changed behaviour of Script.exec so that it gains access to the current
scope when invoked, rather than grabbing the topmost. Prevented exec from
being called indirectly.
1999-06-03 00:08:00 +00:00
rogerl%netscape.com 0a95e5eb15 blowing off commented out junk 1999-06-02 18:07:40 +00:00
norris%netscape.com b060e6bd7e Fix NullPointerException for "abc".match("a\"); 1999-06-02 16:12:19 +00:00
rogerl%netscape.com ff12a978d6 Bug #6359 and other changes motivated by Waldemar's specification. 1999-05-26 22:28:32 +00:00
norris%netscape.com 4134731727 Fix bug 6705. 1999-05-26 19:55:51 +00:00
norris%netscape.com 29da9ddbfd Remove class path for merging into a single JAR file. 1999-05-26 19:52:40 +00:00
norris%netscape.com c3ec40debb fix node property printing 1999-05-26 19:48:45 +00:00
norris%netscape.com 3dc47a5559 clean up formatting 1999-05-26 19:48:02 +00:00
beard%netscape.com 36f20de5c9 First Checked In. 1999-05-24 20:48:58 +00:00
beard%netscape.com c1a6075103 added mozilla/js/rhino/org/mozilla/javascript/ListenerCollection.java 1999-05-23 20:07:05 +00:00
norris%netscape.com 4842b30458 Manifest for jstools.jar to enable use of 1.2 -jar option. 1999-05-21 06:13:37 +00:00
norris%netscape.com ed84c8db7f Add methods for getting and setting key-value pairs. 1999-05-20 23:54:53 +00:00
norris%netscape.com b652b55b72 Remove Java 2 dependency. 1999-05-19 23:58:37 +00:00
norris%netscape.com 625fe68e12 Fix bug 6313 'Rhino: "new Function" doesn't work properly with superglobal'
Also clean up Context.exit() to be more consistent with Context.enter(),
and make SecuritySupport work with JavaAdapter.
1999-05-18 23:10:20 +00:00
norris%netscape.com 0f406008cb Fix formatting. 1999-05-18 22:55:11 +00:00
norris%netscape.com f3a98b7eaf Clearer formatting. 1999-05-18 22:54:15 +00:00
norris%netscape.com e2e412bdb1 Add submission:
Subject:
            Re: Modified Context.java
       Date:
            Sat, 15 May 1999 08:01:37 +0000
      From:
            "Ian D. Stewart" <idstewart@softhome.net>
        To:
            Norris Boyd <norris@netscape.com>
 References:
            1 , 2 , 3 , 4 , 5




Ian D. Stewart wrote:

  Norris Boyd wrote:




    Can I help with EventListener collector?

  Actually, I have a working implementation complete (attatched), but by all means, feel free to add any functionality you feel
  may be missing, or to tweak the code .

Norris,

After I sent I my last e-mail, I noticed some potential issues using Object[] in ListenerCollection.getListeners(Class iface).
I'm attatching a new version, which uses a Vector object.  This should resolve those issues.


Ian
1999-05-18 22:32:25 +00:00
norris%netscape.com a62a14d61d Subject:
Rhino SecurityException patch
   Date:
        Tue, 11 May 1999 12:25:50 -0400
   From:
        Andrew Wason <aw@softcom.com>
     To:
        Norris Boyd <norris@netscape.com>




Sorry if you aren't the right person to submit Rhino patches to.

I couldn't get Rhino to run under JDK1.2 with a SecurityManager installed
(e.g. java -Djava.security.manager=java.lang.SecurityManager).  I
understand the JavaAdapter stuff won't work - but I would still like to use
Rhino without that piece.

I've attached a small patch which catches and ignores the
SecurityExceptions so that Rhino can run with a SecurityManager but without
JavaAdapter.


Andrew
--
Andrew Wason
SoftCom, Inc.
aw@softcom.com
1999-05-11 16:46:30 +00:00
norris%netscape.com 576e9d20b6 A statement like "var java;" was hiding the java package defined in the
shared global since we weren't looking up the prototype chain.
1999-05-10 18:09:49 +00:00
mccabe%netscape.com 1f36369274 Added references to the JavaAdapter and classfile classes. 1999-05-06 23:49:10 +00:00
norris%netscape.com 6fe783c4e7 Marginal performance tweak. 1999-05-06 23:17:12 +00:00
mccabe%netscape.com ed1922475f Initial checkin of distribution makefile system for our brandfangled free source Rhino. 1999-05-06 07:51:15 +00:00
norris%netscape.com e9a081a149 Update release string. 1999-05-05 23:29:06 +00:00
norris%netscape.com 36803eaab9 Handle the case where f is null in "new f". 1999-05-04 17:23:13 +00:00
norris%netscape.com 7ea4f505a3 Fix spelling, don't claim uniqueness. 1999-05-03 17:56:07 +00:00
norris%netscape.com c7d28e0cbb Make it purdy. 1999-05-03 17:55:21 +00:00
norris%netscape.com 9628273770 Add README with support for LXR. 1999-05-03 17:53:10 +00:00
norris%netscape.com 8d5569f75e Add new example. 1999-04-30 19:49:34 +00:00
norris%netscape.com 3bb6bca352 Better (?) error when initializing and the security resource isn't found. 1999-04-30 16:56:43 +00:00
norris%netscape.com 8675462ffa Fall through to number case only after considering character and boolean
independently.
1999-04-29 20:51:50 +00:00
norris%netscape.com 3a2b3ad97e Fix bug where conversions of numbers to booleans in calls to Java methods were producing
IllegalArgumentExceptions.
1999-04-29 17:53:05 +00:00
norris%netscape.com 1451f178ae Help message should indicate that -1 is an acceptible optimizer value. 1999-04-29 17:22:20 +00:00
rogerl%netscape.com c63b4ac205 Clean-up some bytecode leftovers.
Added assertions, non-greedy opt.
1999-04-28 23:08:14 +00:00
rogerl%netscape.com 393a0501c6 Added method to construct a new RegExp. 1999-04-28 23:07:14 +00:00
rogerl%netscape.com 4d75c0d939 Added interface method to construct a new RegExp. 1999-04-28 23:06:26 +00:00
rogerl%netscape.com 6c0c4f5eb3 Using regExpProxy to construct regexp literals 1999-04-28 23:05:43 +00:00
beard%netscape.com dcc6603adf added JavaAdapter.java 1999-04-27 19:56:20 +00:00
beard%netscape.com d42c8cf151 Using the property "org.mozilla.javascript.JavaAdapter" to allow the JavaAdapter class to come from another package. 1999-04-27 19:55:53 +00:00
beard%netscape.com f7b81ab327 added classes in org.mozilla.classfile 1999-04-27 19:43:56 +00:00
norris%netscape.com 3fa40b6946 Better javadoc. 1999-04-27 16:55:44 +00:00
norris%netscape.com 84805d797c Clean up, add javadoc. 1999-04-27 03:56:23 +00:00
norris%netscape.com e07d8c6b14 Make JavaAdapter work on mozilla-only. 1999-04-26 20:41:57 +00:00
beard%netscape.com e413292484 made the class to use for the JavaAdapter selectable via the Java property "org.mozilla.javascript.JavaAdapter" 1999-04-24 06:28:17 +00:00
norris%netscape.com 5d1454fa9c If the security resource isn't present, catch the exception and proceed. 1999-04-23 19:54:28 +00:00
norris%netscape.com 27a29f62ef Clean up javadoc. 1999-04-23 17:31:59 +00:00
norris%netscape.com 9920efbe72 Clean up javadocs; make Context creation faster. 1999-04-23 17:31:09 +00:00
norris%netscape.com d59df52693 Clean up formatting. 1999-04-23 17:30:31 +00:00
norris%netscape.com a58f576420 Transfer examples to mozilla. 1999-04-22 20:58:54 +00:00
norris%netscape.com ecee0852e5 Add examples to mozilla. 1999-04-22 20:41:57 +00:00
norris%netscape.com 3328f2c45d Fix the following bug:
Subject:
        Context.newArray() bug
   Date:
        Thu, 22 Apr 1999 00:26:29 -0700
   From:
        beard@netscape.com (Patrick Beard)
     To:
        Norris Boyd <norris@netscape.com>

When the arguments array gets created, its prototype isn't set up
correctly. I think the problem is in Context.newArrayHelper(), which isn't
able to look up the "Array" constructor in the passed-in scope. For this
reaon, top-level scripts that use "arguments.length" don't work.

- Patrick
1999-04-22 18:29:07 +00:00
beard%netscape.com 42b71f5b65 First Checked In. 1999-04-22 02:50:18 +00:00
norris%netscape.com d9f9f0526f Load optimizer package from com.netscape. 1999-04-21 04:40:36 +00:00
norris%netscape.com aafb17e3e7 Forgot to add Messages.properties. 1999-04-20 20:21:55 +00:00
norris%netscape.com 8f2cc55a9b Publish Rhino as open source. 1999-04-19 20:43:53 +00:00