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

Peter Levart peter.levart at
Thu Oct 4 20:06:05 UTC 2018

Hi Mandy,

On 10/04/2018 07:45 PM, Alan Bateman wrote:
> On 03/10/2018 18:28, Mandy Chung wrote:
>> :
>> 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):
> The JNI call with no java frames is a corner case but good not to 
> change existing behavior. The updated webrev looks okay to me.
> -Alan


Regards, Peter

More information about the core-libs-dev mailing list