Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8019398 nashorn-dev spec corner, review bugs
  3. JDK-8020356

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

    XMLWordPrintable

Details

    • Sub-task
    • Status: Closed
    • P3
    • Resolution: Fixed
    • 8
    • 8
    • core-libs
    • None
    • b102
    • generic
    • generic
    • Verified

    Description

      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)

      Attachments

        Activity

          People

            hannesw Hannes Wallnoefer
            sundar Sundararajan Athijegannathan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: