Review Request JDK-8202113: Reflection API is causing caller classes to leak

mandy chung mandy.chung at oracle.com
Mon Apr 30 16:29:20 UTC 2018



On 4/30/18 7:39 PM, Alan Bateman wrote:
>
> The approach looks good, seems like this one was lurking (for 
> protected members at least) for a long time.

Yes and this issue becomes more noticeable in JDK 9 as public members 
needs additional module access check.

>
> The 3 x getRoot methods on ReflectAccess looks okay. An alternative 
> would to create <T extends AccessibleObject> T getRoot(T obj) and a 
> package private getRoot() method on AccessibleObject.
>

Good idea.  I updated the patch.
> You might want to check AccessTest before pushing. The webrev shows 
> very odd alignment, maybe tabs expanded to 8 space indent although 
> it's not consistently so.

Thanks for catching it.  I reformatted it.

I also included a comment in AccessTest to mention that private member 
is not accessible and caller class is not cached in that case.

Updated webrev:
   http://cr.openjdk.java.net/~mchung/jdk11/webrevs/8202113/webrev.01

thanks
Mandy


More information about the core-libs-dev mailing list