- 
    Enhancement 
- 
    Resolution: Unresolved
- 
     P4 P4
- 
    11
                    For JEP 181 (JDK-8177019), it was proposed to expand the 13.1 rule about references to enclosing classes, from:
"Every nested class and nested interface must have a symbolic reference to its immediately enclosing class (§8.1.3)."
to:
"Every nested class and nested interface must have symbolic references to all of its enclosing classes (§8.1.3)."
The argument for including a reference to every enclosing class, not just the immediately enclosing class, centered on the InnerClasses attribute. Namely, if a nested class's class file contained a reference to the immediately enclosing class, then the InnerClasses attribute required a reference to the enclosing class of that class, and so on. However, this argument fails to acknowledge that local and anonymous classes have an outer_class_info_index of 0; this breaks the chain, and no further enclosing classes are referenced.
Still, it may be useful to add a non-normative observation about classes that may be referenced:
"A nested class or nested interface may also include symbolic references to other enclosing classes."
"Every nested class and nested interface must have a symbolic reference to its immediately enclosing class (§8.1.3)."
to:
"Every nested class and nested interface must have symbolic references to all of its enclosing classes (§8.1.3)."
The argument for including a reference to every enclosing class, not just the immediately enclosing class, centered on the InnerClasses attribute. Namely, if a nested class's class file contained a reference to the immediately enclosing class, then the InnerClasses attribute required a reference to the enclosing class of that class, and so on. However, this argument fails to acknowledge that local and anonymous classes have an outer_class_info_index of 0; this breaks the chain, and no further enclosing classes are referenced.
Still, it may be useful to add a non-normative observation about classes that may be referenced:
"A nested class or nested interface may also include symbolic references to other enclosing classes."
- relates to
- 
                    JDK-8177019 JLS changes for Nestmates -           
- Resolved
 
-