TYPE_USE annotations in declaration contexts

Markus Keller markus_keller at ch.ibm.com
Thu Feb 6 09:01:25 PST 2014


The Javadoc of java.lang.annotation.ElementType says: "The constant 
TYPE_USE corresponds to the 15 type contexts in JLS 4.11, as well as to 
two declaration contexts: type declarations (including annotation type 
declarations) and type parameter declarations."

java-se-8-jls-fr-diffs.pdf 9.6.4.1 says: "There are 15 type contexts 
(§4.11), all represented by the enum constant TYPE_USE of 
java.lang.annotation.ElementType."

=> JLS8 doesn't tell that TYPE_USE annotations are also applicable in two 
declaration contexts. This should be added to JLS8 9.6.4.1. 

Current implementations of javac and ecj follow the Javadoc (accept a 
TYPE_USE annotation on a type declaration) and thus violate the current 
JLS8.

Regards,
Markus



More information about the type-annotations-spec-comments mailing list