Search code examples
javaannotationsdecompiling

How to view the Java source code produced by the annotation processing?


I´m interested in the result of the processed annotations to get a in depth understanding of a framework (RestEasy 3.0.7-FINAL in this case).

The Java documentation says:

the annotation processing happens in a sequence of rounds. On each round, a processor may be asked to process a subset of the annotations found on the source and class files produced by a prior round.

After all annotations are processed the Sources are compiled, so in my understanding i should see the result of the process if i decompile the generated .class files. But this results in the Javacode with the unprocessed annotations.

How can i get the result of the annotation processing process?


Solution

  • Annotations can be processed by an annotation processor, but (if they have @Retention(RUNTIME)) can also be queried at runtime using the reflection API. Therefore, you probably see no effect of annotation processing because there is no annotation processing. If there were, the annotation processor would emit java source code, typically in a separate source folder named ".apt_generated".