On 9/11/2017 5:39 PM, Brian Goetz wrote:
looks good to me. Might even work in the word “partition” or mention a class
belongs to exactly one nest.
Added.
"A class or interface that is not explicitly a member of a nest, is a
member of the nest consisting only of itself, and is the nest host.
_ Every class and interface is a member of exactly one nest. _ "
Thanks,
David
Sent from my iPad
On Nov 9, 2017, at 8:25 AM, David Holmes <[email protected]> wrote:
On 7/11/2017 10:25 PM, Brian Goetz wrote:
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.
Okay I've incorporated the suggested changes and updated in place:
http://cr.openjdk.java.net/~dholmes/8188075/webrev/raw_files/new/java/lang/Class.html#getNestHost()
I hope it isn't TMI for John.
I looked at the package javadoc for java.lang, and java.lang.reflect, and I
looked at the class javadoc for Class, and I couldn't see anywhere I could put
this that would not look completely out of place. So I've left it as extended
commentary (apiNote) in getNestHost().
Thanks,
David
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