Skip to content
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 #2790

Closed
jaschenk opened this issue Mar 24, 2021 · 9 comments

Comments

@jaschenk
Copy link

jaschenk commented Mar 24, 2021

Issue during Java build using JDK 14 and Lombok 1.18.18:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project a-service: 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**

?

@jaschenk jaschenk changed the title [BUG] [BUG] Fatal error compiling: java.lang.IllegalAccessError: class lombok.javac.apt.LombokProcessor Mar 24, 2021
@jaschenk
Copy link
Author

Issue resolved due to build platform including incorrect image.

@abhishekdanej
Copy link

Hi, I'm using Java 16 and Spring Boot 2.4.4 and still getting the error. Is there anything I could do? I was earlier running same code on Java 11 and it worked fine.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile (default-testCompile) on project ybl-oastatusreport-spring-boot: Fatal
error compiling: java.lang.IllegalAccessError: class lombok.javac.apt.LombokProcessor (in unnamed module @0x5875de6a) cannot access class com.sun.tools.javac.processin
g.JavacProcessingEnvironment (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module @0x5875de6a -> [Help
1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile (default-testCompile) o
n project ybl-oastatusreport-spring-boot: Fatal error compiling
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)

@Rawi01
Copy link
Collaborator

Rawi01 commented Apr 4, 2021

This should work if you use lombok 1.18.20

@mariiamamr
Copy link

This should work if you use lombok 1.18.20

can you tell us why this occur

@Rawi01
Copy link
Collaborator

Rawi01 commented Sep 14, 2021

JDK 16 uses strong encapsulation by default. Lombok have to use compiler internal classes to modify things during compilation. Since 1.18.20 lombok uses a workaround/hack to still access these classes but this most likely will not be possible anymore in future versions (it still works fine in JDK17). As soon as this happens you have to add a bunch of additional --add-opens flags. You can find some more details in #2681.

@mariiamamr
Copy link

I have a problem I worked with java 8 and lombok 1.18.10 cannot compile but when I updated the version it worked well but I don't have access to change the version in the remote repo so do you know an alternative solution?

@mariiamamr
Copy link

or why lombok 1.18.10 gives fatal compilation error

@rzwitserloot
Copy link
Collaborator

@mariiamamr There is no solution. Upgrade lombok or downgrade java.

@mariiamamr
Copy link

mariiamamr commented Sep 15, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants