Generation of NestHost and NestMembers attributes using javac?

Maurizio Cimadamore maurizio.cimadamore at
Tue Jul 3 09:56:34 UTC 2018

What Remi says :-)

Think of InnerClasses as one of those attributes used to store extra 
source information which is then later used either by javac (when 
reading from classfiles) or by reflection. The VM doesn't really care 
about InnerClasses much, as it doesn't about the Signature attribute.

Using a new attribute avoids the confusion and, as Remi said, opens the 
machinery up to cases where classes might not come from the same source. 
Another example where this might come in handy is valhalla generic 
specialization, where you want e.g. List<int> and List<String> be part 
of the same logical 'nest', although they might correspond to different 
dynamically generated bits which are not in an inner/nested relationship.


On 03/07/18 07:35, Remi Forax wrote:
> Hi Ess,
> the specification of NestHost/NestMember attributes is independent of the InnerClass attribute.
> The former specifies that there is a private access among the members of the nest the later indicates that the classes comes from the same source files.
> For javac currently, a nest member is an inner class of the nest host, so the attributes or more or less aligned, but for other languages than Java this may not be the case and in the future, for Java this may not be the case too. Another example, a JavaEE (like) container may generate proxy classes that are nest members of the proxied class without the proxy being an inner class of the proxied class.
> cheers,
> Rémi
> ----- Mail original -----
>> De: "Ess Kay" <s.2016.kay at>
>> À: "Maurizio Cimadamore" <maurizio.cimadamore at>
>> Cc: "compiler-dev" <compiler-dev at>
>> Envoyé: Mardi 3 Juillet 2018 04:50:14
>> Objet: Re: Generation of NestHost and NestMembers attributes using javac?
>> Hi Maurizio,
>>> JEP 181 was integrated On Sat 23rd of June
>> Thank you. I see build 20 (2018/6/29) is now available.  I should have
>> been patient for one more day ;).
>> As far as I can determine, a nest member class is always an inner
>> class of its nest host class.  That is, if there is a NestHost or
>> NestMember attribute in a class then there will always also be an
>> InnerClasses attribute.  Is that indeed the case?  If not then do you
>> have sample Java source that would result in a NestHost or NestMember
>> attribute being generated by javac without an InnerClasses attribute?
>> Best regards,
>> S

More information about the compiler-dev mailing list