RFR: 8354872: Clarify java.lang.Process resource cleanup
Jaikiran Pai
jpai at openjdk.org
Fri Jun 27 16:16:47 UTC 2025
On Wed, 18 Jun 2025 20:16:18 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.
src/java.base/share/classes/java/lang/Process.java line 233:
> 231: *
> 232: * @apiNote
> 233: * Avoid using both {@link #getErrorStream} and {@link #inputReader(Charset)}.
There's a typo here - the second link should have been `{@link #errorReader()}`
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25884#discussion_r2172362719
More information about the core-libs-dev
mailing list