Class Batches

java.lang.Object
com.qulice.errorprone.Batches

public final class Batches extends Object
Java sources split the way Maven compiles them: one batch per source root, never two roots in one batch.

A single javac pass over two roots would manufacture diagnostics no project could ever silence, because Maven lets every source root hold a twin of the same file. The clearest case is package-info.java, which Qulice's own JavadocPackage check demands in every package: with one pass, a package present in two roots earns a package-info.java file has already been seen and, once the file carries an annotation, has already been annotated.

The roots a file may sit under are the ones the project declares, which is what Environment.testdirs() reports. Matching the /src/test/ path fragment instead would miss every further root a project registers through build-helper-maven-plugin:add-test-sourcesrc/mock/java in the jcabi parent POM (see #1742). Folding all of those roots into one test batch does not help either: src/test/java and src/mock/java are as free to hold twins as src/main/java and src/test/java are, so each root earns a batch of its own (see #1745). A file under none of them belongs to the main batch. Cross-batch references still resolve, since the project's own compiled classes are on the -classpath of every pass.

Since:
1.0
  • Constructor Details

    • Batches

      public Batches(Environment env, List<File> sources)
      Constructor.
      Parameters:
      env - Environment that knows the source roots
      sources - Java source files to split
  • Method Details

    • split

      public Map<String,List<File>> split()
      Split the sources, one batch per source root.
      Returns:
      Batches by name, in compilation order, none of them empty