Class ErrorProneValidator
- All Implemented Interfaces:
ResourceValidator
Runs the javac executable from the active JDK as a forked
process, with ErrorProne wired in as a -Xplugin:ErrorProne so
that every bug pattern fires while javac type-checks the
project's Java sources. The --add-exports and --add-opens
flags ErrorProne needs to reach internal jdk.compiler packages
are passed to the forked JVM via javac's -J prefix; the
JVM hosting Maven and Qulice is unaffected, so consumers do not have to
touch their own .mvn/jvm.config to use this validator.
The combined stdout/stderr stream is handed to Diagnostics,
which turns every diagnostic it finds there into a Violation —
ErrorProne findings, javac lint warnings and plain compile
errors alike — and passes over the carets, symbol hints and counters
the compiler prints around them. -proc:none is passed to keep
regular annotation processors (Lombok, Hibernate-Validator, etc.) out
of the ErrorProne pass.
Which bug patterns fire is up to Xplugin, which also takes
in the -Xep flags of the project, read from the
qulice.errorprone parameter.
The sources are not fed to one javac pass but to as many as
the project has source roots, which is what Batches works out;
the name of each batch tells the passes apart on disk, both in the
argfile they read and in the directory they write classes to.
- Since:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionname()Name of this validator.intrules()How many rules this validator applies to every file it reads.validate(Collection<File> files) Validate and throws exception if there are any problems.
-
Constructor Details
-
ErrorProneValidator
Constructor.- Parameters:
env- Environment to use
-
-
Method Details
-
validate
Description copied from interface:ResourceValidatorValidate and throws exception if there are any problems.- Specified by:
validatein interfaceResourceValidator- Parameters:
files- Files to validate- Returns:
- Validation results
-
name
Description copied from interface:ResourceValidatorName of this validator.- Specified by:
namein interfaceResourceValidator- Returns:
- Name of this validator
-
rules
public int rules()Description copied from interface:ResourceValidatorHow many rules this validator applies to every file it reads.- Specified by:
rulesin interfaceResourceValidator- Returns:
- Number of rules, or zero when the validator cannot tell
-