RFR: 7904141: JTReg should support running compact source files

Christian Stein cstein at openjdk.org
Mon Feb 2 07:39:42 UTC 2026


On Sun, 1 Feb 2026 12:14:53 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> Please review this change that adds support for running compact source files as jtreg `main` tests.
>> 
>> This pull request also adds JDK 25 to the GHA-based CI workflow and updates to use newer GitHub actions: `actions/checkout at v6` and `actions/setup-java at v5`
>
> src/share/classes/com/sun/javatest/regtest/agent/MainWrapper.java line 184:
> 
>> 182: 
>> 183:                 // RUN JAVA PROGRAM
>> 184:                 Class<?> mainClass = Class.forName(className, false, cl);
> 
> Hello Christian, I haven't yet looked at the changes in detail, but I think this change here should be guarded by a check against the current runtime version. i.e. something like:
> 
> if (currentRuntimeVersion < 25) {
>     Class<?> c = Class.forName(className, false, cl);
>     Method mainMethod = c.getMethod("main", String[].class);
>     mainMethod.invoke(null, (Object) args);
> } else {
>    ... // the new changes proposed in this PR
> }

I see the point with respect to consistency of the Java version Compact Source Files where released.

On the other hand, jtreg 8.3+ could support running such main classes as long as `javac` was able to compile them. This would allow easier backporting of tests in compact form.

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

PR Review Comment: https://git.openjdk.org/jtreg/pull/313#discussion_r2752964494


More information about the jtreg-dev mailing list