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

Strict eval throws ClassCastException with large scripts

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b70
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        Strict eval creates a new scope to avoid spilling declarations in the containing scope. It uses global.newObject() to create the scope object, which returns a generic JavaScript object.

        However, Nashorn splitter expects scopes to implement the Scope interface. Loading a very large script that require splitting therefore leads to a ClassCastException:

        jjs> "use strict"; var s = readFully("../octane/mandreel.js"); eval(s);
        java.lang.ClassCastException: jdk.nashorn.internal.scripts.JD cannot be cast to jdk.nashorn.internal.runtime.Scope

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                hannesw Hannes Wallnoefer
                Reporter:
                hannesw Hannes Wallnoefer
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: