JDK-8371856 : Remove the (empty) ThreadPoolExecutor.finalize() method
  • Type: CSR
  • Component: core-libs
  • Sub-Component: java.util.concurrent
  • Priority: P4
  • Status: Finalized
  • Resolution: Unresolved
  • Fix Versions: 26
  • Submitted: 2025-11-13
  • Updated: 2025-11-21
Related Reports
CSR :  
Description
Summary
-------
`ThreadPoolExecutor.finalize()` was (re)specified to do nothing in JDK 11. All finalize methods (along with the finalization mechanism itself) were [deprecated for removal][1] with JEP 421 in JDK 18.

Problem
-------
The vestigial `ThreadPoolExecutor.finalize()` method serves no purpose, and recently caused a minor annoyance in test code ([JDK-8371682][2]).

Solution
--------
The finalizer in `ThreadPoolExecutor` should be removed.

There is a small risk that there are existing subclasses of `ThreadPoolExecutor` that override `finalize()` to call `super.finalize()`. Such classes would no longer compile (due to the mismatch between `Object.finalize()` throwing `Throwable`, and `ThreadPoolExecutor.finalize()` not throwing an exception). A Corpus search did not find any such subclass.


Specification
-------------
The spec change is best viewed in the attached specdiff, as the method spec is generated from verbiage inherited from `Object.finalize()`, plus local `@implNote`.


  [1]: https://bugs.openjdk.org/browse/JDK-8276447
  [2]: https://bugs.openjdk.org/browse/JDK-8371682
Comments
As a sanity check, I also searched for just: java/util/concurrent/ThreadPoolExecutor That turned up quite a few subclasses (8,699). As far as I can tell from these searches, none of them touch `finalize()`, which is good.
21-11-2025

Assuming the search is correct and 0 usages were found then it helps with the confidence that the source compatibility issue won't be a problem. The source compatibility issue can be documented in the release note.
21-11-2025

My corpus search found 0 Method Overrides and 0 direct Method Invocations for the pattern: java/util/concurrent/ThreadPoolExecutor.finalize
21-11-2025

Moving to Provisional, not Approved. [~bchristi], I agree with the PR comments that it is prudent to do a corpus search here given the risk of breaking source compatibility.
19-11-2025

Moving to Approved.
14-11-2025