RFR 9: 8165641 : Deprecate Object.finalize

Kim Barrett kim.barrett at oracle.com
Mon Mar 13 19:25:09 UTC 2017

> On Mar 11, 2017, at 1:56 PM, Hans Boehm <hboehm at google.com> wrote:
> Stepping back, I'm a little surprised at the deprecation. In my opinion,
> the problems with finalizers are, in rough order of significance:

I think an important difference between finalize and other
j.l.r.Reference-based cleanups that hasn't been mentioned is that
finalization is not cancellable. If one creates creates a finalizable
object and explicitly "closes" it when done with it, there is no way
to avoid the later finalization processing that will ultimately be a
very expensive nop.  For an example of this problem, see
Extending finalization as suggested there seems to me to be feature
creep on a facility that we already heavily denigrate and would prefer
didn't exist.

More information about the core-libs-dev mailing list