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

    Details

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

      Description

      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.

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: