Summary
Remove the deprecated finalize methods of FileInputStream and FIleOutputStream.
Problem
The finalize
methods of FileInputStream and FileOutputStream were deprecated for removal in JDK 9 and should be removed.
Solution
The finalize
methods are removed.
The java.lang.ref.Cleaner
has been implemented since JDK 9 as the primary mechanism to close FileDescriptors no longer reachable from FileInputStream and FileOutputStreams.
Previously, finalize
would call the close
method. The recommendation has been to explicitly call close
or use try-with-resources to close files.
With this change the FileInputStream or FileOutputStream close
method will no longer be called when a FileInputstream or FileOutputStream is found to be unreachable.
Specification
java.io.FileInputStream removes:
protected void finalize() throws IOException {}
java.io.FileOutputStream removes:
protected void finalize() throws IOException {}
- csr of
-
JDK-8192939 Remove Finalize methods from FileInputStream and FileOutputStream
-
- Resolved
-
- relates to
-
JDK-8187325 Relax FileInputStream/FileOutputStream requirement to use finalize
-
- Closed
-