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

(bf) DirectByteBuffer extends MappedByteBuffer, confuses instanceof tests

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 11
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b01
    • Verification:
      Verified

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: