Not the best answer, because I did not do it myself, but, seeing how it was 3 hours, I will do everything I can.
Annotation Processing Overview
If annotation processing is not disabled with the -proc: none option, the compiler searches for any annotation processors that are available. The search path can be specified using the -processorpath option; if it is not specified, the user uses the class path. Processors hosted by the service provider configuration files named
META-INF / services / javax.annotation.processing.Processor in the search path. Such files should contain the names of any annotation processors that will be used by the line. Alternatively, processors can be specified explicitly using an -processor.
So, you need to create a file called javax.annotation.processing.Processor in the META-INF/services folder, which lists the names of your annotation processors, one per line.
EDIT: So, I believe the code for reading annotations will be similar to ...
for (Element element : roundEnv.getRootElements()) { State state = element.getAnnotation(State.class); if(state != null) { String stage = state.stage(); System.out.println("The element " + element + " has stage " + stage); } }
Here you can find a real example annotation processor here .
source share