RFR(L): 8218628: Add detailed message to NullPointerException describing what is null.

Lindenmaier, Goetz goetz.lindenmaier at sap.com
Tue Feb 12 14:51:26 UTC 2019


Hi Daniel, 

>         public int getByteCodeIndex(); [1]
thanks for this info. I missed that.

> But I am not sure how you would use that in this case.
> I mean - IIUC the stack would have to be walked when the exception
> is raised - not when getMessage() is called. It's possible that
Well, I will have to call StackWalker in the constructor and remember 
the data I need.

> It's possible that
> the BCI is encoded in the backtrace data though. I have not
> checked.
Yes it is. That is what I'm using currently, in the C++ implementation.
See get_method_and_bci in javaClasses.cpp.

Best regards,
  Goetz.

> -----Original Message-----
> From: Daniel Fuchs <daniel.fuchs at oracle.com>
> Sent: Dienstag, 12. Februar 2019 14:55
> To: Lindenmaier, Goetz <goetz.lindenmaier at sap.com>; Roger Riggs
> <Roger.Riggs at oracle.com>; Java Core Libs <core-libs-dev at openjdk.java.net>
> Cc: hotspot-runtime-dev at openjdk.java.net
> Subject: Re: RFR(L): 8218628: Add detailed message to NullPointerException
> describing what is null.
> 
> Hi Goetz,
> 
> On 12/02/2019 14:14, Lindenmaier, Goetz wrote:
> > StackWalker operates on the Java stack tracke, which does not contain the
> BCI
> > to my knowledge.
> 
> For what it's worth, StackWalker::StackFrame has the BCI: returned by
> 
>         public int getByteCodeIndex(); [1]
> 
> But I am not sure how you would use that in this case.
> I mean - IIUC the stack would have to be walked when the exception
> is raised - not when getMessage() is called. It's possible that
> the BCI is encoded in the backtrace data though. I have not
> checked.
> 
> best regards,
> 
> -- daniel
> 
> [1]
> https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Stac
> kWalker.StackFrame.html#getByteCodeIndex()


More information about the hotspot-runtime-dev mailing list