On Wed, 24 Jul 2024 13:00:47 GMT, Chen Liang <li...@openjdk.org> wrote:

>> `TypeAnnotation` is not an annotation, as it should not be used in places 
>> like `AnnotationValue.ofAnnotation`. Thus it's remodeled to contain an 
>> annotation at a given location instead of to be an annotation.
>> 
>> Depends on #20205.
>
> Chen Liang has updated the pull request incrementally with three additional 
> commits since the last revision:
> 
>  - More refinements from alex
>  - Artifact -> construct
>  - More about Annotation, add equals note

I have added a few more paragraphs in response to the request for comments on 
default values and repeatable annotations. Below are the excerpts, for 
`Annotation` and `AnnotationElement::name`.


 * In an annotation in Java source code, elements in the annotation interface
 * with default values may not be compiled into element-value pairs unless an
 * explicit value is provided. ({@jls 9.6.2}) The default value is derived from
 * the {@link AnnotationDefaultAttribute AnnotationDefault} attribute on the
 * method representing the annotation interface element in the class file
 * representing the annotation interface.
 * <p id="repeatable">
 * Multiple annotations of the same interface <i>A</i> in Java source code
 * ({@jls 9.7.5}) are represented by the {@linkplain 
AnnotationValue.OfAnnotation
 * annotation-valued} array elements of the {@linkplain AnnotationValue.OfArray
 * array-valued} element named {@code value} of a container annotation of the
 * containing annotation interface of <i>A</i>. ({@jls 9.6.3})


     * <p>
     * A single-element annotation ({@jls 9.7.3}) in Java source code is
     * compiled to an {@link Annotation} with exactly one {@linkplain
     * Annotation#elements key-value pair} where the element has the name
     * {@code value}.
     * <p>
     * Multiple annotations of the same interface <i>A</i> in Java source code
     * is compiled to an implicitly declared container annotation ({@jls 9.7.5})
     * with exactly one {@linkplain Annotation#elements key-value pair} where
     * the element has the name {@code value} and the type of the element is the
     * {@linkplain AnnotationValue.OfArray array} whose component type is the
     * {@linkplain AnnotationValue.OfAnnotation annotation interface <i>A</i>}.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/20247#issuecomment-2263874434

Reply via email to