On Thu, 4 May 2023 06:49:10 GMT, David Holmes <dhol...@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