The finalize() method has been removed from
java.util.concurrent.ThreadPoolExecutor.
ThreadPoolExecutor.finalize() was deprecated in JDK
9 as part of deprecating finalization for removal JEP 421. The method was
re-specified in JDK 11 to "do nothing" and deprecated for removal
in JDK 18.
The removal of this method means that any existing code that
extends ThreadPoolExecutor and overrides
finalize() to call super.finalize() (or
calls finalize() directly) will now call
Object.finalize(). This code may no longer compile as
Object.finalize() throws Throwable
whereas the removed ThreadPoolExecutor.finalize() did
not declare any checked exceptions. Developers are strongly
encouraged to stop using finalization but if necessary, the source
compatibility issue can be worked around using a
try-catch.