8344943: Mark not subclassable classes final in java.base exported classes#22389
8344943: Mark not subclassable classes final in java.base exported classes#22389eirbjo wants to merge 8 commits intoopenjdk:masterfrom
Conversation
|
👋 Welcome back eirbjo! A progress list of the required criteria for merging this PR into |
|
@eirbjo 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 14 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. ➡️ To integrate this PR with the above commit message to the |
| * {@code invokedynamic} call site. | ||
| * | ||
| * <p>Concrete subtypes of {@linkplain DynamicCallSiteDesc} should be immutable | ||
| * and their behavior should not rely on object identity. |
There was a problem hiding this comment.
Please reword this to something like:
{@code DynamicCallSiteDesc} is immutable and its behavior does not rely on object identity.
This is given in ConstantDesc, but DynamicCallSiteDesc does not extend ConstantDesc so the removal is dubious.
There was a problem hiding this comment.
Thanks, I've updated the PR and CSR to retain the note about immutability and object identity, removing the reference to subtypes:
This class is immutable and its behavior does not rely on object identity
I opted to replace the self-reference {@code DynamicCallSiteDesc} with just "This class" here. Let me know if you prefer spelling out the class name.
…y reference to subtypes
src/java.base/share/classes/java/lang/module/ModuleDescriptor.java
Outdated
Show resolved
Hide resolved
| * | ||
| * <p>Concrete subtypes of {@linkplain DynamicCallSiteDesc} should be immutable | ||
| * and their behavior should not rely on object identity. | ||
| * <p>This class is immutable and its behavior does not rely on object identity |
There was a problem hiding this comment.
| * <p>This class is immutable and its behavior does not rely on object identity | |
| * <p>A {@code DynamicCallSiteDesc} is immutable and its behavior does not | |
| * rely on object identity. |
This describes an object, not a class, and please close sentences with a period.
(We use fragments for param and return block tags instead)
…bject instances instead of the class.
…or the CSR review
|
Following some offline discussion with @liach, we decided to leave out the constructor access updates in These changes may be revisited in this PR pending CSR approval, or can be addressed in follow-up PRs. |
|
Now that the CSR for this change is "final-ly" approved, I'm marking this PR ready for review. Since the CSR approval, the PR has merged with a recent master and the copyright headers are updated for 2025. |
Webrevs
|
djelinski
left a comment
There was a problem hiding this comment.
LGTM, the class changes are pretty trivial.
I suppose the CheckCSMs test could be cleaned up a little (will we ever need KNOWN_NON_FINAL_CSMS again?), but that can be done in a separate PR.
|
@bradfordwetmore @wangweij please review the change to |
|
The |
|
Thanks everyone for your patient reviews in this PR. I'll integrate this now. /integrate |
|
Going to push as commit 8e8f800.
Your commit was automatically rebased without conflicts. |
Please review this PR which adds the
finalmodifier to non-subclassable classes injava.base.The classes were identified using an automated analysis. See CSR for details.
Besides simply adding the
finalaccess modifier, the PR:java.lang.constant.DynamicCallSiteDescto not reference subtypes. See CSR for discussion.java.lang.Runtimefrom the testtest/jdk/jdk/internal/reflect/CallerSensitive/CheckCSMs.javaProgress
Issues
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/22389/head:pull/22389$ git checkout pull/22389Update a local copy of the PR:
$ git checkout pull/22389$ git pull https://git.openjdk.org/jdk.git pull/22389/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 22389View PR using the GUI difftool:
$ git pr show -t 22389Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/22389.diff
Using Webrev
Link to Webrev Comment