idea lombok
Introduction of lombok
Lombok is a Java library that automatically switches on editors and build tools. For simple Java objects, you can substitute getters and Setter methods in code with annotations such as @setter @getter. Lombok uses annotations, but instead of using reflection, it dynamically replaces annotations with concrete code at compile time. So the actual code that the JVM runs is the same as the classes that we write manually that contain the various tool methods.
Lombok annotations
Val: final declares a variable in fianl just like a dynamic language does. Var: with JDK10 @ Data: annotation on the class, will provide all of the attributes of the class to add the get and set methods, and add, equals, canEquals @ Setter, hashCode, and toString method: annotation on the class, add a set method for all attribute, comments on the property for the attribute set method @ Getter: annotation on the class, add the get method to all of the properties, comments on the attribute of the attribute provides the get method @ NotNull: When used in the parameter, if pass the null values when the call, will be thrown null pointer exception @ Synchronized to method, can lock the specified object, if not specified, the default to create an object locking @ the Log function in the class, create a Log properties @ Builder: using the Builder pattern to create objects @ NoArgsConstructor: create a a no-parameter constructor @ AllArgsConstructor: create a full constructor @ ToString refs: Create a ToString method @accessors (chain = true) that uses the chain setting property. The set method returns this object. @RequiredArgConstructor (StaticName = “of”) creates and generates a static method @UtilityClass: Utility class @ExtensionMethod: Sets parent class @FieldDefaults: Sets the scope of properties, such as private, public, etc., and can also set whether properties are final modified. @cleanup: Close streams, join points. @equalSandHashCode: Overrides the equals and hashCode methods. @toString: Create the toString method. @cleanup: Can be used for streams etc without needing to close the use of stream objects.
Lombok error resolution:
1. Use compiler to select javac
2. Enable Annotation Processing
. After installation, restart IDEA. Gives effect to the plugin
4. Maven versions do not agree with the idea lombok version
4. Idea2018 version
IntelliJ idea 2018.1.5 \ plugins \ android \ lib \ templates \ gradle \ wrapper \ gradle \ wrapper
idea under the install directory
ideaVersion=2018.1
start idea then manually install Lombok plugins and restart again
Read More:
- Error reporting when Lombok @ data and @ builder are used together
- Idea startup project Lombok error, no symbol found
- The error of GetSet method encapsulated by idea2020 is red
- solve log.info The problem of reporting error and red line
- The solution of notes floating red error in IntelliJ idea
- Under idea struts.xml The problem of “red” in extends = “struts default”
- Solutions to the problem of using sudo caused by Ubuntu’s wrong modification of sudoers
- How to solve the problem of error reporting in the introduction of Python Django no module name ‘Django. Utils. Six’
- Under idea2020.3 struts.xml The solution of “red report” based on extensions = “struts default” in
- Several solutions to HDF5 error reporting in Python environment
- Solutions to yarn install error reporting
- IntelliJ idea class is normal, but error is marked in red and cannot be found
- About idea reporting error “cannot access class”
- Maven project pom.xml Solutions to error reporting
- Solution of plugins error reporting in idea maven
- import org.junit.Test And @ test error reporting — solutions
- Mayavi fails to get wglchoosepixelformatarb and other error reporting solutions
- About maven Pom.xml Personal solutions to reporting errors!!!
- XLRDError: Excel xlsx file; Not supported error reporting solutions
- Using Lombok to compile and report errors