Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8019998

Clarify compilation of nested classes and nested interfaces

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 8
    • 7
    • specification
    • None
    • Verified

    Description

      JLS7 13.1 says: "Every nested class must have a symbolic reference to its immediately enclosing class."

      This should be: "Every nested class and nested interface must have a symbolic reference to its immediately enclosing class (8.1.3)."

      JLS7 13.1 also says: "Every class that contains a nested class must contain symbolic references to all of its member classes, and to all local and anonymous classes that appear in its methods, constructors, and static or instance initializers."

      This rule applies when a class contains a nested interface, not just a nested class. The rule should be: "Every class must contain symbolic references to all of its member types (8.5), and to all local and anonymous classes that appear in its methods, constructors, static initializers, instance initializers, and field initializers." In addition, the rule applies when an _interface_ contains a nested class or nested interface, so the following rule should be added: "Every interface must contain symbolic references to all of its member types (9.5), and to all anonymous classes that appear in its field initializers."

      Attachments

        Issue Links

          Activity

            People

              abuckley Alex Buckley
              abuckley Alex Buckley
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: