RFR: 8371748: Remove the (empty) ThreadPoolExecutor.finalize() method
Jaikiran Pai
jpai at openjdk.org
Fri Nov 14 10:01:25 UTC 2025
On Thu, 13 Nov 2025 23:10:59 GMT, Brent Christian <bchristi at openjdk.org> wrote:
> From the bug report:
> Prior to JDK 11, ThreadPoolExecutor.finalize() was specified to
> "[invoke] shutdown() when this executor is no longer referenced and it has no threads."
>
> In JDK 11, ThreadPoolExecutor.finalize() was re-specified to do nothing, leaving the finalize() method empty. ([JDK-8190324](https://bugs.openjdk.org/browse/JDK-8190324)).
>
> In JDK 18, finalize() was deprecated for removal ([JDK-8276447](https://bugs.openjdk.org/browse/JDK-8276447)), after first being "standard" deprecated in JDK 9 ([JDK-8165641](https://bugs.openjdk.org/browse/JDK-8165641)).
>
> The finalize() method can safely be removed from ThreadPoolExecutor.
Marked as reviewed by jpai (Reviewer).
The failures in the GitHub actions job appear related:
/home/runner/work/jdk/jdk/test/jdk/java/util/concurrent/tck/ThreadPoolExecutorSubclassTest.java:2011: error: unreported exception Throwable; must be caught or declared to be thrown
super.finalize();
^
-------------
PR Review: https://git.openjdk.org/jdk/pull/28311#pullrequestreview-3464063996
PR Comment: https://git.openjdk.org/jdk/pull/28311#issuecomment-3531920120
More information about the core-libs-dev
mailing list