RFR: 8344943: Mark not subclassable classes final in java.base exported classes

Eirik Bjørsnøs eirbjo at openjdk.org
Thu Jan 16 20:42:52 UTC 2025


Please review this PR which adds the `final` modifier to non-subclassable classes in `java.base`.

The classes were identified using an automated analysis. See CSR for details.

Besides simply adding the `final` access modifier, the PR:

* Updates a note in `java.lang.constant.DynamicCallSiteDesc` to not reference subtypes. See CSR for discussion.
* Removes the class `java.lang.Runtime` from the test `test/jdk/jdk/internal/reflect/CallerSensitive/CheckCSMs.java`
* Updates the copyright year of affected source files

-------------

Commit messages:
 - Merge branch 'master' into non-subclassable-final
 - Update copyright years
 - Runtime class is marked final, remove it from the CheckCSMs test
 - Leave out the constructor access for now since the are not relevant for the CSR review
 - Reword note about immutability and object immutability to reference object instances instead of the class.
 - Resurrect note about immutability and object identity, but without any reference to subtypes
 - Mark non-subclassable classes in 'java.base' final

Changes: https://git.openjdk.org/jdk/pull/22389/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=22389&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8344943
  Stats: 35 lines in 22 files changed: 0 ins; 3 del; 32 mod
  Patch: https://git.openjdk.org/jdk/pull/22389.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/22389/head:pull/22389

PR: https://git.openjdk.org/jdk/pull/22389


More information about the net-dev mailing list