Repository navigation
Summary
First release: an Error Prone compile operation for bld that runs the Error Prone plugin in-process through javac and reports every diagnostic, not just those of a failed build.
Features
- Error Prone compilation via javac —
ErrorProneOperation.execute()compiles the project's main and test sources with the Error Prone plugin enabled.- Uses a custom
CompileOperationthat captures the fullDiagnosticCollectoroutput, so every javac diagnostic is reported, including findings promoted to errors.
- Uses a custom
- Automatic version selection — a compatible Error Prone version is chosen for the running JDK:
ERROR_PRONE_VERSION(2.52.0) on JDK 21+LAST_JDK17_VERSION(2.42.0) on JDK 17-20version(String)/version(Version)override it; incompatible combinations are rejected before anything is downloaded.
- Fail-fast JDK and JVM checks — problems are reported up front with what to do, instead of surfacing later as
UnsupportedClassVersionErrororIllegalAccessError:- unsupported JDK/version pairs are rejected before downloading
- missing
--add-exports/--add-opensare reported with the exact options to add tobld.javaOptions - versions older than
LAST_JDK17_VERSIONremain accepted on JDK 11-16, since their minimum JDK is not known here
- Full check configuration API — later calls for the same check win:
- severity per check:
errorCheck,warnCheck,enableCheck,disableCheck - global toggles:
-XepAll…/-XepDisableAll…/-XepIgnoreUnknownCheckNames - raw
flag(...)and check-specificoption(name[, value]) - path exclusion with
excludedPath(...) - suggested-fix patches with
patchChecks(...)/patchLocation(...)
- severity per check:
- Processor path merging — a project- or customizer-supplied processor path is merged with the Error Prone processor path, recognizing all three spellings:
--processor-path <value>--processor-path=<value>-processorpath <value>- dangling flags and multiple occurrences are handled
- Project integration —
fromProject(...)picks up the project's compile options, sources, classpath, module path,verboseflag, and module main class.compileOptions(Consumer<JavacOptions>)adds customizers that run before the operation's own options, so the operation's options win.- The project's compile options are never mutated.
- Configurable repositories —
repositories(...)selects where the Error Prone jars are downloaded from (Maven Central by default); arguments are validated before the list is replaced. - Input validation — values that would split javac's single
-Xplugin:ErrorProne …argument are rejected:- plugin arguments and check names
- option names/values and excluded-path regexes
- patch settings
- blank values and whitespace or control characters are rejected