On Fri, 27 Jun 2025 16:09:02 GMT, Jaikiran Pai <[email protected]> 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 202:
>
>> 200: *
>> 201: * @apiNote
>> 202: * Avoid using both {@link #getInputStream} and {@link
>> #inputReader(Charset)}.
>
> The reworded sentence I think is still a bit confusing. In the new proposed
> form, it sounds like both these methods are to be avoided. I think the
> intention of this apiNote is to convey that they should not be invoked on the
> same Process instance. Would something like the following be clear and
> accurate:
>
>>
>> Either use {@link #getInputStream} or {@link #inputReader(Charset)} but not
>> both on the same {@code Process}.
>> ...
Same comment about the new text on `getErrorStream()`
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25884#discussion_r2172364262