classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More finalize woes


From: Tom Tromey
Subject: Re: More finalize woes
Date: 06 Mar 2003 08:44:53 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

>>>>> "Chris" == Chris Gray <address@hidden> writes:

Chris> I think the main problem lies elsewhere. If you subclass a
Chris> class which has a finalizer and your subclass needs to do some
Chris> finalization of its own, then your finalizer needs to contain a
Chris> call to super.finalize(). If the published API doesn't show a
Chris> finalizer then you wouldn't include this statement.

But that in itself is a bug.  Binary compatibility rules allow a class
implementor to add a finalize method at any time in the future.  For
this reason, all finalizers should call super.finalize().  In fact, if
we add an empty finalize method, then that is a potential (if
unlikely) bug -- if we ever add a finalizer in a superclass, oops.

This doesn't mean that people don't do it, I guess.

Tom




reply via email to

[Prev in Thread] Current Thread [Next in Thread]