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

Refine return types in javax.net.ssl.SSLSocketFactory

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P3 P3
    • None
    • None
    • security-libs
    • None

      The SSLSocketFactory.getDefault() method is declared to return a SocketFactory, but it actually returns an SSLSocketFactory. Similarly, the SSLSocketFactory.createSocket(...) methods are declared to return Sockets, but they actually return SSLSockets.

      All these cases are inconvenient, forcing the user of these methods to cast the result to the subtype if they want access to the SSLSocketFactory-specific methods such as getDefaultCipherSuites(), or similarly for the various SSLSocket-specific methods.

      Consider changing the return types of these three methods to the more precise subtypes, so that casts are no longer required. This would be a binary-compatible change.

            wetmore Bradford Wetmore
            mr Mark Reinhold
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: