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

Add protected constructor java.net.ServerSocket(SocketImpl)

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 12
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      New constructor, no compatibility issue.
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      Add protected constructor java.net.ServerSocket(SocketImpl).

      Problem

      The constructor java.net.ServerSocket(SocketImpl) currently has package private access. This is asymmetric with the corresponding constructor in java.net.Socket which is protected. This prevents analogous uses of ServerSocket. One such use which is a motivation for this change is in the proposed rsockets addition to jdk.net.

      Solution

      Change access from package private to protected and update the specification appropriately.

      Specification

      --- a/src/java.base/share/classes/java/net/ServerSocket.java
      +++ b/src/java.base/share/classes/java/net/ServerSocket.java
      @@ -76,10 +76,16 @@
           private boolean oldImpl = false;
      
           /**
      -     * Package-private constructor to create a ServerSocket associated with
      -     * the given SocketImpl.
      +     * Creates a server socket with a user-specified {@code SocketImpl}.
      +     *
      +     * @param      impl an instance of a SocketImpl to use on the ServerSocket.
      +     *
      +     * @throws     NullPointerException if impl is {@code null}.
      +     *
      +     * @since 12
            */
      -    ServerSocket(SocketImpl impl) {}
      +    protected ServerSocket(SocketImpl impl) {}

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bpb Brian Burkhalter
                Reporter:
                bpb Brian Burkhalter
                Reviewed By:
                Alan Bateman, Chris Hegarty, Roger Riggs
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: