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

PropertyMap of Error objects is not stable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b02
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        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.

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved: