On Sun, 23 Mar 2025 04:34:29 GMT, Chen Liang <li...@openjdk.org> wrote:

>> Markus KARG has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Applied changes requested by Chen
>
> src/java.base/share/classes/java/lang/CharSequence.java line 340:
> 
>> 338:     public default void getChars(int srcBegin, int srcEnd, char[] dst, 
>> int dstBegin) {
>> 339:         Objects.checkFromToIndex(srcBegin, srcEnd, length());
>> 340:         Objects.checkFromIndexSize(dstBegin, srcEnd - srcBegin, 
>> dst.length);
> 
> We can just do a `checkIndex(dstBegin, dst.length - (srcEnd - srcBegin) + 1)` 
> as we know `srcEnd - srcBegin` is valid.
> 
> Also we should specify an NPE is thrown if `dst` is `null`. (Unforunately 
> `compare` forgot this specification when it was added)

Fixed in a3c2add9c16e4c7331c5a7c2848f27b6c0330a17

> src/java.base/share/classes/java/nio/X-Buffer.java.template line 2356:
> 
>> 2354: #end[streamableType]
>> 2355: 
>> 2356: #if[char]
> 
> Can we merge this with `// -- Other char stuff --` on line 1895?
> 
> On a side note, we can optimize a lot of Appendable operations that transfer 
> from CharSequence on CharBuffer; don't know if you wish to have it in this 
> RFE or another.

Fixed in a3c2add9c16e4c7331c5a7c2848f27b6c0330a17.

Let's finish this PR first. After that I would be happy to author another PR 
with all the optimizations you tell me. 😃

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

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

Reply via email to