annotationProcessor
annotationProcessor refers to a program that runs during compilation to read annotations and generate, modify, or validate code and resources. In Java, processors typically extend AbstractProcessor or implement the Processor interface from the annotation processing API.
Processing occurs in rounds. Each round allows the processor to examine annotated elements, write new source
Registration uses the Java Service Provider mechanism: a file named META-INF/services/javax.annotation.processing.Processor lists the processor class. A
Common uses include code generation (for boilerplate or binding code), compile-time validation, and resource generation. The
Implementation notes: create a class extending AbstractProcessor and override process(Set<? extends TypeElement>, RoundEnvironment). Use RoundEnvironment to
Build tools support annotation processing. In Maven, configure the maven-compiler-plugin; in Gradle, add dependencies to the
Limitations include that processing occurs at compile time and can slow builds. Processors should be deterministic