RFR 9: 8165641 : Deprecate Object.finalize

Roger Riggs Roger.Riggs at Oracle.com
Mon Mar 13 13:32:24 UTC 2017


A reasonably complete treatment of finalizers and suggestions for correct
use are in Josh Bloch' Effective Java.  It may be a bit dated but is a 
good start for the casual reader.

Josh provided an excerpt:

There is a lot more to do to design better APIs and mechanisms for the most
difficult cases.  Project Panama is working on some of them and more 
than a few
ideas are being developed (as noted in earlier emails).


On 3/13/2017 9:07 AM, Doug Lea wrote:
> On 03/12/2017 07:55 PM, Hans Boehm wrote:
>> But I think we agree that it doesn't matter for this discussion; 
>> neither of
>> these problems are addressed by deprecating finalizers. 
>> PhantomReferences
>> have exactly the same issues. ...
> The motivation seems more along the lines of "denigration" vs
> deprecation. But even if so, I agree with Hans's implicit claim that
> it might be better to thoroughly document all the issues encountered
> when using finalization and/or PhantomReferences and/or cleaners, etc.
> This coverage will necessarily convey the high expertise required to
> implement and use them effectively, and to not use them otherwise.
> Currently no single authoritative account exists, so a lot of
> errors are due to confusion or ignorance. Doing better would seem
> to be the highest priority. But maybe adding deprecation warnings
> on top of this will have some beneficial effect. So, like Hans,
> I'm not completely opposed to this, but not excited either.
> -Doug

More information about the core-libs-dev mailing list