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

Jaikiran Pai jpai at openjdk.org
Fri Jul 4 01:57:39 UTC 2025


On Thu, 3 Jul 2025 14:23:00 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/Process.java line 113:
>> 
>>> 111:  * releasing the operating system resources.
>>> 112:  * {@code Try-with-resources} can be used to open and close the streams.
>>> 113:  * <p>For example, to capture the output of a program known to produce some output and then exit:
>> 
>> Hello Roger, co-incidentally, I was experimenting with the `Process` APIs in a different area. The code snippet that we recommend here will only capture the standard output of the invoked process. Although the sentence here says "output" of a program, do you think we should make it more clearer that it's the standard output of the program? Arguably, since the snippet already uses `inputReader()` whose javadoc notes that it represents the standard output, then maybe the additional clarification isn't needed?
>
> `inputReader()` is specific as to the output of the sub-process and the example covers only the most common case.

What you note sounds fine to me. Thank you.

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

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


More information about the core-libs-dev mailing list