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

(bf) XBuffer.put(Xbuffer src) can give unexpected result when storage overlaps

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 15
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      No code compatibility risk as this is only a specification clarification.
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      Update the specification of the relative bulk put methods defined by the Buffer classes in java.nio so that they specify the expected behavior when the backing array or memory of the source and destination buffers overlaps.

      Problem

      There is presently no description of the behavior expected when the method $TypeBuffer.put($TypeBuffer) is invoked with a buffer whose backing array or memory overlaps that of the buffer on which the method is invoked. The template placeholder $Type is one of {Byte, Char, Short, Int, Long, Float, Double} and is the same for both the destination buffer object and its source parameter.

      Solution

      Add a sentence describing the behavior expected when the backing array or memory of the parameter of $TypeBuffer.put($TypeBuffer) overlaps that of the target buffer.

      Specification

      Append this sentence to the last paragraph preceding the parameters specifications of $TypeBuffer.put($TypeBuffer):

      If this buffer and the source buffer share the same backing array or memory, then the result will be as if the source elements were first copied to an intermediate location before being written into this buffer.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bpb Brian Burkhalter
                Reporter:
                bpb Brian Burkhalter
                Reviewed By:
                Alan Bateman, Paul Sandoz
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: