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

Gradle 7.0 has problems with annotation processors and java 16 #16641

Closed
graemerocher opened this issue Mar 25, 2021 · 7 comments
Closed

Gradle 7.0 has problems with annotation processors and java 16 #16641

graemerocher opened this issue Mar 25, 2021 · 7 comments

Comments

@graemerocher
Copy link

When building a Micronaut application with Gradle 7.0 it fails with java.lang.IllegalAccessError

Expected Behavior

Should compile

Current Behavior

Fails with

Execution failed for task ':compileJava'.
> java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module @0x77b92754) cannot access class com.sun.tools.javac.code.Symbol$TypeSymbol (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module @0x77b92754

Steps to Reproduce

Try compile https://github.com/graemerocher/micronaut-hol-example with Gradle 7 rc1 and java 16

Your Environment

  • Gradle 7.0 rc1
  • openjdk version "16" 2021-03-16
  • Micronaut 2.4.1
@graemerocher
Copy link
Author

full stack trace

Caused by: java.lang.IllegalAccessError: class org.gradle.internal.compiler.java.ClassNameCollector (in unnamed module @0x77b92754) cannot access class com.sun.tools.javac.code.Symbol$TypeSymbol (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module @0x77b92754
        at org.gradle.internal.compiler.java.ClassNameCollector.processSourceFile(ClassNameCollector.java:74)
        at org.gradle.internal.compiler.java.ClassNameCollector.finished(ClassNameCollector.java:57)
        at jdk.compiler/com.sun.tools.javac.api.ClientCodeWrapper$WrappedTaskListener.finished(ClientCodeWrapper.java:864)
        at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:132)
        at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1658)
        at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1612)
        at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:973)
        at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
        at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:152)
        ... 158 more

@bmuskalla
Copy link
Contributor

Are you sure you did use 7.0-RC-1 and not 7.0-M1? The above issue should have been fixed in M2 and later. I've quickly played around with the project and can't reproduce it with RC1 (and was able to reproduce the issue with M1).
I used

$ gradle clean assemble

to reproduce.

@ljacomet ljacomet added this to the 7.0 RC2 milestone Mar 25, 2021
@graemerocher
Copy link
Author

hmm maybe I ran it with the wrapper which was still at 6.8.. sorry for the noise

@bmuskalla
Copy link
Contributor

No problem, glad it's not a problem anymore :)

@huongnguyen2-futa
Copy link

You need to down your SDK version. I down to openjdk 15.0.2 2021-01-19. It's run well

1 similar comment
@huongnguyen2-futa
Copy link

You need to down your SDK version. I down to openjdk 15.0.2 2021-01-19. It's run well

@SalahAdDin
Copy link

You need to down your SDK version. I down to openjdk 15.0.2 2021-01-19. It's run well

I have the same problem with the official release.

I solved it by downgrading the SDK version, but it should be not required since getting old versions from the official Java website requires to login there while the last one does not need it.

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

No branches or pull requests

5 participants