I met a Lombok issue yesterday and here is the details.
I open a Java Maven project in IntelliJ IDEA. All the classes seems to be compiled in IDEA without any red line errors. And the project can also be compiled properly in command line with “mvn clean install”. However, when I run a unit test of this project in IDEA, some compiling errors are shown in IDEA and the errors are “getting/setting” methods are not found and etc, which means Lombok annotation processing doesn’t work.
I check the project settings “Preferences -> Build, Execution, Deployment -> Compiler -> Annotation Processors”. The annotation processing is enabled and the Lombok IDEA plugin is installed.
I have no idea why it happens.
Today I open another similar Java project in IDEA and face similar Lombok issue with a little difference: this time IDEA throws an “IllegalArgumentException”: “lombok.javac.apt.LombokProcessor could not be initialized”. Search this string and I find a post here, which reminds me that this issue is caused by Lombok cannot work with JDK9. And I’m using JDK9.
The Lombok version in the two projects is “1.16.18”. I upgrade the version to “1.16.22”. After that, both of the projects work properly.
About the Lombok issue with JDK9, here is another post with more details.