JDK-8278430 : Several tests use terminally deprecated System.runFinalization method
  • Type: Bug
  • Component: javafx
  • Sub-Component: other
  • Affected Version: openjfx18
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-12-08
  • Updated: 2022-04-26
  • Resolved: 2022-04-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
openjfx19Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
The System.runFinalization and Runtime.runFinalization methods are terminally deprecated by JEP 421 (JDK-8274609). Several JavaFX tests call System.runFinalization method when testing for memory leaks.

To see this, run the following:

$ gradle --info -PLINT=removal test

See the attached log file for the list of calls to runFinalization.
Comments
Changeset: 166d5c2f Author: Hima Bindu Meda <hmeda@openjdk.org> Committer: Kevin Rushforth <kcr@openjdk.org> Date: 2022-04-22 17:47:23 +0000 URL: https://git.openjdk.java.net/jfx/commit/166d5c2f248aec2117c0023194bfe480bf110eb5
22-04-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jfx/pull/781 Date: 2022-04-21 15:03:04 +0000
21-04-2022

Eventually, we need to remove all calls to runFinalization. It is likely that many, perhaps most, of these calls can be safely removed now without making the tests more unstable. However, it is possible that some of the tests are checking objects outside JavaFX (e.g., in Swing or AWT) that still override the finalize method and won't be reclaimed until finalize is called. We need to both examine the tests to see whether such is likely, and then run the test in a loop many times before we consider removing the calls. For those calls we don't remove, we need to add a `SuppressWarnings` annotation.
08-12-2021