[Checkers] Processing unknown annotations

Michael Ernst mernst at csail.mit.edu
Wed May 28 16:07:48 EDT 2008

I would like to reply to Artemus Harper's question to the mailing list
about processing unknown annotations, which has been unanswered for a
couple of days.  Matt and Mahmood, let me know if the below is technically
accurate, or if it could be improved in some other way.



> Is there any support for processing unknown annotations?
> In my case I want to allow the analysis of user provided annotations.

This is easy enough to do.  The Custom Checker that is distributed with the
Checker Framework already does this.  For documentation, see


You can also read its code, which may help you with your task.

(Note:  In the next release, the Custom Checker will be renamed to the
Basic Checker.)

> I do not have any idea what SupportedAnnotationTypes and TypeQualifiers
> annotations actually do, so I am concerned if what I want to do is feasible.

javax.annotation.processing.SupportedAnnotationTypes is supplied by Sun,
and we have not changed its meaning.  Only the listed annotations are
supplied to the given annotation processor.  If you want your annotation
processor to be given every annotation in the program, you can write
(You can also omit the @SupportedAnnotationTypes annotation, but it's
better style to explicitly state what annotations are supported.)

TypeQualifiers should be a subset of SupportedAnnotationTypes.  The
argument to TypeQualifiers lists only the type qualifier annotations.  If
you supply the TypeQualifiers annotation, then it is used to automatically
build the type qualifier hierarchy.

More information about the checkers mailing list