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

ReferenceError in 1.8.0_72

    XMLWordPrintable

Details

    • b124
    • generic
    • generic

    Backports

      Description

        FULL PRODUCT VERSION :
        java version "1.8.0_72"
        Java(TM) SE Runtime Environment (build 1.8.0_72-b15)
        Java HotSpot(TM) 64-Bit Server VM (build 25.72-b15, mixed mode)


        ADDITIONAL OS VERSION INFORMATION :
        Darwin crab.lan 15.3.0 Darwin Kernel Version 15.3.0: Thu Dec 10 18:40:58 PST 2015; root:xnu-3248.30.4~1/RELEASE_X86_64 x86_64

        A DESCRIPTION OF THE PROBLEM :
        We've observed a change in behaviour between 1.8.0_71 and 1.8.0_72, where we now see a ReferenceError.

        Reproduction code is available.

        REGRESSION. Last worked in version 8u71

        ADDITIONAL REGRESSION INFORMATION:
        See https://github.com/makuk66/eval-script-repro, which runs code first with _71 which works, and then with _72, which doesn't.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Clone https://github.com/makuk66/eval-script-repro
        Edit run.sh to point to set the JAVA_HOME to point at your copies
        Execute ./run.sh
        Observe the output is per the README, demonstrating success for _71 and then failure for _72.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        I expected _72 to behave in the same way as _71
        ACTUAL -
        _72 gets a ReferenceError

        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        Exception in thread "main" javax.script.ScriptException: ReferenceError: "logger" is not defined in <eval> at line number 1
            at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:467)
            at jdk.nashorn.api.scripting.NashornScriptEngine.invokeImpl(NashornScriptEngine.java:389)
            at jdk.nashorn.api.scripting.NashornScriptEngine.invokeMethod(NashornScriptEngine.java:199)
            at EvalScript.runTest(EvalScript.java:24)
            at EvalScript.main(EvalScript.java:12)
        Caused by: <eval>:1 ReferenceError: "logger" is not defined
            at jdk.nashorn.internal.runtime.ECMAErrors.error(ECMAErrors.java:57)
            at jdk.nashorn.internal.runtime.ECMAErrors.referenceError(ECMAErrors.java:319)
            at jdk.nashorn.internal.runtime.ECMAErrors.referenceError(ECMAErrors.java:291)
            at jdk.nashorn.internal.objects.Global.__noSuchProperty__(Global.java:1428)
            at jdk.nashorn.internal.scripts.Script$Recompilation$1$15A$\^eval\_.L:1(<eval>:1)
            at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:625)
            at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494)
            at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
            at jdk.nashorn.internal.objects.NativeFunction.call(NativeFunction.java:192)
            at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:616)
            at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:494)
            at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
            at jdk.nashorn.api.scripting.ScriptObjectMirror.callMember(ScriptObjectMirror.java:199)
            at jdk.nashorn.api.scripting.NashornScriptEngine.invokeImpl(NashornScriptEngine.java:383)


        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        See https://github.com/makuk66/eval-script-repro/blob/master/EvalScript.java
        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        I can change the sample code per https://github.com/makuk66/eval-script-repro/blob/master/EvalScript.java#L19 to make it work.

        Attachments

          Issue Links

            Activity

              People

                hannesw Hannes Wallnoefer
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: