-
Bug
-
Resolution: Fixed
-
P4
-
8
Assume TA is an annotation type with one meta-annotation, @Target(ElementType.TYPE_USE). It's right to link @TA with "String" (skipping over modifiers) in:
@TA public String f;
but we mustn't appear to link @TA to "String" in:
@TA public java.lang.String f;
because the 'java' and 'lang' package names get in the way. The informative text in JLS 9.7.4 about the artifact to which @Foo applies should use String rather than java.lang.String. Then, the *** text should be removed in:
"In the second and third cases above, the type which is closest to the annotation is determined by first taking the type of the declared entity, ***then identifying the first token which itself denotes a type.***"
That will leave @TA applying to "java.lang.String", which will later be deemed "not admissible" because the first token isn't a TypeName.
Finally, the following clause should be added: "if that type is an array type, then the element type is deemed to be closest to the annotation."
@TA public String f;
but we mustn't appear to link @TA to "String" in:
@TA public java.lang.String f;
because the 'java' and 'lang' package names get in the way. The informative text in JLS 9.7.4 about the artifact to which @Foo applies should use String rather than java.lang.String. Then, the *** text should be removed in:
"In the second and third cases above, the type which is closest to the annotation is determined by first taking the type of the declared entity, ***then identifying the first token which itself denotes a type.***"
That will leave @TA applying to "java.lang.String", which will later be deemed "not admissible" because the first token isn't a TypeName.
Finally, the following clause should be added: "if that type is an array type, then the element type is deemed to be closest to the annotation."