Containing annotation type with TYPE_USE target

Alex Buckley alex.buckley at oracle.com
Tue Jan 14 12:04:46 PST 2014


On 11/21/2013 5:34 PM, Alex Buckley wrote:
> Here is the relevant text for JLS8 9.6.3 "Repeatable Annotation Types"
> which is aware of the TYPE_USE construct from JSR 308:
>
> ---
> T is applicable to at least the same kinds of program element as TC
> (§9.6.4.1). Specifically, if the kinds of program element where T is
> applicable are denoted by the set m1, and the kinds of program element
> where TC is applicable are denoted by the set m2, then each kind in m2
> must occur in m1, except that:
>
> - If the kind in m2 is java.lang.annotation.ElementType.ANNOTATION_TYPE,
> then at least
> one of java.lang.annotation.ElementType.ANNOTATION_TYPE or
> java.lang.annotation.ElementType.TYPE or
> java.lang.annotation.ElementType.TYPE_USE must occur in m1.
>
> - If the kind in m2 is java.lang.annotation.ElementType.TYPE,
> then at least one of java.lang.annotation.ElementType.TYPE or
> java.lang.annotation.ElementType.TYPE_USE must occur in m1.
> ---

Joel points out that a third bullet is needed, because the type 
parameter context is logically included in the type use context:

- If the kind in m2 is java.lang.annotation.ElementType.TYPE_PARAMETER, 
then at least one of java.lang.annotation.ElementType.TYPE_PARAMETER or
java.lang.annotation.ElementType.TYPE_USE must occur in m1.

Since the bug (JDK-8029017) targets an update release of JDK8, I will 
add the bullet in time for JLS8. No point delaying it until JLS9.

Alex


More information about the compiler-dev mailing list