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

Global constants get in the way of self-modifying properties

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 8u20
    • core-libs
    • b04
    • b31
    • generic
    • generic

        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.

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

                Created:
                Updated:
                Resolved: