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

Strict eval throws ClassCastException with large scripts

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • P3
    • Resolution: Fixed
    • None
    • 9
    • core-libs
    • None
    • b70
    • generic
    • 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

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

                Dates

                  Created:
                  Updated:
                  Resolved: