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

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

    XMLWordPrintable

Details

    • CSR
    • Resolution: Approved
    • P4
    • 15
    • core-libs
    • None
    • behavioral
    • minimal
    • No code compatibility risk as this is only a specification clarification.
    • Java API
    • 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

              bpb Brian Burkhalter
              bpb Brian Burkhalter
              Alan Bateman, Paul Sandoz
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: