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

(fc) FileChannel::map for MemorySegments should state it always throws UOE

    XMLWordPrintable

Details

    • CSR
    • Resolution: Approved
    • P4
    • 19
    • core-libs
    • None
    • behavioral
    • minimal
    • The change merely clarifies existing behavior.
    • Java API
    • SE

    Description

      Summary

      Add an @implSpec annotation to the method

      java.nio.channels.FileChannel.map(FileChannel.MapMode,long,long,MemorySession)

      for creating mapped memory segments indicating that it always throw an UnsupportedOperationException.

      Problem

      FileChannel.map() for mapped memory segments always throws UnsupportedOperationException but this is not explicitly stated.

      Solution

      Add an @implSpec annotation to the method which states that an UnsupportedOperationException is always thrown.

      Specification

      --- a/src/java.base/share/classes/java/nio/channels/FileChannel.java
      +++ b/src/java.base/share/classes/java/nio/channels/FileChannel.java
      @@ -997,6 +997,9 @@ public abstract class FileChannel
            *           of mapped memory associated with the returned mapped memory
            *           segment is unspecified and should not be relied upon.
            *
      +     * @implSpec The default implementation of this method throws
      +     *           {@code UnsupportedOperationException}.
      +     *
            * @param   mode
            *          The file mapping mode, see
            *          {@link FileChannel#map(FileChannel.MapMode, long, long)};

      Attachments

        Issue Links

          Activity

            People

              bpb Brian Burkhalter
              bpb Brian Burkhalter
              Alan Bateman
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: