Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8029173

Debugger support doesn't handle ConsString

XMLWordPrintable

    • b120
    • generic
    • generic
    • Not verified

        When a variable is a ConsString, the Debugging support is broken by a class cast exception (stack pasted at the end of report).

        This makes Avatar.js scripts not debuggable.
         
        For ex, setting a breakpoint in doit gets you the exception.
        var arr = ["ooo", "iii"]
        // concat is a ConsString
        var concat = arr[0] + arr[1];
        doit(concat)
        function doit(concat) {
            print(concat);
        }



        java.lang.ClassCastException: jdk.nashorn.internal.runtime.ConsString cannot be cast to java.lang.String
        at jdk.nashorn.internal.runtime.DebuggerSupport.valueAsString(DebuggerSupport.java:246)
        at jdk.nashorn.internal.runtime.DebuggerSupport.valueInfo(DebuggerSupport.java:137)
        at jdk.nashorn.internal.runtime.DebuggerSupport.getDebuggerValueDescs(DebuggerSupport.java:159)
        at jdk.nashorn.internal.runtime.DebuggerSupport.objectAsString(DebuggerSupport.java:212)
        at jdk.nashorn.internal.runtime.DebuggerSupport.valueInfo(DebuggerSupport.java:135)
        at jdk.nashorn.internal.runtime.DebuggerSupport.getDebuggerValueDescs(DebuggerSupport.java:159)
        at jdk.nashorn.internal.runtime.DebuggerSupport.valueInfos(DebuggerSupport.java:110)
        at jdk.nashorn.internal.scripts.Script$toto.runScript(file:/Users/jfdenise/workspaces/v10.latest/avatar-js/toto.js:1)
        at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:498)
        at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:207)
        at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:378)
        at jdk.nashorn.internal.runtime.Context.evaluateSource(Context.java:872)
        at jdk.nashorn.internal.runtime.Context.load(Context.java:563)
        at jdk.nashorn.internal.objects.Global.load(Global.java:851)
        at jdk.nashorn.internal.scripts.Script$evals_wrap._L26$_L49(jar:file:/Users/jfdenise/workspaces/v10.latest/avatar-js/dist/avatar-js.jar!/net/java/avatar/js/evals_wrap.js:51)
        at jdk.nashorn.internal.scripts.Script$module._L1$_L390(jar:file:/Users/jfdenise/workspaces/v10.latest/avatar-js/dist/avatar-js.jar!/lib/module.js:461)
        at jdk.nashorn.internal.scripts.Script$module._L1$_L494(jar:file:/Users/jfdenise/workspaces/v10.latest/avatar-js/dist/avatar-js.jar!/lib/module.js:495)
        at jdk.nashorn.internal.scripts.Script$module._L1$_L362(jar:file:/Users/jfdenise/workspaces/v10.latest/avatar-js/dist/avatar-js.jar!/lib/module.js:372)
        at jdk.nashorn.internal.scripts.Script$module._L1$_L278$_L320(jar:file:/Users/jfdenise/workspaces/v10.latest/avatar-js/dist/avatar-js.jar!/lib/module.js:321)
        at jdk.nashorn.javaadapters.java.security.PrivilegedAction.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.lang.invoke.MethodHandleImpl$BindCaller$T/577245010.invoke_V(MethodHandleImpl.java:960)
        at jdk.nashorn.internal.scripts.Script$module._L1$_L278(jar:file:/Users/jfdenise/workspaces/v10.latest/avatar-js/dist/avatar-js.jar!/lib/module.js:319)
        at jdk.nashorn.internal.scripts.Script$module._L1$_L516(jar:file:/Users/jfdenise/workspaces/v10.latest/avatar-js/dist/avatar-js.jar!/lib/module.js:518)
        at jdk.nashorn.internal.scripts.Script$init._L65(jar:file:/Users/jfdenise/workspaces/v10.latest/avatar-js/dist/avatar-js.jar!/net/java/avatar/js/init.js:246)
        at jdk.nashorn.internal.scripts.Script$init.runScript(jar:file:/Users/jfdenise/workspaces/v10.latest/avatar-js/dist/avatar-js.jar!/net/java/avatar/js/init.js:65)
        at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:498)
        at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:207)
        at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:378)
        at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:544)
        at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:526)
        at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:522)
        at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:188)
        at net.java.avatar.js.Server.eval(Server.java:274)
        at net.java.avatar.js.Server.access$900(Server.java:57)
        at net.java.avatar.js.Server$SystemScriptRunner.run(Server.java:429)
        at net.java.avatar.js.Server.runSystemScript(Server.java:169)
        at net.java.avatar.js.Server.runUserScripts(Server.java:214)
        at net.java.avatar.js.Server.run(Server.java:150)
        at ajslauncher.AJSLauncher.main(AJSLauncher.java:29)
        Caused: org.netbeans.api.debugger.jpda.InvalidExpressionException: Exception occurred in target VM: jdk.nashorn.internal.runtime.ConsString cannot be cast to java.lang.String
        at org.netbeans.modules.debugger.jpda.expr.TreeEvaluator.invokeVirtual(TreeEvaluator.java:328)
        at org.netbeans.modules.debugger.jpda.expr.TreeEvaluator.invokeVirtual(TreeEvaluator.java:274)
        at org.netbeans.modules.debugger.jpda.JPDADebuggerImpl.invokeMethod(JPDADebuggerImpl.java:1093)
        at org.netbeans.modules.debugger.jpda.JPDADebuggerImpl.invokeMethod(JPDADebuggerImpl.java:1028)
        at org.netbeans.modules.debugger.jpda.models.JPDAClassTypeImpl.invokeMethod(JPDAClassTypeImpl.java:309)
        at org.netbeans.modules.debugger.jpda.models.JPDAClassTypeImpl.invokeMethod(JPDAClassTypeImpl.java:254)
        [catch] at org.netbeans.modules.debugger.jpda.js.vars.DebuggerSupport.getValueInfos(DebuggerSupport.java:147)
        at org.netbeans.modules.debugger.jpda.js.vars.JSVariable.createScopeVars(JSVariable.java:74)
        at org.netbeans.modules.debugger.jpda.js.vars.models.VariablesJSTreeModel.createScopeVars(VariablesJSTreeModel.java:172)
        at org.netbeans.modules.debugger.jpda.js.vars.models.VariablesJSTreeModel.getChildren(VariablesJSTreeModel.java:113)
        at org.netbeans.spi.viewmodel.Models$CompoundTreeModel.getChildren(Models.java:953)
        at org.netbeans.modules.debugger.jpda.ui.models.VariablesTreeModelFilterSI.getChildren(VariablesTreeModelFilterSI.java:193)
        at org.netbeans.spi.viewmodel.Models$CompoundTreeModel.getChildren(Models.java:953)
        at org.netbeans.modules.debugger.jpda.ui.models.VariablesTreeModelFilter.getChildren(VariablesTreeModelFilter.java:302)
        at org.netbeans.spi.viewmodel.Models$CompoundTreeModel.getChildren(Models.java:953)
        at org.netbeans.modules.debugger.jpda.models.PendingActionsFilter.getChildren(PendingActionsFilter.java:97)
        at org.netbeans.spi.viewmodel.Models$CompoundTreeModel.getChildren(Models.java:953)
        at org.netbeans.spi.viewmodel.Models$CompoundModel.getChildren(Models.java:4404)
        at org.netbeans.modules.debugger.ui.views.ViewModelListener$5.getChildren(ViewModelListener.java:459)
        at org.netbeans.modules.viewmodel.TreeModelHyperNode$HyperModelChildren.getModelChildren(TreeModelHyperNode.java:241)
        at org.netbeans.modules.viewmodel.TreeModelNode$TreeModelChildren.run(TreeModelNode.java:1446)
        at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
        at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2042)

              jlaskey Jim Laskey
              jfdenise Jean-Francois Denise (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: