JDK-8247375 : Remove default constructors from javax.net.ssl
  • Type: CSR
  • Component: security-libs
  • Sub-Component: javax.net.ssl
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 16
  • Submitted: 2020-06-10
  • Updated: 2020-06-11
  • Resolved: 2020-06-11
Related Reports
CSR :  
Description
Summary
-------

Add explicit no-arg constructors to several abstract classes in `javax.net.ssl` which implicitly use default constructors.

Problem
-------

Use of default constructors is not recommended for formal classes.

Solution
--------

Add explicit constructors.

Specification
-------------

    diff -r d9daa4ce8017 src/java.base/share/classes/javax/net/ssl/ExtendedSSLSession.java
    --- a/src/java.base/share/classes/javax/net/ssl/ExtendedSSLSession.java    Wed Jun 10 13:29:44 2020 -0700
    +++ b/src/java.base/share/classes/javax/net/ssl/ExtendedSSLSession.java    Wed Jun 10 15:56:57 2020 -0700
    @@ -35,6 +35,11 @@
      */
     public abstract class ExtendedSSLSession implements SSLSession {
         /**
    +     * Constructor for subclasses to call.
    +     */
    +    public ExtendedSSLSession() {}
    +
    +    /**
          * Obtains an array of supported signature algorithms that the local side
          * is willing to use.
          * <p>
    diff -r d9daa4ce8017 src/java.base/share/classes/javax/net/ssl/KeyManagerFactorySpi.java
    --- a/src/java.base/share/classes/javax/net/ssl/KeyManagerFactorySpi.java    Wed Jun 10 13:29:44 2020 -0700
    +++ b/src/java.base/share/classes/javax/net/ssl/KeyManagerFactorySpi.java    Wed Jun 10 15:56:57 2020 -0700
    @@ -41,6 +41,11 @@
      */
     public abstract class KeyManagerFactorySpi {
         /**
    +     * Constructor for subclasses to call.
    +     */
    +    public KeyManagerFactorySpi() {}
    +
    +    /**
          * Initializes this factory with a source of key material.
          *
          * @param ks the key store or null
    diff -r d9daa4ce8017 src/java.base/share/classes/javax/net/ssl/SSLContextSpi.java
    --- a/src/java.base/share/classes/javax/net/ssl/SSLContextSpi.java    Wed Jun 10 13:29:44 2020 -0700
    +++ b/src/java.base/share/classes/javax/net/ssl/SSLContextSpi.java    Wed Jun 10 15:56:57 2020 -0700
    @@ -40,6 +40,11 @@
      */
     public abstract class SSLContextSpi {
         /**
    +     * Constructor for subclasses to call.
    +     */
    +    public SSLContextSpi() {}
    +
    +    /**
          * Initializes this context.
          *
          * @param km the sources of authentication keys
    diff -r d9daa4ce8017 src/java.base/share/classes/javax/net/ssl/TrustManagerFactorySpi.java
    --- a/src/java.base/share/classes/javax/net/ssl/TrustManagerFactorySpi.java    Wed Jun 10 13:29:44 2020 -0700
    +++ b/src/java.base/share/classes/javax/net/ssl/TrustManagerFactorySpi.java    Wed Jun 10 15:56:57 2020 -0700
    @@ -41,6 +41,11 @@
      */
     public abstract class TrustManagerFactorySpi {
         /**
    +     * Constructor for subclasses to call.
    +     */
    +    public TrustManagerFactorySpi() {}
    +
    +    /**
          * Initializes this factory with a source of certificate
          * authorities and related trust material.
          *
    diff -r d9daa4ce8017 src/java.base/share/classes/javax/net/ssl/X509ExtendedTrustManager.java
    --- a/src/java.base/share/classes/javax/net/ssl/X509ExtendedTrustManager.java    Wed Jun 10 13:29:44 2020 -0700
    +++ b/src/java.base/share/classes/javax/net/ssl/X509ExtendedTrustManager.java    Wed Jun 10 15:56:57 2020 -0700
    @@ -55,6 +55,11 @@
      */
     public abstract class X509ExtendedTrustManager implements X509TrustManager {
         /**
    +     * Constructor for subclasses to call.
    +     */
    +    public X509ExtendedTrustManager() {}
    +
    +    /**
          * Given the partial or complete certificate chain provided by the
          * peer, build and validate the certificate path based on the
          * authentication type and ssl parameters.
Comments
Moving to Approved.
11-06-2020