I know that the Annotation Processor is normally used to consume annotations and react to them. I, however, have a use case where this "reaction" involves adding other annotations. Can this be done within the processor itself? If so, how?
The short answer is yes, and you don't have anything specific to do.
An annotation processor is used to create new source files, not to modify existing ones. So when you say "adding other annotations", I guess you mean "creating new classes that hold annotations".
Annotation processing is done in rounds. At each round, the process method of your annotation processor is called.
If a processor generate new source files, another round of annotation processing starts
So basically : you have nothing to do, it already works ;-) .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With