org/projectlombok/lombok/1.14.8/lombok-1.14.8.jar!/lombok
lombok.Getter
lombok.Setter
lombok.Data
lombok.ToString
lombok.extern.log4j.Log4j
lombok.extern.slf4j.Slf4j
There are many more, dig for yourself
<dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.14.8</version> <scope>provided</scope> </dependency>
Analysis of the working principle of lombok , taking Oracle's javac compilation tool as an example.
Since Java 6, javac has supported the "JSR 269 Pluggable Annotation Processing API" specification. As long as the program implements this API, it can be called when javac is running.
For example, now there is a program A that implements the "JSR 269 API", then the specific process of compiling the source code with javac is as follows:
1) javac analyzes the source code and generates an abstract syntax tree (AST)
2) runs In the process, the A program that implements the "JSR 269 API" is called.
3) At this time, the A program can complete its own logic, including modifying the abstract syntax tree (AST) obtained in the first step.
4) javac uses the modified abstract syntax tree (AST) Generate bytecode file
Compilation tools that support lombok
1) According to "three, principle analysis", Oracle javac directly supports lombok
2) The java compilation tool used by Maven, a commonly used project management tool, comes from the configured third-party tool. If we configure this third-party tool If it is Oracle javac, then Maven will directly support lombok.
3) If the compilation tool configured by Intellij Idea is Oracle javac, it will directly support lombok.
4) The Oracle javac compilation tool is not used in Eclipse, but the Eclipse Compiler for Java (ECJ) implemented by itself. To enable ECJ to support lombok, it must be set, specifically in the eclipse.ini file in the Eclipse program directory. Add the following two lines:
-javaagent:[path where lombok.jar is located]
-Xbootclasspath/a:[path where lombok.jar is located]