On Fri, 5 May 2023 07:42:17 GMT, Afshin Zafari <d...@openjdk.org> wrote:
>> 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(). > >> To solve the duplicated registerCleanup() cases, the two other classes could >> extend FinalizableObject then inherit its implementation of >> registerCleanup(). > > The other two cases already extend the `Log.Logger` and cannot extend > `FinalizableObject`. I though default methods were bad design just like default parameters. maybe not. I didn’t think yours would compile either but I guess it does. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13420#discussion_r1186130453