RFE JDK-8187698: [Nestmates][Testbug] Test java/lang/invoke/AccessControlTest.java needs updating for nestmates

David Holmes david.holmes at oracle.com
Thu Feb 22 01:25:17 UTC 2018


Hi Mandy,

Thanks for taking this one!

On 22/02/2018 10:55 AM, mandy chung wrote:
> http://cr.openjdk.java.net/~mchung/valhalla/webrevs/8187698/webrev.00/
> 
> A simple test fix. Update AccessControlTest test how it determines whether
> a test case should have access to handle the nestmates case when accessing
> a private member.

+             boolean samePackageMember = sameClass || sameTopLevel;

I don't understand this change. If c1==c2 then sameTopLevel is also 
true. So it is always the case that samePackageMember == sameTopLevel 
and so the change has no affect.

!             // allow private lookup on nestmates. Otherwise, privacy 
is strictly enforced
!             if (c1 != c2 && ((m2 & PRIVATE) == 0 || c1.getNestHost() 
!= c2.getNestHost())) {
!                 m1 &= ~PRIVATE;
!             }

Ah! I tried this but didn't check the access was actually private! No 
wonder it failed. :)

This can be simplified using !c1.isNestmateOf(c2)

Thanks,
David

> 
> Mandy


More information about the valhalla-dev mailing list