RFR: 7904141: JTReg should support running compact source files [v6]

Jaikiran Pai jpai at openjdk.org
Wed Feb 18 15:12:42 UTC 2026


On Mon, 16 Feb 2026 09:05:50 GMT, Christian Stein <cstein at openjdk.org> wrote:

>> Please review this change that adds support for running [JEP 512: Compact Source Files and Instance Main Methods](https://openjdk.org/jeps/512) 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`
>
> Christian Stein has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Environment variable already exported

src/share/classes/com/sun/javatest/regtest/agent/MainActionHelper.java line 340:

> 338:                 // RUN JAVA PROGRAM
> 339:                 // Similar to sun.launcher.LauncherHelper#executeMainClass
> 340:                 method.setAccessible(true);

Hello Christian, instead of doing the `setAccessible()` here (which is needed if the method isn't the `public static void main(...)`), I think it would be better to do that in MainMethodHelper itself on the `method` it returns.

src/share/classes/com/sun/javatest/regtest/agent/MainActionHelper.java line 370:

> 368:         public  Object result;
> 369:         private final Method method;
> 370:         private final Object instance; // can be null

Perhaps rename it to `mainClassInstance` to make it more clear what instance this is?

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

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


More information about the jtreg-dev mailing list