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

Add protected constructor java.net.ServerSocket(SocketImpl)

    XMLWordPrintable

Details

    • CSR
    • Status: Closed
    • P4
    • Resolution: Approved
    • 12
    • core-libs
    • None
    • minimal
    • New constructor, no compatibility issue.
    • Java API
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: