Java compiler
The logic written inside the process method does the all the tricks about what criteria we opt to set to process the annotation. We begin by extending the AbstractProcessor abstract class which lets us to override the process method. The SupportedAnnotationTypes defines what kind of annotations the annotation processor will process and the SupportedSourceVersion defines the version it supports. ProcessingEnv.getMessager().printMessage( getSystemJavaCompiler() įor(SourceVersion sv:compiler.getSourceVersions()) public Boolean process(Set annotations,įor (Element e : roundEnv.getElementsAnnotatedWith For example, we can easily find out the list of Java source version supported by the compiler installed in your system. This class provides methods to locate tool providers of compilers. The ToolProvider class provides the entry point of the compiler APIs. It also provides a Service Provider Interface (SPI) for structured access to diagnostics and file abstraction for overriding file access. It provides a framework that allow clients to locate and run compilers from their own application code. The javax.tools package provides interfaces and classes to work with the Java compiler and can be invoked from a program during execution. The model, element, and type packages deal with the elements of Java programming language whereas the util package assists in the processing of program elements and types. It enables communication between the annotation processor and annotation processing tools environment.
The annotation processing facilitates access to annotation processor which can be thought of as a plug-in to the Java compiler.
JAVA COMPILER CODE
It defines the type and model declaration of the Java programming language and compiler tools that can be invoked from an application code during execution. This module includes the language model and annotation processing, along with compiler APIs. The Java Compiler APIs are part of a Java module called piler.