JDK-8032060 : PropertyMap of Error objects is not stable
  • Type: Bug
  • Component: core-libs
  • Sub-Component: jdk.nashorn
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2014-01-17
  • Updated: 2014-07-29
  • Resolved: 2014-01-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
8u20Fixed 9 b02Fixed
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) {

try {
   throw e2
} catch (e) {

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

Yes benchmarks like gameboy where errors are part of the normal control flow suffer from this due to lambda form interpretation