RFR: 8354872: Clarify java.lang.Process resource cleanup [v3]

Jaikiran Pai jpai at openjdk.org
Wed Jul 2 13:05:40 UTC 2025


On Tue, 1 Jul 2025 22:30:57 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Improve the documentation of Process use of system resources.
>> 
>> Describe the implementation closing streams when no longer referenced.
>> Clarify the interactions between inputStream and inputReader and errorStream and errorReader.
>> Add advice and example using try-with-resources to open and close streams.
>> Recommend closing streams when no longer in use.
>
> Roger Riggs has updated the pull request incrementally with one additional commit since the last revision:
> 
>   javadoc cleanup

src/java.base/share/classes/java/lang/Process.java line 208:

> 206:      *
> 207:      * @apiNote
> 208:      * Use either this method or an {@linkplain #inputReader(Charset) input reader}

I think this should be `{@linkplain #inputReader() input reader}` (i.e. the one that doesn't take a CharSet) to match what was there previously before the changes in this PR.

src/java.base/share/classes/java/lang/Process.java line 240:

> 238:      *
> 239:      * @apiNote
> 240:      * Use either this method or an {@linkplain #errorReader(Charset) error reader}

Same here - I think it should be `{@linkplain #errorReader() error reader}`

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25884#discussion_r2180011109
PR Review Comment: https://git.openjdk.org/jdk/pull/25884#discussion_r2180013254


More information about the core-libs-dev mailing list