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

javac rejects code with annotation applicable to fields

    XMLWordPrintable

Details

    • b15

    Description

      this code:

      import java.lang.annotation.*;

      @Target({ElementType.FIELD, ElementType.CONSTRUCTOR})
      @Retention(RetentionPolicy.RUNTIME)
      @interface Ann {
      }
      record R(@Ann String str) {
        R {}
      }

      is rejected by the compiler even when the annotation is applicable to fields.

      reported by Tagir on amber-dev:
      https://mail.openjdk.java.net/pipermail/amber-dev/2020-August/006516.html

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: