I'm working with Java 6's annotation processing, i.e. what can be found within javax.annotation.processing
(not Java 5's APT).
I wonder what the conceptional difference between the various Element
, Type
, and Mirror
classes is. As I don't really understand this, it's hard to efficiently program an annotation processor. There are various methods that 'convert' between these notions but I'm not really sure what I'm doing when using them.
So, for example, let me have an instance of AnnotationMirror
.
When I call getAnnotationType()
I get an instance of DeclaredType
(which implements TypeMirror
for whatever reason).
Then I can call asElement()
on this one and obtain an instance of Element
.
What has happened?