JDK-8242500 : (bf) MappedByteBuffer should clarify copying between overlapping mappings
  • Type: CSR
  • Component: core-libs
  • Sub-Component: java.nio
  • Priority: P4
  • Status: Closed
  • Resolution: Withdrawn
  • Fix Versions: 15
  • Submitted: 2020-04-10
  • Updated: 2020-06-04
  • Resolved: 2020-06-04
Related Reports
CSR :  
Relates :  
Relates :  
Description
Summary
-------

`MappedByteBuffer` does not specify that bulk copying between overlapping mapped regions of the same file has unspecified results.

Problem
-------

If two MappedByteBuffers are created from overlapping ranges of the same file and a bulk copy is performed between them, then surprising and unexpected results may occur.

Solution
--------

Add verbiage stating that that bulk copying between MappedByteBuffers mapped from overlapping ranges of the same file has unspecified results.

Specification
-------------

Add this sentence before the current last sentence of the class level specification of `MappedByteBuffer`:

```The result of a bulk copy between two {@code MappedByteBuffer}s is
unspecified if they are mapped from overlapping regions of the same file.```

A webrev is attached.