[java] Fix #5283 - inner class has public private modifiers#5310
Merged
[java] Fix #5283 - inner class has public private modifiers#5310
Conversation
Generated by 🚫 Danger |
8be7658 to
97ac566
Compare
adangel
added a commit
that referenced
this pull request
Nov 22, 2024
adangel
added a commit
that referenced
this pull request
Nov 22, 2024
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.
Describe the PR
To summarize, the problem is that the scala 2.12 compiler emits an inner class with modifier
publicin its class file, andprivatein the InnerClasses structure of its outer class. This is still conformant to JVM spec as the InnerClasses structure is only there as metadata for the compiler, but isn't used by the VM at runtime, or verified. It is also a pattern that the javac compiler emits for eg protected inner classes.This PR fixes the modifier cleanup behavior to avoid having both public and private modifiers in the JClassSymbol.
Note that at least since version 3.5, scalac does not emit bytecode with this structure for private inner classes of interfaces. It emits a public modifier in both the class file and the InnerClasses structure.
Related issues
Ready?
./mvnw clean verifypasses (checked automatically by github actions)