JDK-8073733 : TypeError messages with "call" and "new" could be improved
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: jdk.nashorn
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2015-02-24
  • Updated: 2016-01-14
  • Resolved: 2015-08-04
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.
JDK 8 JDK 9
8u72Fixed 9 b77Fixed
Description
var obj = { };
obj.foo();


x.js:2 TypeError: Cannot call undefined


Instead it'd be a nice debugging feature, if TypeError message looked someting like 

x.js:2 TypeError: Cannot call "foo" that has undefined value

or even

x.js:2 TypeError: Cannot call "obj.foo" that has undefined value

Similar TypeError message improvement on "new" may be done as well.
Comments
Attachment "poc_webrev.zip" is my PoC hack attempt.
24-02-2015