On Thu, 16 Apr 2026 11:17:25 GMT, Michael McMahon <[email protected]> wrote:
>> Hi, >> >> This is a small fix for j.l.ProcessHandle on MacOS. Unlike other platforms, >> Mac returns a ProcessHandle for pid 0 whose descendants are _all_ processes >> on the system. This specific scenario tickles an off by one error where the >> descendants method tries to access an element past the end of the array of >> pids. The fix is to break from the loop before accessing this element. >> >> Thanks, >> >> Michael >> >> --------- >> - [x] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > Michael McMahon has updated the pull request with a new target base due to a > merge or a rebase. The incremental webrev excludes the unrelated changes > brought in by the merge/rebase. The pull request contains four additional > commits since the last revision: > > - Merge branch 'master' into pidzero > - remove files > - remove imports not needed > - fix test/jdk/java/lang/ProcessHandle/PidZero.java line 26: > 24: import org.junit.jupiter.api.Test; > 25: > 26: /* Should this have a `@bug` tag? test/jdk/java/lang/ProcessHandle/PidZero.java line 42: > 40: @Test > 41: public void test() { > 42: int num = > ProcessHandle.of(0).orElseThrow().descendants().toList().size(); Should this have any assertion? E.g. `assertNotEquals(0, num)` / `assertTrue(num > 0)` (or at least a `assertDoesNotThrow` to clarify the intention)? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/30763#discussion_r3093263935 PR Review Comment: https://git.openjdk.org/jdk/pull/30763#discussion_r3093281379
