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

Global constants get in the way of self-modifying properties

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8u20
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Introduced In Build:
      b04
    • Introduced In Version:
    • Resolved In Build:
      b31
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        The avatar.js test test-repl.js throws this exception with 8u40 - "java.lang.ClassCastException: jdk.nashorn.internal.scripts.JO4 cannot be cast to jdk.nashorn.internal.runtime.UserAccessorProperty$Accessors".

        This error does not occur with 8u20. It also occurs with 8u40 with optimistic types turned off.

        The error happens here -

        sending "url.format(\"http://google.com\")"
        Unix data: "java.lang.ClassCastException: jdk.nashorn.internal.scripts.JO4 cannot be cast to jdk.nashorn.internal.runtime.UserAccessorProperty$Accessors\nnode via Unix socket> ", expecting "http://google.com/"

        This error can also be reproduced running the REPL manually -

        java -Dnashorn.args='--optimistic-types=false' -jar dist/avatar-js.jar
        > url.format("http://google.com")
        java.lang.ClassCastException: jdk.nashorn.internal.scripts.JO4 cannot be cast to jdk.nashorn.internal.runtime.UserAccessorProperty$Accessors

        But a simple test case works fine -

        cat format.js
        print(require('url').format("http://google.com"));

        java -Dnashorn.args='--optimistic-types=false' -jar dist/avatar-js.jar format.js
        http://google.com/

        Something in url.format does not work with 8u40 when called by a REPL.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                hannesw Hannes Wallnoefer
                Reporter:
                akhil Akhil Arora (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: