RFR: 8253119: Remove the legacy PlainSocketImpl and PlainDatagramSocketImpl implementation

Alan Bateman alanb at openjdk.java.net
Wed Jun 23 12:21:26 UTC 2021


On Wed, 23 Jun 2021 12:06:41 GMT, Patrick Concannon <pconcannon at openjdk.org> wrote:

> Hi,
> 
> Could someone please review my changes for the removal of the legacy `PlainSocketImpl` and `PlainDatagramSocketImpl` implementations?
> 
> In JDK 13, JEP 353 provided a drop in replacement for the legacy `PlainSocketImpl` implementation. Since JDK 13, the `PlainSocketImpl` implementation was no longer used but included a mitigation mechanism to reduce compatibility risks in the form of a JDK-specific property `jdk.net.usePlainSocketImpl` allowing to switch back to the old implementation. 
> Similarly, in JDK 15, JEP 373 provided a new implementation for `DatagramSocket` and `MulticastSocket`, with a JDK-specific property `jdk.net.usePlainDatagramSocketImpl` also allowing the user to switch back to the old implementation in case of compatibility issue.
> 
> As these implementations (and the mechanisms they use to enable them to mitigate compatibility issues) have been deemed no longer necessary, they now represent a maintenance burden. This patch looks at removing them from the JDK.
> 
> Kind regards,
> Patrick

Good cleanup, just a few nits in the changes to the NioSocketImpl impl, I didn't spot any other issues.

src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java line 69:

> 67:  * This implementation attempts to be compatible with legacy PlainSocketImpl
> 68:  * (removed in JDK18), including behavior and exceptions that are not specified by
> 69:  * SocketImpl.

Maybe we should just drop this sentence and not attempt to replace it.

src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java line 647:

> 645:             // set the address field to the given host address to keep
> 646:             // compatibility with SocketImpl. When binding to 0.0.0.0
> 647:             // then the actual local address will be ::0 when IPv6 is enabled.

I don't think "SocketImpl" works here. Maybe replace "keep compatibility with PlainSocketImpl" with "to maintain long standing behavior".

-------------

PR: https://git.openjdk.java.net/jdk/pull/4574


More information about the nio-dev mailing list