Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8250741 an annotation interface may not be declared as a local interface
  3. JDK-8260623

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

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Delivered
    • Icon: P3 P3
    • 16
    • 16
    • 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.

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

              Created:
              Updated:
              Resolved: