Time to retire System.runFinalizersOnExit?

Volker Simonis volker.simonis at gmail.com
Wed Jan 28 15:28:13 UTC 2015

I understand that the benefits of calling System.runFinalizersOnExit()
may be questionable and I don’t have any objections to remove it in
Java 9. But I'm strongly against changing it to throw an
UnsupportedOperationException and downport that change to Java 8. In
my eyes that’s really a no-go.

I've quickly scanned our SAP-internal Java repositories and found
several occurrences of System.runFinalizersOnExit() altough most of
them seem to be in testing/example code. It's perfectly fine if that
code won't run out of the box in Java 9.

But it will be totally unacceptable if a product which has been
certified and runs on Java 8 will suddenly fail with an
UnsupportedOperationException just because of a new Java 8 update.


On Wed, Jan 28, 2015 at 3:14 PM, Paul Sandoz <paul.sandoz at oracle.com> wrote:
> On Jan 27, 2015, at 5:37 AM, Mandy Chung <mandy.chung at oracle.com> 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?
> If we do decide to do something perhaps we should remove it from 9 and back port the USO in 8? Why keep it around if it's been deprecated for over 10 years and from your analysis it's used by 0.005% of maven artifacts.
> Paul.

More information about the core-libs-dev mailing list