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

Strict eval throws ClassCastException with large scripts

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • None
    • core-libs
    • None
    • b70
    • generic
    • generic

        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

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

                Created:
                Updated:
                Resolved: