RFR: 7904141: JTReg should support running compact source files [v2]
Christian Stein
cstein at openjdk.org
Tue Feb 3 08:36:03 UTC 2026
On Mon, 2 Feb 2026 07:46:25 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
>> 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.
>
> Hello Christian, JEP-512 https://openjdk.org/jeps/512 brings in several variants to the main() method entry point. `javac` would compile many of those variants in any version because they would just be yet another method in a class, for `javac`. The rules of identifying the main() method within a class and using that as an entry point is what changed in Java 25 through https://openjdk.org/jeps/512. Before that even if `javac` could compile such classes, launching those main() methods wouldn't be allowed (by the `java` launcher), in fact that would result in a failure to find a main() method.
>
> So I think we shouldn't allow jtreg to reflectively "launch" such newer main() methods on Java versions that don't have https://openjdk.org/jeps/512
Agreed. Added the check and the old code logic applies to all test JDKs below 25.
-------------
PR Review Comment: https://git.openjdk.org/jtreg/pull/313#discussion_r2757873163
More information about the jtreg-dev
mailing list