RFR: 8341566: Add Reader.of(CharSequence) [v7]

Markus KARG duke at openjdk.org
Thu Oct 10 07:32:53 UTC 2024


On Wed, 9 Oct 2024 18:42:20 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Markus KARG has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - assertThrows instead of expectedExceptions
>>  - ordered jtreg tags according recommendation in https://openjdk.org/jtreg/tag-spec.html#ORDER
>
> src/java.base/share/classes/java/io/Reader.java line 168:
> 
>> 166:      *
>> 167:      * @throws NullPointerException if {@code cs} is {@code null}
>> 168:      *
> 
> Drop the extra empty lines, to be more consistent with Reader code style and make the source more compact.

done

> src/java.base/share/classes/java/io/Reader.java line 202:
> 
>> 200:                 if (next >= cs.length())
>> 201:                     return -1;
>> 202:                 int n = Math.min(cs.length() - next, len);
> 
> Is there any sensitivity to cs.length() changing between these calls? (For an arbitrary custom implementation).
> The spec for undefined behavior covers that but might be safer to compute a local length.

done; introduced local variable

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21371#discussion_r1794828638
PR Review Comment: https://git.openjdk.org/jdk/pull/21371#discussion_r1794831570


More information about the core-libs-dev mailing list