JDK-8245866 : (bf) XBuffer.put(Xbuffer src) can give unexpected result when storage overlaps
  • Type: CSR
  • Component: core-libs
  • Sub-Component: java.nio
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 15
  • Submitted: 2020-05-26
  • Updated: 2020-06-04
  • Resolved: 2020-05-28
Related Reports
CSR :  
Relates :  
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.```
Comments
Moving to Approved.
28-05-2020