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

PropertyMap of Error objects is not stable

XMLWordPrintable

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

        Every Error object gets a new PropertyMap after a recent change to capture stack trace @ constructor call.

            var e1 = new Error()
            var e2 = new Error()

            print(Debug.map(e1) == Debug.map(e2))

        prints false. Previously, the above evaluated to true. "nashornException" property is added to the instances at constructor. Note that previously error objects got exception property only when thrown -- at which these objects still got different PropertyMaps.

        try {
           throw e1
        } catch (e) {
            print(Debug.toIdentString(Debug.map(e)));
        }

        try {
           throw e2
        } catch (e) {
            print(Debug.toIdentString(Debug.map(e)));
        }

        I think it is better to add nashornException as a @Property to NativeXYZError classes.

              sundar Sundararajan Athijegannathan
              sundar Sundararajan Athijegannathan
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: