On 2009.11.30., at 18:21, Charles Oliver Nutter wrote: > Yes, blasted stack traces...they are a pain to cope with for sure. > JRuby and Jython are probably the only two widely-used JVM languages > that present *nice* stack traces
Rhino, in interpreted mode, will inject script stack elements into the Java stack elements, so above every org.mozilla.javascript.Interpreter.interpret() element, you'll have all the JS frames the interpreter created, with an appropriate syntax (function name + source code name + line number; obviously the class name doesn't apply...). Here's a stack trace from an edit/run debug cycle iteration from my actual work from last week; with client names stripped out. You can see we actually have two interpreter invocations - Array.forEach() is implementing in Java and is thus traversing Java code, and the JS stack frames are correctly injected in their places. The script elements are "at script...": org.mozilla.javascript.EcmaError: TypeError: Cannot find function getAlertId in object [object Object]. (http://localhost:8080/applications/*************/3.0/main.js#19) at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3753) at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3731) at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3759) at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3778) at org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3842) at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2343) at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2310) at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1515) at script(http://localhost:8080/applications/*************/3.0/main.js:19) at script(jar:http://localhost:8080/platform/7.2.0/tools/tools.jar!/com/*******7/workflow/alert/callbacks.js:81) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:845) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164) at org.mozilla.javascript.NativeArray.iterativeMethod(NativeArray.java:1559) at org.mozilla.javascript.NativeArray.execIdCall(NativeArray.java:340) at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:129) at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1702) at script(jar:http://localhost:8080/platform/7.2.0/tools/tools.jar!/com/*******7/workflow/alert/callbacks.js:80) at script(jar:http://localhost:8080/platform/7.2.0/tools/tools.jar!/com/*******7/workflow/alert/alert.js:84) at script(http://localhost:8080/applications/*************/3.0/main.js:27) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:845) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164) at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:426) at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3157) at org.mozilla.javascript.Context.callFunctionWithContinuations(Context.java:1204) at org.mozilla.javascript.Context.executeScriptWithContinuations(Context.java:1171) ... Attila. -- You received this message because you are subscribed to the Google Groups "JVM Languages" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/jvm-languages?hl=en.
