I'm writing an annotation processor that needs to access elements that only exist within an anonymous class. Specifically, accessing a method within an enum anonymous class.
enum Foo {
BAR {
@MyAnnotation
void doSomething() { [...] }
};
@MyAnnotation
void doSomethingElse() { [...] }
}
When calling roundEnv.getElementsAnnotatedWith(MyAnnotation.class) within the annotation process I do not get an element representing the doSomething method. I do however, get an element representing the doSomethingElse method so it seems to be specific to anonymous classes. I've observed the same for field annotations as well within an anonymous enum class.
What am I missing? Is this sort of processing just not supported?