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

Clarify "present" and annotation ordering in javax.lang.model for Annotations

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: P3 P3
    • 8
    • 8
    • core-libs
    • b93
    • Not verified

      No implementation changes are needed. Only the javadoc needs to be clarified:

      1) In AnnotatedConstruct, the interface-level javadoc should have these definitions:

      - An annotation A is directly present on a construct C if either:
        - A is explicitly or implicitly declared as applying to the source code representation of C; or
        - A has a representation in the executable output corresponding to C, such as in the RuntimeVisibleAnnotations attribute of a class file.

      (Typically, if A is the only annotation of its type applied to C, then A is explicitly declared as applying to the source code representation of C. If there are multiple annotations of the same type applied to C, then a container annotation is implicitly declared as applying to the source code representation of C (JLS 9.7). Note that the multiple annotations of the same type are _not_ directly present on C; rather, they are indirectly present.)

      - An annotation A is indirectly present on a construct C if A's type is repeatable, and C has exactly one annotation whose value element contains A and whose type is the containing annotation type of A's type (JLS 9.6).

      - An annotation A is present on a construct C if either:
        - A is directly present on C; or
        - No annotation of A's type is directly present on C, and C is a class, and A's type is inheritable (JLS 9.6.3.3), and A is present on the superclass of C.

      - An annotation A is associated with a construct C if either:
        - A is directly or indirectly present on C; or
        - No annotation of A's type is directly or indirectly present on C, and C is a class, and A's type is inheritable (9.6.3.3), and A is associated with the superclass of C.

      2) In AnnotatedConstruct#getAnnotationsByType, the javadoc should be:

      Returns the annotations which are associated with this construct. The order of annotations which are directly or indirectly present on a construct C is computed as if indirectly present annotations on C are directly present on C in place of their container annotation, in the order in which they appear in the value element of the container annotation.

            darcy Joe Darcy
            abuckley Alex Buckley
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: