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

Alan Bateman Alan.Bateman at oracle.com
Thu Oct 4 17:45:01 UTC 2018



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):
>
> http://cr.openjdk.java.net/~mchung/jdk12/webrevs/8206240/webrev.01
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


More information about the core-libs-dev mailing list