JDK-8263905 : Remove finalize methods for SocketInput/OutputStream
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 17
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-03-21
  • Updated: 2021-03-29
  • Resolved: 2021-03-23
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.
JDK 17
17 b15Fixed
Related Reports
Relates :  
Description
Object.finalize has been deprecated and uses should be removed or converted.

The classes java.net.SocketInputStream and java.net.SocketOutputStream have empty finalize methods.  These methods exist to override and cancel the finalize methods of their base classes (java.io.FileInputStream and java.io.FileOutputStream, respectively).  However, those classes no longer have finalize methods (JDK-8192939, JDK 12).  As a result, the socket stream finalize methods no longer serve any purpose and can be removed.

Comments
Changeset: 47ef0389 Author: Kim Barrett <kbarrett@openjdk.org> Date: 2021-03-23 20:54:23 +0000 URL: https://git.openjdk.java.net/jdk/commit/47ef0389
23-03-2021

The non-public java.net.SocketInputStream and java.net.SocketOutputStream are part of the legacy PlainSocketImpl that has not been used (by default) since JDK 13. The tentative plan is to remove PlainSocketImpl (including java.net.SIS and SOS) soon after the fork for JDK 17. No issue removing the empty finalize methods from these classes before then.
21-03-2021