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

Markus KARG duke at openjdk.org
Sat Mar 29 10:09:26 UTC 2025


On Wed, 26 Mar 2025 11:34:34 GMT, Markus KARG <duke at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/CharSequence.java line 307:
>> 
>>> 305:     /**
>>> 306:      * Characters are copied from this sequence into the
>>> 307:      * destination character array {@code dst}. The first character to
>> 
>> I think the "Characters are copied ..." sentence goes back to StringBuffer in JDK 1.0. CS doesn't need to copy this exactly and I think better to say that it copies chars from this sequence into the given destination array.
>
> Do you like this more: `Copies chars from this sequence into the given destination array.` ?

Thank you, Alan. Fixed in https://github.com/openjdk/jdk/pull/21730/commits/a7f56f4ecba4be1a28e551e8a247998db7d7cb79.

>> src/java.base/share/classes/java/lang/CharSequence.java line 335:
>> 
>>> 333:      *
>>> 334:      * @implSpec
>>> 335:      * The default implementation iterates over {@link #charAt(int)}.
>> 
>> This sentence doesn't make sense, did something get deleted?
>
> Do you like this more: `The default implementation invokes {@link #charAt(int)} in a loop.`?

Thank you, Alan. Fixed in https://github.com/openjdk/jdk/pull/21730/commits/a5d26c5bc143e37520e5f42bcb0299d4e12784b0.

>> src/java.base/share/classes/java/nio/X-Buffer.java.template line 1900:
>> 
>>> 1898: 
>>> 1899:     /**
>>> 1900:      * {@inheritDoc}
>> 
>> The method description here will need to start with  "Absolute bulk get method". This is important because CB defines both "absolute bulk get" and "relative bulk get methods", it has to be very clear in the API docs.
>> 
>> If the proposal goes again then I think the method description won't be inherited into CB, instead it will say that it transfers chars from this buffer into the given destination array.
>
> IIUC then you want me to replace `{@inheritedDoc}` by `This absolute bulk get method transfers chars from this buffer into the given destination array.`?

Thank you, Alan. Fixed in https://github.com/openjdk/jdk/pull/21730/commits/29e1521fa25ba88dbbe4af077888044666f790f6.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21730#discussion_r2019766905
PR Review Comment: https://git.openjdk.org/jdk/pull/21730#discussion_r2019766966
PR Review Comment: https://git.openjdk.org/jdk/pull/21730#discussion_r2019766823


More information about the nio-dev mailing list