Why defer all the elements of the problematic element's enclosing TypeElement
?
#1340
-
As I understood, when an element One negative aspect is that when the annotation to be processed targets methods only for example, and for each annotated method it acts independently, then this behavior is undesirable and some hacks are needed if we want to successfully process each annotated method only once (this is needed for example, if after successful completion Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
It's an interesting question. The JDK documentation for annotation processors isn't all that clear, but it does say this about the method
[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 Following that, then, the |
Beta Was this translation helpful? Give feedback.
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
:[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
TypeElement
s with the annotation, perhaps b…