Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8222546

Drop support for pre JDK 1.4 SocketImpl implementations

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 13
    • core-libs
    • None
    • behavioral
    • low
    • Hide
      Only SocketImpls which have been compiled on JDK 1.3 or older could be affected by this. In that case, java.net.Socket connections will fail with an AbstractMethodError, because the abstract connect() method added in 1.4 will not be implemented. The risk is considered to be low because SocketImpl is a poorly specified API and it is thought unlikely that there are many implementations and even fewer that have not been compiled since 1.3.
      Show
      Only SocketImpls which have been compiled on JDK 1.3 or older could be affected by this. In that case, java.net.Socket connections will fail with an AbstractMethodError, because the abstract connect() method added in 1.4 will not be implemented. The risk is considered to be low because SocketImpl is a poorly specified API and it is thought unlikely that there are many implementations and even fewer that have not been compiled since 1.3.
    • Java API
    • Implementation

      Summary

      Drop support for java.net.SocketImpl implementations written prior to Java 1.4 which do not have the abstract timed connect method added in Java 1.4. There is no evidence that any such implementations still exist. Such implementations, if there are any, will not even compile with Java 1.4, or greater.

      Problem

      We wish to resolve technical debt associated with java.net Socket/ServerSocket in a few different areas. In this case, there is code which attempts to allow the public void connect(SocketAddress endpoint, int timeout) to operate in a limited fashion with SocketImpls that do not support the corresponding method. java.net.Socket currently uses reflection to check if the SocketImpl provided has implemented the timed connect method, and if it doesn't, then it is able to emulate the timed connect in the fully blocking case only. For other timed connects, UOE is thrown.

      Solution

      The solution is simply to remove the check for old impls, and the special casing that results from when an old impl is found.

      Specification

      This is binary incompatible insofar as a SocketImpl compiled with Java 1.3, or earlier, and which does not have an implementation of the public abstract void connect(SocketAddress,int) method ( introduced in Java 1.4 ), would function in some limited way with later releases, but now will not function at all. This is a behavior change only. There is no specification change.

      We wish to also make a small non normative change to apidoc. The existing (undocumented) no-arg constructor for java.net.SocketImpl will have the following text added:

         /**
           * Initialize a new instance of this class
           */
          public SocketImpl()

            michaelm Michael McMahon
            alanb Alan Bateman
            Alan Bateman, Chris Hegarty
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: