RFR: 8354724: BufferedReader readAllLines and readString methods [v2]
Brian Burkhalter
bpb at openjdk.org
Thu Apr 17 21:57:04 UTC 2025
On Thu, 17 Apr 2025 19:08:52 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>>
>> 8354724: Address all PR comments to now
>
> src/java.base/share/classes/java/io/BufferedReader.java line 417:
>
>> 415: * the expression:
>> 416: * <blockquote>{@link #lines()}.toList()</blockquote>
>> 417: *
>
> It is worth noting that if an IOException occurs, the reader and underlying stream are left in an unpredictable state?
>
> With a normal or exceptional return should anything be said about the state of the underlying stream?
> The corresponding method on Files ensures the reader is closed (and propagates to the underlying stream).
Please see the changes in [4fac584](https://github.com/openjdk/jdk/pull/24728/commits/4fac584c5b19b3910e7a362656d2b406ad4ba189).
> src/java.base/share/classes/java/io/BufferedReader.java line 426:
>
>> 424: * {@code List} is modifiable is implementation dependent,
>> 425: * hence not specified
>> 426: *
>
> Does the rationale used in Files to leaving this indeterminate apply here?
> I'd think it would be better to say its not-modifyable.
> Here its free/cheap, the Stream<T>.toList() method creates an un-modifiableList.
Please see the changes in [4fac584](https://github.com/openjdk/jdk/pull/24728/commits/4fac584c5b19b3910e7a362656d2b406ad4ba189).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24728#discussion_r2049695645
PR Review Comment: https://git.openjdk.org/jdk/pull/24728#discussion_r2049695702
More information about the core-libs-dev
mailing list