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

(se) Clarify the behaviour of the non-abstract SelectorProvider::inheritedChannel

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 16
    • core-libs
    • None
    • behavioral
    • minimal
    • There is no compatibility issue as the change only adds the required implementation clarification to the existing method specs.
    • Java API
    • SE

      Summary

      Specify the default implementation of the non-abstract SelectorProvider::inheritedChannel method.

      Problem

      The non-abstract java.nio.channels.spi.SelectorProvider::inheritedChannel method does not specify its default implementation, thus requiring all implementers to provide their own implementation - even if that implementation is the same as the default. The current, and longstanding, behaviour is to return null.

      Solution

      Specify the default implementation returns null.

      Specification

      diff --git a/src/java.base/share/classes/java/nio/channels/spi/SelectorProvider.java b/src/java.base/share/classes/java/nio/channels/spi/SelectorProvider.java
      index 4aee1cf41c8..87ada1a15b2 100644
      --- a/src/java.base/share/classes/java/nio/channels/spi/SelectorProvider.java
      +++ b/src/java.base/share/classes/java/nio/channels/spi/SelectorProvider.java
      @@ -292,24 +292,27 @@ public abstract class SelectorProvider {
            * returned. Subsequent invocations of this method return the same
            * channel. </p>
            *
      +     * @implSpec The default implementation of this method returns
      +     * {@code null}.
      +     *
            * @return  The inherited channel, if any, otherwise {@code null}.
            *
            * @throws  IOException
            *          If an I/O error occurs
            *
            * @throws  SecurityException
            *          If a security manager has been installed and it denies
            *          {@link RuntimePermission}{@code ("inheritedChannel")}
            *
            * @since 1.5
            */
           public Channel inheritedChannel() throws IOException {
               return null;
           }

            fguallini Fernando Guallini
            amadgundi Asha Madgundi (Inactive)
            Brian Burkhalter, Chris Hegarty
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: