RFR: 8354724: BufferedReader readAllLines and readString methods [v14]
Stuart Marks
smarks at openjdk.org
Thu May 1 17:54:47 UTC 2025
On Wed, 23 Apr 2025 22:04:25 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> Implement the requested methods and add a test thereof.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>
> 8354724: Fix readAllChars gaffe in Reader returned by Readed.of and account for it in test
src/java.base/share/classes/java/io/Reader.java line 408:
> 406: * <p> This method works as if invoking it were equivalent to evaluating
> 407: * the expression:
> 408: * <blockquote>{@linkplain #readAllChars()}.lines().toList()</blockquote>
I think this is actually too specific, as it could imply the returned List is the exact implementation that is returned by Stream.toList(). It is in this implementation, but I could easily imagine another implementation that constructs the list a different way. It might be better to be descriptive here and say that the entire input is read and is split into lines (where "line" is defined as above) which are returned in an unmodifiable list. And then have "unmodifiable list" be a link to the Unmodifiable Lists section, something like "java/util/List.html#unmodifiable".
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24728#discussion_r2070581767
More information about the core-libs-dev
mailing list