RFR: 8305083: Remove finalize() from test/hotspot/jtreg/vmTestbase/nsk/share/ and /jpda that are used in serviceability/dcmd/framework tests
Coleen Phillimore
coleenp at openjdk.org
Thu Apr 13 20:35:03 UTC 2023
On Tue, 11 Apr 2023 08:16:29 GMT, Afshin Zafari <duke at openjdk.org> wrote:
> The `finalize()` method is removed from base classes/interfaces and are replaced by a Cleaner callback..
Another change that has turned into something much bigger. This cleanup is worth doing. Possible steps are (not in order and not in one push):
1. It seems like FinalizerObject should be removed in favor of classes that implement interface Finalizable and are forced to implement finalizeAtExit, so the Finalize thread can call the function on all the objects that get registered to it. Not sure if this mechanism is useful or not. Maybe it should be removed. If the process exits, are these connections closed?
2. If this mechanism is needed, rename Finalizer, FinalizerThread and Finalizable (ugh) to TestCleaner{Thread}. Cleanable with cleanAtExit, and rewrite/remove all references to these in the comments. Or just delete this (better?)
3. Fix remaining comments and especially all the typos.
4. This patch removes the classes that have registered finalize methods in favor of the cleaner mechanism, which looks good to me. These appear to be cases where some connection needs to be closed, or something like that.
It seems to me that step 1 should be done then 4 as in this patch, leaving 2 and 3 to further cleanups and RFEs. Looks like we've uncovered a mess. The purpose of these changes are to remove the dependence on finalizer() with their associated warnings.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/13420#issuecomment-1507574587
More information about the serviceability-dev
mailing list