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
>
and propertyIsEnumerable) for JS1.5.
- Optimize obj_propertyIsEnumerable to avoid extra lookup code bloat, requiring
fix to js_GetAttributes (unset out param on successful early retunr) that it
exposed.
- Use more righteous else-if style in shaver's jsarray.c change.
- Add JS1.5 getter/setter support in all its glory:
* getter function SN() {return ++x} at top-level or as a closure binds an SN
property getter than returns the incremented value of x. Likewise for
setter function SN(y) {return y = x}.
* getters and setters may be defined in an object literal:
o = {p getter:function() {return ++this.x},
p setter:function(y){return this.x = y},
x:42};
* getter= and setter= operators (compound tokens) may be used to bind getter
and setter properties dynamically:
o = new Object;
o.p getter= function() {return ++this.x};
o.p setter= function(y){return this.x = y};
o.x = 42;
Waldemar is concerned that this form will collide semantically with JS2, so
I am not committing to keeping it in JS1.5. I'd like to check my code in
ASAP so shaver can use it, and I'd also like to see this form get used (or
not) during Mozilla betas. Caveat emptor, and if you find this "dynamic"
or "imperative" form necessary and hard to substitute, please let me know.
If this proves important to users, then I think JS1.5 should keep it.
- Cleaned up property flags (in a binary-incompatible fashion -- who cares?) by
eliminating JSPROP_ASSIGNHACK and JSPROP_TINYIDHACK.
- Added JS_DONT_PRETTY_PRINT flag to be ORed with the indent argument to the
several JS_Decompile*() API calls. This avoids any newlines or identation in
the decompiled string.
- Improved and extended (for getter/setter non-reservation) scanner lookahead
by using a circular (power-of-2 sized) token buffer.
- Fix ECMA Edition 3 deviation where function f(){function g(){}} bound f.g by
mistake (it should arrange to make a closure named g in activations of f, but
it should not bind a property of function f).
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.