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

"Illegal reflective access" warning should be addressed #106

Closed
mschechter-bellese opened this issue Jun 29, 2021 · 5 comments
Closed

"Illegal reflective access" warning should be addressed #106

mschechter-bellese opened this issue Jun 29, 2021 · 5 comments

Comments

@mschechter-bellese
Copy link

Describe the bug
Version 2.11 of the Maven plugin (available on Maven Central) generates the following working during formatting:

09:24:58.285 [INFO] --- fmt-maven-plugin:2.11:format (default) @ xxxxx ---
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.googlejavaformat.java.JavacTokens$CommentSavingTokenizer (file:/Users/xxxx/.m2/repository/com/google/googlejavaformat/google-java-format/1.10.0/google-java-format-1.10.0.jar) to field com.sun.tools.javac.parser.JavaTokenizer.reader
WARNING: Please consider reporting this to the maintainers of com.google.googlejavaformat.java.JavacTokens$CommentSavingTokenizer
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

To Reproduce
Execute the format goal

Expected behavior
The warning should not occur

Additional context
I have reverted to the 2.10 plugin release, and the issue no longer occurs. This is a valid workaround for my team, so we're not blocked. You're still using this version on master, there's still a potential issue in subsequent releases.

I've also created an issue in the google-java-format project, as this is most likely in their code.

@klaraward
Copy link
Contributor

I recently learnt about the .mvn/jvm.config where you can add

--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED

@youngm
Copy link

youngm commented Dec 29, 2021

So, those arguments certainly work. However, it would be nice if we eventually don't not have to add them.

@klaraward
Copy link
Contributor

See also #99

@danielnorberg
Copy link
Contributor

These warnings are still issued for JDK 9 to 15, despite #140

This was referenced Mar 28, 2022
@danielnorberg
Copy link
Contributor

Closed by #150

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

4 participants