That's a good description of what a nest mate is.  What could be added is a 
reference the the jvms section that defines it, and a comment that says it is 
up to the source language compiler to decide what classes are nest mates , and 
that java puts inner classes in the nest of their enclosing class (w jlink 
ref).  This could be moved to a section in the package javadoc and referenced 
from the Class doc.  

Sent from my MacBook Wheel

> On Nov 7, 2017, at 11:31 AM, David Holmes <[email protected]> wrote:
> 
> Hi Brian,
> 
> Thanks for the prompt review!
> 
>> On 7/11/2017 6:41 PM, Brian Goetz wrote:
>> The specs are fine. But a reader who doesn't know what a nest is will never 
>> figure it out from the docs.  Would be good if nest host had an API note 
>> that explained how classes become nestmantes.
> 
> True - though I would prefer it if there were some definitive source we could 
> refer to that explains this rather than putting an ad-hoc definition into the 
> API docs. Perhaps we need something in the JLS (as API docs tend not to 
> reference the JVMS). ??
> 
> Otherwise ...
> 
> "A nest is a set of classes (nest mates) that form an access control context 
> in which each class has access to the private members of the other classes in 
> the nest. The set of classes consisting of a top-level class plus all of its 
> nested classes, is an example of a nest. The nest host is the class 
> designated to hold the list of classes that make up the nest, and to which 
> each of the other nest mates refer - a top-level class is always a nest host."
> 
> But it gets messy if you then have to explain that unless compiled for nest 
> mates, every class is considered its own nest and nest host.
> 
> Thanks,
> David
> 
> 
> 
>> Sent from my MacBook Wheel
>>> On Nov 7, 2017, at 7:26 AM, David Holmes <[email protected]> wrote:
>>> 
>>> For comment:
>>> 
>>> http://cr.openjdk.java.net/~dholmes/8188075/webrev/raw_files/new/java/lang/Class.html#getNestHost()
>>> 
>>> Three functions added:
>>> - getNestHost
>>> - isNestmateOf
>>> - getNestMembers
>>> 
>>> The first two never throw exceptions related to nest hosts or nest 
>>> membership. The third does.
>>> 
>>> Thanks,
>>> David

Reply via email to