-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
8305157: The java.util.Arrays class should be declared final #13221
Conversation
/csr |
👋 Welcome back pminborg! A progress list of the required criteria for merging this PR into |
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.
Look fine, it can't be subclassed anyway so there is no compatibility impact.
I thought the change would trigger a change in the public API as the modifiers are changed for the class. This would likely be picked up by compatibility checks and so, a CSR would be needed? |
It's not a compatibility issue but a CSR is needed to track the change to the signature. |
Not that I disagree with this PR, but it would be interesting to see rationale for it in CSR. |
Would it make sense to throw an |
The CSR implies that java.util.Arrays has a non-private constructor but it does. |
It hardly seems worth the bytecode; the constructor could only be invoked by breaking in using reflection and the result would be an instance with no instance methods. |
In some future, one could mistakenly instantiate the class from some new method in the class itself. |
There are numerous examples in the JDK where we have the lone private constructor throw an exception to make sure the class isn't instantiated. |
@minborg 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 10 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
/integrate |
Going to push as commit 9df2060.
Your commit was automatically rebased without conflicts. |
Non-instantiable utility classes should be declared
final
and have a private constructors.See Effective Java, Third Edition, Joshua Bloch (for example, Item 19 or Item 22).
Progress
Issues
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/13221/head:pull/13221
$ git checkout pull/13221
Update a local copy of the PR:
$ git checkout pull/13221
$ git pull https://git.openjdk.org/jdk.git pull/13221/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 13221
View PR using the GUI difftool:
$ git pr show -t 13221
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/13221.diff