New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Fatal error compiling: java.lang.IllegalAccessError: class lombok.javac.apt.LombokProcessor #3219
Comments
The error message happenstance because java 17 enforces strong encapsulation. Lombok can handle that if you upgrade to 1.18.22+. Please double check that you really use that version for your build. |
@Rawi01 But doesn't the above issue is fixed in the 1.18.22 version? |
Yes, it is fixed. That's why I'm pretty sure that you use an older version for your build. |
Hello @bhawana99, You are right they solved the issue, but I think it was only for "direct" dependency.
If you want to play with a project that has a solution:
Anyway, I am not sure to understand why the issue still exists when Lombok is an indirect dependency, I will investigate maybe it is an unsolved bug, or maybe it is expected? |
@JulienElkaim Thanks for sharing the reproducer. The recommended scope for Lombok is If you are unable to change the included dependency it is also possible to exclude the dependency using To be honest I have no idea why this happens and it is clearly not intended. |
You, my friend, are brilliant |
@bhawana99 I also experienced this situation,Replacing jdk1.8 can solve the problem |
Thank you @JulienElkaim. Adding the above dependency in my projects pom.xml solved the exception. |
It worked for me. Gr8 |
I'm still having this issue
With Gradle
|
Please update you Lombok first, we did do some changes regarding the packaging of the embedded ASM. |
I've tried with the latest too |
In Java 17 we try to automatically take care of all the necessary add-opens problems. In Java 22, this no loners works. Could it be that you're accidentally using Java 22. In any case, in the repo you can find all the necessary add-open statements in the docker directory. |
FYI: for Java 22 and up we will use a different solution. |
May I ask if the new version of lombok (>=JDK17) no longer relies on the jdk.compiler module for implementation? If you don't use JDK. compiler, what AST editing technique did you use? |
Resolved by adding the following in sourceset.gradle
|
Issue during Java build using JDK 17 and Lombok 1.18.22:
Fatal error compiling: java.lang.IllegalAccessError: class lombok.javac.apt.LombokProcessor (in unnamed module @0x363d3958) cannot access class com.sun.tools.javac.processing.JavacProcessingEnvironment (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module @0x363d395**
I am compiling my java source code in java 1.8, while running the project on JRE17. As per the other bug thread, I have upgraded the lombok version to 22 as it suports lombok reflection issue. But still we are getting this issue. What could be the possible issue.
openjdk version "17-ea" 2021-09-14
OpenJDK Runtime Environment (build 17-ea+23-2064)
OpenJDK 64-Bit Server VM (build 17-ea+23-2064, mixed mode, sharing)
NOTE:
The problem causing library is an external library, in main project we are using lombok version 1.18.12.
The text was updated successfully, but these errors were encountered: