RFR: 8358533: Improve performance of java.io.Reader.readAllLines [v7]

Brian Burkhalter bpb at openjdk.org
Fri Jun 27 18:56:41 UTC 2025


On Fri, 27 Jun 2025 18:52:14 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> src/java.base/share/classes/java/io/Reader.java line 494:
>> 
>>> 492:                     skipLF = isCR;
>>> 493:                 } else { // no line terminator
>>> 494:                     int len = term - pos;
>> 
>> I think term == limit here and it seems a bit of a mismatch when the comment says there is no terminator.
>
> Yes, `term == limit`. The "no line terminator" means none was encountered before the buffer's end was reached.

Maybe it should be something like:

// no line terminator before end of buffer

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25863#discussion_r2172679504


More information about the core-libs-dev mailing list