Use all the tricks to properly eliminate illegal access warnings #6195
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR attempts to tweak all of our uses of
setAccessiblefor accessing internal JDK classes to do the "right thing", be that using method handles,addOpens, or other tweaks to open up these classes if we legally can or fall back gracefully to degraded functionality without warnings.The general strategy is described in the first commit to FilenoUtil, but I summarize it again here:
Module.addOpensto make it really open, which then gives us a workable method handle and no warning output.Much of this is to deal with the unfortunate fact that our current check,
Module.isOpen, will always return true for the unnamed module but still warn when you set it accessible. This "kinda-sorta-open" state is a bug in my opinion, but at least explicitly usingaddOpenspromotes it to a fully-open state with no warnings.I will endeavor to eliminate all warnings in all modes with as little fallback as necessary.