Do not use the removed ZipFile.finalize(), Inflater.finalize() and Deflater.finalize() methods

The finalize methods in java.util.zip.ZipFile, java.util.zip.Inflater and java.util.zip.Deflater are no longer available in Java SE 12 and later. Previously, the java.util.ZipFile.finalize() method called the close method. You can close files by explicitly calling the close method or using try-with-resources. The java.util.Inflater.finalize() and java.util.Deflater.finalize() methods previously called the end method. You can explicitly call the end method to cleanup a compressor when it is no longer in use.

This rule has an automated fix. Copy the custom configuration to your application build file to enable the fix automation.

For more information on the removed methods, see APIs Removed in Java SE 12.

For more information on the replacement methods, see Class ZipFile documentation, Class Inflater documentation, and Class Deflater documentation.