RFR: 4833719: (bf) Views of MappedByteBuffers are not MappedByteBuffers, and cannot be forced [v4]

Alan Bateman alanb at openjdk.java.net
Tue Mar 16 14:12:28 UTC 2021


On Tue, 16 Mar 2021 10:01:22 GMT, Andrew Dinn <adinn at openjdk.org> wrote:

>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   4833719: Corrected faux pas in correcting faux pas
>
> src/java.base/share/classes/java/nio/MappedByteBuffer.java line 377:
> 
>> 375:      * {@code force()} on the returned buffer, will only act on the sub-range
>> 376:      * of this buffer that the returned buffer represents, namely
>> 377:      * {@code [position(),limit()]}.
> 
> Is the closing bracket on this interval meant to be ']' or ')'? i.e. is the interval inclusive of exclusive of the value at the index returned by limit()?

The no-arg force method used to write back the entire buffer content [0, capacity]. It has been changed to use the limit, meaning [0, limit]. I don't recall this being an intentional change. I'm asking now because the change in this PR will specify the new behavior rather than the long standing behavior.

-------------

PR: https://git.openjdk.java.net/jdk/pull/2902


More information about the nio-dev mailing list