checkstyle / checkstyle/contribution
launch_diff_antlr.sh is too slow for large projects like openjdk25, times out the 6-hour GitHub Actions limit
- Dominant language
- Java
- Stars
- 57
- Forks
- 168
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 15
Description
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:
```bash
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
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in checkstyle-tester/launch_diff_antlr.sh, especially launch(), and compare its per-file -J behavior with the AstTreeStringPrinter.printJavaAndJavadocTree() API described in the issue. Use the antlr-report.yml workflow against openjdk25 to validate the change; done means the report finishes within the GitHub Actions limit, preserves the existing .tree output layout, and keeps successfully parsed trees byte-identical.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, java, shell
- Domain
- ci-cd, performance, testing, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100