New class MemberBox wraps Method or Constructor instances to cache results of getParameterType() and other information and to to replace Method instance by more accessible one recovery from IllegalAccessException is possible.
2. Catch VirtualMachineError so on out-of-memory/stack-overflow the shell will exit with System.exit(EXITCODE_RUNTIME_ERROR), not with 1. It will allow to distinguish cases when script tried to consume all available stack/memory with bugs in Rhino itself leading to NullPointerException etc.
3. Remove code to rethrow ThreadDeath from JavaScriptExcception since ThreadDeath is re-thrown by the engine itself.
To avoid constant calling of Method/Constructor.getParameterType() which creates a new Class array on each call, NativeJavaMethod stores the parameter types for its methods in methodTypes array and similarly JavaMembers holds all constructor types in ctorTypes array. The cached Class arrays are passed explicitly to methods that previously called getParameterType().
1. All its methods package private methods that are not accesible outside the class itself are made private.
2. Various package-private getters are removed in favor of direct field access.
2. Removal of NativeJavaMethod.getMethod that simply returned package-private field NativeJavaMethod.methods since the filed itself was accessed directly by other files.
In NativeCall constructor adds argument object only if there is no parameters with this name and similarly do not set arguments to undefined if the function has "var arguments".
2. Split NativeCall into NativeCall and NativeCallPrototype to allow for smaller activation objects with faster property access.
Changing behavior of sealed objects to throw an exception on any attempt to modify them including changing values of existing properties. In the same time making object sealed does not affect read-only status of its properties which allows to override properties of objects with a sealed object as a prototype.
Rhino shell now accepts -sealedlib option to seal all standard objects.
In setBySetter when start != this setters with delegators and setters without one if start is not an instance of this class are not invoked on start. Instead the standard JS rules applies so x.a = 1 would not change a in x.__proto__ if a in x.__proto__ is controlled by setter.
New helper class JIFunction for easy implementation of JS functions in Java without using reflection and its usage in ImporterTopLevel and NativeJavaPackage
While you are messing arround with JavaScriptException, is it possible to add
if(value instanceof Throwable) {
initCause((Throwable) value);
}
I know it's a Java 1.4 feature and not directly connected to this bug and don't
know what's the Rhino's policy of supported Java versions, but it in the end it
could be done with method.invoke() or something similar.
This would help debugging a lot.
Using (x instanceof Wrapper) instead of (x instanceof NativeJavaObject) which replaces the previous fix of unwrapping NativeJavaObject.call arguments for the custom wrappers problem.