RFR: 8343110: Add getChars(int, int, char[], int) to CharSequence and CharBuffer [v12]

Jaikiran Pai jpai at openjdk.org
Mon May 12 01:20:07 UTC 2025


On Fri, 9 May 2025 20:35:04 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:

>> Markus KARG has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 17 commits:
>> 
>>  - merge latest from master branch
>>  - Applied proposal by Daniel: If there's no change to this file the copyright year update could be reverted?
>>  - Applied workaround proposed by Joe: Using component @inheritDoc to enforce getChars section in JavaDocs
>>  - Applied changes proposed by Joe and Jaikiran: Using @inheritDoc to get JavaDocs without @since.
>>  - Applied changes proposed in response to Joe's CSR comments: 'understood for CharBuffer; I was thinking more of String, StringBuffer, and StringBuilder where there looks to be more textual similarities.'
>>  - Applied changes requestes by Alan: Aligning unit test for CharBuffer.getChars() with unit test for CharBuffer.chars()
>>  - Applied changes requested by Chen and Jaikiran: Unit tests for default implementation of CharSequence.getChars() and for CharBuffer.getChars()
>>  - Applied changes requested by Chen: 'We might need to specify the IOOBE behavior - when an IOOBE is thrown, some characters may be already transferred (this is important for concurrent char sequences)'
>>  - Applied changes requested by Alan: This sentence doesn't make sense, did something get deleted?
>>  - Applied changes requested by Alan: Copies chars from this sequence into the given destination array
>>  - ... and 7 more: https://git.openjdk.org/jdk/compare/b21b3a38...31537b7a
>
> src/java.base/share/classes/java/lang/CharSequence.java line 313:
> 
>> 311:      * at index {@code dstBegin} and ending at index:
>> 312:      * <pre>{@code
>> 313:      * dstbegin + (srcEnd-srcBegin) - 1
> 
> Shouldn't it be dstBegin?
> 
> * dstBegin + (srcEnd-srcBegin) - 1

Hello Andrey, what you note is right. This and the other change you have proposed to this text seems reasonable. Do you want to create a JBS issue and raise a PR proposing this change?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21730#discussion_r2083686557


More information about the nio-dev mailing list