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

(fc) FileChannel#map should document behavior when using custom file systems

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Understanding:
      Cause Known
    • Introduced In Version:
      19
    • CPU:
      generic
    • OS:
      generic

      Description

      While reviewing FileChannel#map API after merging the Panama Foreign I noticed some inconsistencies between implementation and documentation:

      The new method returning MemorySegment, which was added to FileChannel class couldn't be made abstract (backwards compatibility). Therefore the default implementation is just throwing UnsupportedOperationException.

      In the documentation it says:
           * @throws UnsupportedOperationException
           * If an unsupported map mode is specified.

      This statement is incomplete, because it also throws this exception when a custom FileSystem implementation returns a FileChannel implementation that does not implement that method.

      For the already existing abstract method, the same statement is given, but I'd suggest to change the spec here, too, so a custom FileSystem implementation that does not support mmap could implement the abstract method also with UnsupportedOperationException. I think jrtfs does this (not checked).

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bpb Brian Burkhalter
              Reporter:
              uschindler Uwe Schindler
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated: