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

Jaikiran Pai jpai at openjdk.org
Wed Jul 2 13:28:42 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/ProcessBuilder.java line 545:

> 543:          * {@snippet lang = "java" :
> 544:          *     Redirect.DISCARD.file(); // is the filename appropriate for the operating system
> 545:          *     Redirect.DISCARD.type() == Redirect.Type.WRITE;

I built this PR locally to see how this gets rendered. It looks like this:
<img width="1107" alt="javadoc" src="https://github.com/user-attachments/assets/437a37e3-5fbb-43f0-b4d1-ba49ef3a5bb8" />

Should we add a `&&` in there somewhere to match what we do with the other `Redirect` types?

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

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


More information about the core-libs-dev mailing list