Review Request: JDK-8206240: java.lang.Class.newInstance() is causing caller to leak

Mandy Chung mandy.chung at
Wed Oct 3 17:28:40 UTC 2018

On 10/3/18 9:30 AM, Peter Levart wrote:
> Hi Mandy,
> I don't know if this matters though, but should 
> Reflection.getCallerClass() ever return null, previous behavior was to 
> throw NPE (from Reflection.verifyMemberAccess(...)), now the checks 
> are skipped. This should only be observable if [Class, 
> Constructor].newInstance() was called from JNI's newly attached thread 
> I believe. 

Yes that's the case.   Such case never works as it will get NPE.  I 
didn't worry too much about it.  Since you mentioned it, I should keep 
the existing behavior (throwing NPE):


More information about the core-libs-dev mailing list