(bf) DirectByteBuffer extends MappedByteBuffer, confuses instanceof tests

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 11
    • Affects Version/s: None
    • Component/s: 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.

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

              Created:
              Updated:
              Resolved: