Fix IllegalAccessError analyzing Java compiled with --add-exports (#837)#1714
Merged
eed3si9n merged 2 commits intoJun 20, 2026
Merged
Conversation
This was referenced Jun 14, 2026
Contributor
Author
|
Follow up PR: jozanek#1 |
eed3si9n
reviewed
Jun 14, 2026
Contributor
Author
|
And here's phase 3: jozanek#2 P.S. I already signed CLA, feel free to rerun the last failing step in workflow. |
eed3si9n
reviewed
Jun 17, 2026
This was referenced Jun 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #837.
The crash is
ClassToAPIreflectively loading an inner class whose superclass is inaccessible (a module-internal type reached via--add-exports); theIllegalAccessErrorpropagated out and aborted the whole compile.ClassToAPI.loadInnerClassnow catchesIllegalAccessErroralongsideClassNotFoundException/NoClassDefFoundError, so an inner class that can't be linked in the analysis classloader is logged and skipped instead of crashing. Structural errors (VerifyError/ClassFormatError/…) are intentionally left to propagate as genuine classfile problems.JavaAnalyzeno longer silently drops a class that fails reflective loading: it records the product, member-ref dependencies, and direct inheritance dependencies (superclass + interfaces) for it, derived from the classfile. Canonical names are reconstructed from theInnerClassesattribute.module-info.classis explicitly excluded from that fallback (it is deliberately not analyzed as a class).Known limitation / follow-up
The un-loadable class still gets no
api.ClassLikerecorded (API extraction is reflection-based and the class can't be loaded), so name-hashing can miss dependents when that class's own public shape changes. Pre-existing and shared with theNoClassDefFoundErrorcase (sbt/sbt#117). The complete fix — classfile-based Java API extraction — would also resolve #151 and #1697 and is best done separately.