JDK-8221077 : No NullPointerException message if top frame is hidden.
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 13
  • Priority: P4
  • Status: Resolved
  • Resolution: Won't Fix
  • Submitted: 2019-03-19
  • Updated: 2020-05-08
  • Resolved: 2019-07-16
Related Reports
Relates :  
Description
Exceptions can print the stack trace of when the exception occured.
There can be methods on the stack that have been generated by 
the runtime.  To not confuse the reader of the stackTrace, 
these are omitted (if -XX:-ShowHiddenFrames, which is default.)

The frames are already dropped when the backtrace datastructure is
built.

If a NullPointerException is raised in a method whose stack 
frame will be hidden, a message based on the wrong method
is printed. This is because the message is generated on base
of the backtrace, which lacks the real top frame.

This change adds a java.lang.Boolean(true) to the backtrace
in case the real top frame is a hidden one and is dropped.

When the NullPointerException message text is generated, this is 
checked and the message is skipped if the proper frame is not
available.

I handle this in a bug itself to keep the discussion of 
the basic feature seperated from this technical issue.

The problem exists independent of the language chosen 
to implement generating the message. 

Comments
Closing this issue. David asked me to include this in 8218628.
16-07-2019

A webrev for a prototype is here: http://cr.openjdk.java.net/~goetz/wr19/8221077-hidden_top_frame/
09-05-2019