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

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

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • None
    • core-libs
    • Cause Known
    • 19
    • generic
    • generic

      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).

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

              Created:
              Updated: