checkstyle/checkstyle now has an antlr-report.yml workflow that generates the ANTLR regression report on PR comment (checkstyle/checkstyle#19897). It works fine for the checkstyle self-test, but running it against openjdk25 hits the 6-hour GitHub Actions job limit and the report is never generated. We need openjdk runs for validating grammar changes against real Java 25 sources (e.g. checkstyle/checkstyle#20815).
Cause
The launch() function in checkstyle-tester/launch_diff_antlr.sh starts two fresh JVMs per file, one for the master jar and one for the patch jar:
for f in $(find $REPO_SOURCES_DIR -name '*.java')
do
java -jar $TEMP_DIR/checkstyle-master-all.jar -J $f > $saveMasterFile 2>&1 &
java -jar $TEMP_DIR/checkstyle-patch-all.jar -J $f > $savePatchFile 2>&1 &
wait
done
For openjdk25 that is over thousands of JVM starts. Measured locally, this costs ~0.68s per file, of which the actual parsing is only ~15ms - the rest is JVM startup and classloading, repeated for every file. That extrapolates to ~10 hours for openjdk25, which is why the workflow never finishes. The per-file JVM was forced by the checkstyle CLI: -J accepts only a single file.
Proposal
Replace the loop with a single JVM per jar: a small AstBatchPrinter.java (run via the JDK source launcher, so no build step, same spirit as diff.groovy) that takes the whole file list, calls the same AstTreeStringPrinter.printJavaAndJavadocTree() API that -J uses internally, and writes the same per-file .tree files. Files are processed in parallel on a fixed-size thread pool, with a per-file catch so an unparseable file becomes error text in its own .tree like today, instead of failing the run.
Prototype results on openjdk25 (done this locallyy):
- full report generated in 15m
- trees for successfully parsed files are byte-identical to the current per-file approach
patch-diff-report-tool and the report format need no changes - output layout is identical
checkstyle/checkstyle now has an
antlr-report.ymlworkflow that generates the ANTLR regression report on PR comment (checkstyle/checkstyle#19897). It works fine for the checkstyle self-test, but running it against openjdk25 hits the 6-hour GitHub Actions job limit and the report is never generated. We need openjdk runs for validating grammar changes against real Java 25 sources (e.g. checkstyle/checkstyle#20815).Cause
The
launch()function incheckstyle-tester/launch_diff_antlr.shstarts two fresh JVMs per file, one for the master jar and one for the patch jar:For openjdk25 that is over thousands of JVM starts. Measured locally, this costs ~0.68s per file, of which the actual parsing is only ~15ms - the rest is JVM startup and classloading, repeated for every file. That extrapolates to ~10 hours for openjdk25, which is why the workflow never finishes. The per-file JVM was forced by the checkstyle CLI:
-Jaccepts only a single file.Proposal
Replace the loop with a single JVM per jar: a small
AstBatchPrinter.java(run via the JDK source launcher, so no build step, same spirit asdiff.groovy) that takes the whole file list, calls the sameAstTreeStringPrinter.printJavaAndJavadocTree()API that-Juses internally, and writes the same per-file.treefiles. Files are processed in parallel on a fixed-size thread pool, with a per-file catch so an unparseable file becomes error text in its own.treelike today, instead of failing the run.Prototype results on openjdk25 (done this locallyy):
patch-diff-report-tooland the report format need no changes - output layout is identical