ClassCastException Undefined->Scope on spiltter class generated for a large switch statement

XMLWordPrintable

    • Type: Sub-task
    • Resolution: Fixed
    • Priority: P3
    • 8
    • Affects Version/s: 8
    • Component/s: core-libs
    • None
    • b102
    • generic
    • generic
    • Verified

      jjs -doe

      jjs> function makeSwitch(from,to,v){var r="switch("+v+"){"; for (var i=from;i<to;++i)r+="case "+i+": return "+i+";break;"; return r+"}"}

      jjs> Function(makeSwitch(1,0x7ff,5))()
      java.lang.ClassCastException: jdk.nashorn.internal.runtime.Undefined cannot be cast to jdk.nashorn.internal.runtime.Scope
      at jdk.nashorn.internal.scripts.Script$\^function\_$2.$split(<function>:2)
      at jdk.nashorn.internal.scripts.Script$\^function\_._L1(<function>:1)
      at jdk.nashorn.internal.scripts.Script$\^shell\_.runScript(<shell>:1)
      at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:518)
      at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:202)
      at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:366)
      at jdk.nashorn.internal.runtime.Context.eval(Context.java:412)
      at jdk.nashorn.tools.Shell.readEvalPrint(Shell.java:444)
      at jdk.nashorn.tools.Shell.run(Shell.java:168)
      at jdk.nashorn.tools.Shell.main(Shell.java:143)
      at jdk.nashorn.tools.Shell.main(Shell.java:122)

            Assignee:
            Hannes Wallnoefer
            Reporter:
            Sundararajan Athijegannathan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: