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

Markus KARG duke at openjdk.org
Wed Apr 16 10:37:51 UTC 2025


On Tue, 15 Apr 2025 20:46:52 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Markus KARG has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   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)'
>
> src/java.base/share/classes/java/lang/CharSequence.java line 338:
> 
>> 336:      * Concurrent truncation of this character sequence can throw
>> 337:      * {@code IndexOutOfBoundsException}. In this case, some characters, but not
>> 338:      * all, may be already transferred.
> 
> Though its been absent for decades, it might be worthwhile to include a class level warning that the implementations of the interface are not known or required to be thread safe and if used concurrently by multiple threads the behavior is unpredictable.  I'd be more circumspect than trying to specify the only aberrant behavior is IndexOutOfBounds.

Any quick proposals how to rephrase JavaDocs and CSR? As the CSR is already reviewed I am a bit reluctant to hold the train for this, as IMHO *masses* of classes and interfaces would need such a disclaimer, if we kick-off that ball here...

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

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


More information about the nio-dev mailing list