[type-annos-observers] FYI, JSR 308 and the annotation processing discovery process
Joe Darcy
joe.darcy at oracle.com
Thu Mar 28 22:39:43 PDT 2013
Hello,
FYI, as the JSR 269 maintenance lead, besides updating the
javax.lang.model.* API to handle new-in-Java-SE-8 features, I'm not
looking at updating the javax.annotation.processing API to deal with
those new annotation-related features too.
To provide some context, here is an excerpt from the
javax.annotation.processing.Processor interfaces which describes part of
the tool <-> processor protocol:
"The tool uses a discovery process to find annotation processors and
decide whether or not they should be run. [...] Which processors the
tool asks to run is a function of what annotations are present on the
root elements, what annotation types a processor processes, and whether
or not a processor claims the annotations it processes. [...] For a
given round, the tool computes the set of annotation types on the root
elements. If there is at least one annotation type present, as
processors claim annotation types, they are removed from the set of
unmatched annotations."
To this, I plan to add a paragraph explaining how type annotations do
not interact with the this discovery process; something like:
"<p>An annotation type is considered present if there is at least one
annotation of that type on a declaration enclosed within the root
elements of a round. For this purpose, a type parameter is considered
to be enclosed by its generic element. Annotations on type uses are
<em>not</em> considered as part of the computation.
An annotation is <em>present</em> on a declaration if it is present as
defined in {@link AnnotatedConstruct}. That is, the annotation may be
directly present or present via inheritance. An annotation indirectly
present by virtue of a repeatable annotation type is <em>not</em>
considered represent for the purposes of the discovery process.
[..]"
For the purposes of JSR 308:
* Declaration annotations on type parameters are included in discovery
* TYPE_USE annotations are *not* included as part of discovery
Comments?
Thanks,
-Joe
More information about the type-annotations-spec-observers
mailing list