RFR: 8354872: Clarify java.lang.Process resource cleanup
Jaikiran Pai
jpai at openjdk.org
Fri Jun 27 16:16:46 UTC 2025
On Fri, 27 Jun 2025 16:12:53 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
>> 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()`
Also, I suspect the use of `{@link #inputReader(Charset)}` instead of the pre-existing `{@link #inputReader()}` was perhaps unintentional?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25884#discussion_r2172366241
More information about the core-libs-dev
mailing list