On Tue, 9 May 2023 09:12:51 GMT, Afshin Zafari <d...@openjdk.org> wrote:

> This PR is continuation of https://github.com/openjdk/jdk/pull/13420 which 
> was far behind the master.

reply to @dholmes-ora comment:
> I think a better design for the classes that can't extend FinalizableObject 
> would be for them to contain a FinalizableObject, the cleanup action for 
> which would cleanup the host object. That could allow the removal of the 
> Finalizable interface and simplify the general usage patterns. But that may 
> be going too far for this particular PR ... ?

We still need the `Finalizable` interface to call the `cleanup` of the host 
object:

class FinalizableObject implements Finalizable { 
 public void registerCleanupForObject(Finalizable obj) { 
  Cleaner.create().register(obj, obj->cleanup()); 
}

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

PR Comment: https://git.openjdk.org/jdk/pull/13884#issuecomment-1539796995

Reply via email to