JDK-8202513 : 13.1: Note that references may occur to other enclosing classes
  • Type: Enhancement
  • Component: specification
  • Sub-Component: language
  • Affected Version: 11
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2018-05-01
  • Updated: 2018-05-02
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbd_majorUnresolved
Related Reports
Relates :  
Description
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."
Comments
May also mention that the top-level class may include symbolic references to any of its nested classes. In this case, those references are never resolved during access checking, so it's not clear whether they should be considered "symbolic references" (in the JLS 13.1 sense) at all. On the other hand, reflection may be used to read the attribute and load the classes.
02-05-2018