-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
8338981: Access to private classes should be permitted inside the permits clause of the enclosing top-level class #20718
8338981: Access to private classes should be permitted inside the permits clause of the enclosing top-level class #20718
Conversation
👋 Welcome back Evemose! A progress list of the required criteria for merging this PR into |
@Evemose This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 156 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@vicente-romero-oracle, @lahodaj, @mcimadamore) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
Webrevs
|
Others may have a different opinion, but this seems a bit too hacky to me (given we would need to maintain this for a long time). I would suggest to try to add a new flag into |
Honestly, I agree with you, I just didnt know how much invasive changes to existing code could be. I will look into AttrContext later today |
I have decided to write tests before reworking fix. Could you please suggest where could i put it? I have found tools/javac/diags/examples folder, but it seems to only contain negative tests, while I need positive ones. Is there any suitable place for this kind of thing? |
most tests for sealed classes are under: |
@lahodaj could you review please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this change needs more test cases so that we can be sure that we are testing most of the possible combinations
I have tried to imagine some test cases where something could go wrong. Not really sure how to verify everything concidering the fact that permits is the last clause before attributing class code, which is allowed to access any private members, but I added some test cases veryfying everything from a different angles |
If this fix is proposing to align javac behavior with the JLS, while no spec change would be needed. A CSR would need to be filed for the behavioral change. |
Hello! I am not familiar with CSR process. I tried to find a way to file it using java bug database, but could not find anything. Could you tell me what should I do and where, please? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, I think this is good. Left some comments to make the test and style similar to what is generally used in javac, at least in my opinion. Thanks for doing this change!
test/langtools/tools/javac/sealed/PrivateMembersInPermitClause.java
Outdated
Show resolved
Hide resolved
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
Outdated
Show resolved
Hide resolved
test/langtools/tools/javac/sealed/PrivateMembersInPermitClause.java
Outdated
Show resolved
Hide resolved
test/langtools/tools/javac/sealed/PrivateMembersInPermitClause.java
Outdated
Show resolved
Hide resolved
In JBS, in the bug, there is "More", and if you click on that, there is "Create CSR". Click on that, and fill in the details in the text, as described in the template. When reviewing, I'll try to fill any flags that need to be filled (so that you know what gets filled next time). |
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/AttrContext.java
Show resolved
Hide resolved
src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java
Outdated
Show resolved
Hide resolved
src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
Outdated
Show resolved
Hide resolved
test/langtools/tools/javac/sealed/PrivateMembersInPermitClause.java
Outdated
Show resolved
Hide resolved
test/langtools/tools/javac/sealed/PrivateMembersInPermitClause.java
Outdated
Show resolved
Hide resolved
…bers' into selaed-permits-allow-private-members
By the way, does anyone know why ci fails? It fails on generate report, not on tests. I tried to sync branch with master but it seems like it has not had any affect |
@Evemose I was waiting for the results of the tests after your last change, all green, we are good to go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
/integrate |
Glad we are finally done with this one. Got a bit busy lately, pr could`ve taken much less time, thanks for your patience. Would you mind sponsoring? |
/sponsor |
thanks to you! |
Going to push as commit b269493.
Your commit was automatically rebased without conflicts. |
@vicente-romero-oracle @Evemose Pushed as commit b269493. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Fix involves adding new flag to after context that indicates that currently resolved symbol is in permits clause
Progress
Issues
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/20718/head:pull/20718
$ git checkout pull/20718
Update a local copy of the PR:
$ git checkout pull/20718
$ git pull https://git.openjdk.org/jdk.git pull/20718/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 20718
View PR using the GUI difftool:
$ git pr show -t 20718
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/20718.diff
Using Webrev
Link to Webrev Comment