Time to retire System.runFinalizersOnExit?

Alan Bateman Alan.Bateman at oracle.com
Wed Jan 28 15:07:33 UTC 2015


On 27/01/2015 04:37, Mandy Chung wrote:
> System.runFinalizationOnExit has been deprecated since 1998 (JDK 1.2)
> and this method is inherently unsafe.  I am thinking to propose this 
> method
> in JDK 9 to throw UnsupportedOperationException.
>
> I believe it's rare for existing applications using 
> System.runFinalizationOnExit.
> My analysis on Maven Central ~315K artifacts that show about ~15 unique
> artifacts calling System.runFinalizationOnExit while they all come from
> only 5 classes.
>
> Any thought/feedback?
It's broken in other ways beyond what is in the @deprecated note so I 
don't think it's much of a loss to finally disable it. I don't know if 
you have come up with candidate wording to replace the existing wording 
but having it reference the shutdown hooks and the ref API might be useful.

-Alan



More information about the core-libs-dev mailing list