RFR: 8354724: BufferedReader readAllLines and readString methods [v14]
Roger Riggs
rriggs at openjdk.org
Thu May 1 19:22:50 UTC 2025
On Thu, 1 May 2025 17:51:53 GMT, Stuart Marks <smarks at openjdk.org> wrote:
>> 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".
The word 'equivalent' mitigates the exactness of the code to describe the expected result.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24728#discussion_r2070689232
More information about the core-libs-dev
mailing list