Skip to content

Why defer all the elements of the problematic element's enclosing TypeElement? #1340

Answered by eamonnmcmanus
AriaAdibi asked this question in Q&A
Discussion options

You must be logged in to vote

It's an interesting question. The JDK documentation for annotation processors isn't all that clear, but it does say this about the method Processor.process:

Processes a set of annotation interfaces on type elements originating from the prior round and returns whether or not these annotation interfaces are claimed by this processor.

[emphasis added]

So following this documentation, if you have an annotation on a method then that in itself should not be enough to trigger a processor for that annotation. Only annotations on type elements should trigger it. (The weird thing is that, as far as I can see, there is no method to return just the set of TypeElements with the annotation, perhaps b…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@AriaAdibi
Comment options

@eamonnmcmanus
Comment options

@eamonnmcmanus
Comment options

Answer selected by eamonnmcmanus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants