RFR: 7903789: Replace reflective code to access java.lang.Process methods
Christian Stein
cstein at openjdk.org
Tue Aug 26 08:33:50 UTC 2025
On Sun, 24 Aug 2025 10:09:29 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
> Can I please get a review of this change which replaces the reflective access to java.lang.Process' methods with direct API calls? This addresses https://bugs.openjdk.org/browse/CODETOOLS-7903789?
>
> We used to access the `pid()` method and the `destroyForcibly()` method reflectively. `pid()` has been available since Java 9 and `destroyForcibly()` since Java 8. A minimum of Java 17 is required to launch the jtreg tool itself. So the reflective use of these APIs is no longer necessary.
>
> No new self tests have been introduced and existing tests continue to pass with this change.
Thanks for the clean-up!
Note that classes in the `com.sun.javatest.regtest.agent` package are still required to compile to Java release 8. And we although we require JDK 17+ to build (due to Asmtools), we still target Java 11 as the base release:
https://github.com/openjdk/jtreg/blob/5e7e48f0778252d33768ca4b9bdd7eca06e70cea/make/Defs.gmk#L120-L121
Both of your changes are in range, though.
-------------
Marked as reviewed by cstein (Reviewer).
PR Review: https://git.openjdk.org/jtreg/pull/277#pullrequestreview-3154555715
More information about the jtreg-dev
mailing list