JDK-8156896 : Script stack trace should display function names
  • Type: Bug
  • Component: core-libs
  • Sub-Component: jdk.nashorn
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2016-05-12
  • Updated: 2016-10-13
  • Resolved: 2016-05-13
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
8u112Fixed 9 b119Fixed
Description
Currently Nashorn script stack traces display Java method names instead of JS function names. Java method names are composed from the function name appended to the names of its parent functions using '$' as separator. If any function in the chain is anonymous, the function itself will be displayed as "<anonymous>" in the stack trace. 

To solve this, we need to use a character that is not a valid ECMA identifier character as method separator name, but is allowed in Java method names. This would allow us to get the original function name from the Java method name and display it in script stack traces.