Quality Outreach Heads-up - JDK 18: JEP 421David Delabassee on January 31, 2022
The OpenJDK Quality Group promotes the testing of FOSS projects with OpenJDK builds as a way to improve the overall quality of the release. This heads-up is part of a regular communication sent to the projects involved. To learn more about the program, and how-to join, please check here.
JEP 421 - Deprecate Finalization for Removal
Finalization is an outdated and brittle resource cleaning mechanism present in the platform since the early days of the Java platform. Its use has been discouraged for quite some time in favor of better alternatives (i.e., ‘try with resources’ and Cleaners). In JDK 18, the finalization behavior doesn’t change but JEP 421 introduces a flag to explicitly disable finalization. It could be used to investigate if a codebase is still using finalization. Moreover, a new
JFR jdk.FinalizerStatistics event is also introduced in JDK 18.
Call to Action
We encourage developers to investigate if their codebase still rely on finalization. If so, they should start to think about replacing finalizers with better alternatives, i.e., ‘try with resources’ or Cleaners.