Annotation Processing Tidbits
In the spirit of this blog where I want to write without getting blocked, here are some disjointed notes on annotation processing in Java.
First, read one of the best descriptions of rounds and such I've ever read.
To raise an error that will be "seen" by RoundEnvironment#errorRaised(), print the right kind of message. This goes hand-in-hand with the multi-round nature of annotation processing.
If you want to process a repeatable annotation, X, you'll need to support both X and X's container annotation (normally something like Xs). See the relevant documentation in AnnotatedConstruct. Note too that the compiler will prevent you from placing both @X and @Xs({ @X }) on your type declaration.
I think, though I cannot find it specified authoritatively anywhere, that the (mandated) final round of annotation processing will always feature an empty set of root elements, an empty set of annotation TypeElements, and a value of true for roundEnvironment.processingOver().