Class ErrorProneValidator

java.lang.Object
com.qulice.errorprone.ErrorProneValidator
All Implemented Interfaces:
ResourceValidator

public final class ErrorProneValidator extends Object implements ResourceValidator
Validates source code with Google ErrorProne.

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 Details

    • ErrorProneValidator

      public ErrorProneValidator(Environment env)
      Constructor.
      Parameters:
      env - Environment to use
  • Method Details