RFR: 8361299: (bf) CharBuffer.getChars(int,int,char[],int) violates pre-existing specification [v3]

Alan Bateman alanb at openjdk.org
Thu Jul 3 09:53:42 UTC 2025


On Thu, 3 Jul 2025 00:33:58 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Modify `CharBuffer.getChars` to respect the class level specification that the provided buffer offset `srcBegin` is relative to the buffer's current position.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8361299: Ensure [srcBegin,srcEnd) is contained in [0,limit()-position())

test/jdk/java/nio/Buffer/GetChars.java line 75:

> 73: 
> 74:     @Test
> 75:     public void testSrcBeginIsNegationOfPosition() {

I skimmed through GetChars and I see it only tests a CB created with CharBuffer.wrap, only testGetChars tests all char buffers. All the test methods should be tested all char buffer implementations. So maybe we can create a follow-up issue to improve this test (and probably migrate it to a JUnit test too).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26104#discussion_r2182361518


More information about the nio-dev mailing list