RFR: 8222329: Readable read(CharBuffer) does not specify that 0 is returned when there is no remaining space in buffer [v4]

Alan Bateman alanb at openjdk.org
Fri Jun 23 06:52:03 UTC 2023


On Thu, 22 Jun 2023 22:52:23 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Clarify the behavior of `java.lang.Readable` when the specified `java.nio.CharBuffer` parameter is empty but read-only, and when it is full.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8222329: Correct return verbiage of Reader and CharBuffer

src/java.base/share/classes/java/nio/X-Buffer.java.template line 484:

> 482:      * @throws ReadOnlyBufferException if target is a read only buffer,
> 483:      *         even if it is empty
> 484:      * @since 1.5

It might be clearer if this method linked to the length method. That way it could be specified to return 0 when the length of the target buffer is 0.

For the @throws of ROBE, probably need to avoid the word "empty", only because this method writes to the target buffer, it doesn't read from the target buffer.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14616#discussion_r1239387151


More information about the nio-dev mailing list