[Nestmates] Draft core reflection API

David Holmes david.holmes at oracle.com
Tue Nov 7 10:31:39 UTC 2017

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.


> Sent from my MacBook Wheel
>> On Nov 7, 2017, at 7:26 AM, David Holmes <david.holmes at oracle.com> 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

More information about the valhalla-spec-observers mailing list