On 2/8/19 11:46 AM, Roger Riggs wrote:
Hi,
A few higher level issues should be considered, though the details
of the webrev captured my immediate attention.
Is this the right feature and is this the right level of implementation
(C++/native)?
:
How much of this can be done in Java code with StackWalker and other
java APIs?
It would be a shame to add this much native code if there was a more robust
way to implement it using APIs with more leverage.
Improving the NPE message for better diagnosability is helpful while
I share the same concern Roger raised.
Implementing this feature in Java and the library would be a better
choice as this isn't absolutely required to be done in VM in native.
NPE keeps a backtrace capturing the method id and bci of each stack
frame. One option to explore is to have StackWalker to accept a
Throwable object that returns a stream of StackFrame which allows
you to get the method and BCI and also code source (I started a
prototype for JDK-8189752 some time ago). It can use the bytecode
library e.g. ASM to read the bytecode. For NPE message, you can
implement a specialized StackFrameTraverser just for building
an exception message purpose.
Mandy