Nest host validation vs NestHost attribute performed by Lookup::defineHiddenClass

Peter Levart peter.levart at gmail.com
Tue Oct 1 22:13:54 UTC 2019


On 10/2/19 12:02 AM, Remi Forax wrote:
> ----- Mail original -----
>> De: "John Rose" <john.r.rose at oracle.com>
>> À: "Peter Levart" <peter.levart at gmail.com>
>> Cc: "valhalla-dev" <valhalla-dev at openjdk.java.net>
>> Envoyé: Mardi 1 Octobre 2019 23:38:31
>> Objet: Re: Nest host validation vs NestHost attribute performed by Lookup::defineHiddenClass
>> On Oct 1, 2019, at 3:42 AM, Peter Levart <peter.levart at gmail.com> wrote:
>>> ...what is the reason for Class.getNestMembers() for not being dynamic?
>> I think you answer your own question in the next sentences:  It’s an expensive luxury.
> it's also unnecessary given that you have Class.isNestmateOf() which works with dynamically added nest members,
> so instead of using getNestMembers() and re-implement the access checks, you can directly ask the VM if is a class is a nest member of a nest host.

I'm not for or against Class.getNestMembers() returning hidden classes. 
Merely pointing out that it could return even weak hidden classes by not 
keeping them strongly reachable - just weakly. If getNestMembers() was 
specified to be dynamic, then returned members could come and go over time.

But a more concerning issue is what to do with a weak hidden class 
appointed to act as a nest host in a multi member nest. Such nest host 
can not simply be unloaded until all members can be.

Regards, Peter

>
> Rémi



More information about the valhalla-dev mailing list