RFR: 8305083: Remove finalize() from test/hotspot/jtreg/vmTestbase/nsk/share/ and /jpda that are used in serviceability/dcmd/framework tests [v2]

Coleen Phillimore coleenp at openjdk.org
Thu May 4 18:00:17 UTC 2023


On Thu, 4 May 2023 06:49:10 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> After I moved the `registerCleanup` to the body of a `default` method in the interface, there is no need for the implementors of the `Finalizable` interface to provide this method. All of them can use the default one.
>
>> All of them can use the default one
> 
> Exactly my point.

Default methods for interface classes were invented to solve a problem of compatibility if I remember correctly.  Forcing subclasses to implement the interface method or have a superclass of the subclass to implement the interface method seems like it avoids the problem of silently not registering the cleanup or action that the interface method should force you to do.  To solve the duplicated registerCleanup() cases, the two other classes could extend FinalizableObject then inherit its implementation of registerCleanup().

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13420#discussion_r1185337107


More information about the serviceability-dev mailing list