Updated JEP: nestmates

forax at univ-mlv.fr forax at univ-mlv.fr
Thu Apr 13 22:10:54 UTC 2017

----- Mail original -----
> De: "David Holmes" <david.holmes at oracle.com>
> À: forax at univ-mlv.fr
> Cc: "Brian Goetz" <brian.goetz at oracle.com>, "John Rose" <john.r.rose at oracle.com>, valhalla-dev at openjdk.java.net
> Envoyé: Jeudi 13 Avril 2017 23:44:55
> Objet: Re: Updated JEP: nestmates

>>> On 13/04/2017 8:37 PM, Remi Forax wrote:
>>>> Re-reading the spec again,
>>>> i think it would be clearer if you introduce T the nest-top, and modifying the
>>>> classloading order has to be listed in the "Risks and Assumptions" section.
>>>> Description:
>>>>   "The Java compiler compiles a group of nested types into a corresponding group
>>>>   of class files; it uses the InnerClasses and EnclosingMethod attributes to
>>>>   reify the nesting relationship (JVMS 4.7.6 and 4.7.7)."
>>>>   We can not re-use these attributes to describe nesting relationship because
>>>>   being part of a nest has to be verified, triggering classloading of the
>>>>   nest-top, thus changing the semantics of the existing attributes.
>>>>   ...
>>>>   "For types C and D to be nestmates they must either have the same nest-top T. A
>>>>   type C claims to be a member of the nest of D, if both C and D list T in their
>>>>   MemberOfNest attribute. The membership is validated during class loading if T
>>>>   also lists C and D in its NestMembers attribute. This may require loading of
>>>>   nest-top types earlier than might otherwise occur."
>>> That paragraph in the JEP got modified slightly from my original. There
>>> was no intent at that point to introduce a third type. My original is:
>>> "For types <i>C</i> and <i>D</i> to be nestmates they must either have
>>> the same nest-top, or else one must be the nest-top of the other.
>> ok, agree with this one, even if the second part of this sentence is not
>> necessary.
> The second part most certainly is necessary as a nest-top does not
> itself have a nest-top!

Conceptually a nest-top is its own nest-top, but in term of attribute, so yes, you're right.

>>> A type <i>C</i> claims to be a member of the nest of <i>D</i>, if it
>>> lists <i>D</i> in it's `MemberOfNest` attribute.
>> while i understand this sentence, i'm not sure everybody will be able to parse
>> it,
>> apart from the 'it's' -> its, "member of the nest of D" is ambiguous, at least
>> for me, it can be read as "member of the same nest as D" or as "member of the
>> nest named D".
>> Perhaps removing the "of" is enough.
>>   A type <i>C</i> claims to be a member of the nest <i>D</i>, if it lists <i>D</i>
>>   in it's `MemberOfNest` attribute.
> D is not a nest! D is a type that may be in a nest. "nest of D" is
> perfectly correct. We could rephrase to "of the same nest as D".

if D is not the nest, then MemberOfNest attribute of C is not D but the nest-top of D. 


More information about the valhalla-dev mailing list