Release Note: Annotation Interfaces May Not Be Declared As Local Interfaces

XMLWordPrintable

    • Type: Sub-task
    • Resolution: Delivered
    • Priority: P3
    • 16
    • Affects Version/s: 16
    • Component/s: tools
    • Verified

      Prior to JDK 16, the `javac` compiler accepted annotations declared as local interfaces. Now the JLS 16 at section 14.3 forbids it. For example, the `javac` compiler had accepted code such as:

      ```
          class C {
              void m() {
                  @interface A {}
              }
          }
      ```

      This code is no longer acceptable according to Section [14.3] of the JLS 16:
      "A local interface may be a normal interface (§9.1), but not an annotation interface (§9.6)."

      To fix this issue, the `javac` compiler implementation has been synchronized with the JLS 16, so that annotation interfaces cannot be declared as local interfaces.

            Assignee:
            Vicente Arturo Romero Zaldivar
            Reporter:
            Vicente Arturo Romero Zaldivar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: