Updated JEP: nestmates

David Holmes david.holmes at oracle.com
Fri Apr 14 03:24:49 UTC 2017

On 14/04/2017 8:21 AM, forax at univ-mlv.fr wrote:
> [...]
>>>> The membership is validated
>>>> during class loading if <i>D</i> also lists <i>C</i> in its
>>>> `NestMembers` attribute. This may require loading of nest-top types
>>>> earlier than might otherwise occur."
>>>> Also note that "loading" is being used to allow some flexibility. What I
>>>> currently do is validate during class linking, prior to verification (if
>>>> enabled). But specifying it to happen at that exact point may be too
>>>> constraining.
>>> yes agree about what "loading" means here,
>>> in term of implementation, i think it should be validated the first time you
>>> need the nestmate relationship, it will be less disruptive (see below)
>> Note that may be during verification of another class. Any way the
>> details here can be further explored. I don't think lazier than
>> link-time buys you anything when you may need it earlier anyway.
> sorry, i was not clear enough here.
> Being lazier than linking time in my mind means doing the check at runtime the first time you access to the member.
> i.e. during link time (at any phase) you mark that you can not do the full access check but because you have a nest-top, and you delay a part of the access check at runtime.
> that is what i was thinking when i write 'the first time you need'.

You can't do that if verification is involved. As it stands the use of 
invokespecial to access a private nestmate method will not pass the 
verifier. So we have to relax the rule in the verifier to allow for 
nestmate access - which means we need to resolve (and validate) the 
nest-top when verification occurs. Otherwise you've opened up a hole in 
the verification process.


> regards,
> Rémi

More information about the valhalla-dev mailing list