I'm using rhino 1.7r2, with JDK 1.6_... 1.6.0_18! (from within eclipse, the
configuration panel says 1.6.0_17-b04. Huh)
Eclipse Build id: 20100218-1602
I run into several issues when trying to dump various things to the console
in my unit tests via:
Scriptable o = Context.toObject( System.out, scope );
scope.put( "out", scope, o );
Several classes don't play well with standard out exposed like this:
NativeArray. "var foo = []; out.println( foo );"
FATAL ERROR in native method: JDWP on getting class status,
jvmtiError=JVMTI_ERROR_WRONG_PHASE(112)
FATAL ERROR in native method: JDWP Can't allocate jvmti memory,
jvmtiError=JVMTI_ERROR_INVALID_ENVIRONMENT(116)
JDWP exit error JVMTI_ERROR_WRONG_PHASE(112): on getting class status
[../../../src/share/back/util.c:1265]
JDWP exit error JVMTI_ERROR_INVALID_ENVIRONMENT(116): Can't allocate jvmti
memory [../../../src/share/back/util.c:1779]
Note that the above spew didn't throw an exception. The program 'terminated
normally'.
NativeJavaArray, given *any* array, will attempt to use println( char[]) and
finds no applicable conversion:
com.cardiff.js.EcmaException: Cannot convert
com.cardiff.js.exposablejavaar...@4f47afda to char[]
at com.cardiff.js.ErrorHandler.runtimeError(ErrorHandler.java:76)
at org.mozilla.javascript.Context.reportRuntimeError(Context.java:938)
at org.mozilla.javascript.Context.reportRuntimeError(Context.java:994)
at org.mozilla.javascript.Context.reportRuntimeError2(Context.java:964)
at
org.mozilla.javascript.NativeJavaObject.reportConversionError(NativeJavaObject.java:896)
at
org.mozilla.javascript.NativeJavaObject.coerceTypeImpl(NativeJavaObject.java:664)
at org.mozilla.javascript.Context.jsToJava(Context.java:1716)
at
org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:213)
at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
at org.mozilla.javascript.gen.c63._c3(Unknown Source)
at org.mozilla.javascript.gen.c63.call(Unknown Source)
at
org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:108)
at org.mozilla.javascript.gen.c64._c0(Unknown Source)
at org.mozilla.javascript.gen.c64.call(Unknown Source)
at
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
at
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
at org.mozilla.javascript.gen.c64.call(Unknown Source)
at org.mozilla.javascript.gen.c64.exec(Unknown Source)
at com.cardiff.js.Interpreter.execute(Interpreter.java:438)
I didn't try jsFunction_toString(), but I don't think it would fair any
better... String != char[].
It would appear that the methods in PrintWriter are enumerated while looking
for a decent conversion, and char[] is listed before String in its 'methods'
array.
getJSTypeCode( somethingThatDescendsFromNative[Java]Array ) always returns
JSTYPE_ARRAY... which it seems most closely matches with the char[], because
they're both arrays.
Not so much, as it turns out.
--
--Mark Storer
Senior Software Engineer
Cardiff.com
import legalese.disclaimer.*
Disclaimer<Cardiff> disCard = null;
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino