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

(bf) DirectByteBuffer extends MappedByteBuffer, confuses instanceof tests

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 11
    • None
    • core-libs
    • b01
    • Verified

      A long standing implementation detail is that direct ByteBuffers extend MappedByteBuffer. Now consider:

      if (bb instance MappedByteBuffer) {
          ((MappedByteBuffer)bb).force();
      }

      This throws UOE, as does isLoaded and the other methods defined by MappedByteBuffer.

      A simple solution may be force/load/etc. to be no-ops when invoked without a backing file.

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

              Created:
              Updated:
              Resolved: