Class TestCompilations

java.lang.Object
com.google.errorprone.TestCompilations

public final class TestCompilations extends Object

Shared helpers for configuring compiler options and creating JavacTaskImpl instances in Error Prone tests.

Intended for internal use by Error Prone test helpers only.

  • Method Details

    • defaultTestArgs

      public static com.google.common.collect.ImmutableList<String> defaultTestArgs(List<String> extraArgs)
      Returns extraArgs prefixed with Error Prone's preferred test defaults and -proc:none (unless annotation processing is explicitly configured in extraArgs).
    • defaultTestArgs

      public static com.google.common.collect.ImmutableList<String> defaultTestArgs(List<String> extraArgs, boolean disableImplicitProcessing)
      Returns extraArgs prefixed with Error Prone's preferred test defaults and, when disableImplicitProcessing is true and annotation processing is not explicitly configured in extraArgs, -proc:none.
    • withTestOnlyAndDeps

      public static com.google.common.collect.ImmutableList<String> withTestOnlyAndDeps(List<String> args, boolean testOnly)
      Augments args with -XepCompilingTestOnlyCode (when testOnly is true) and the com.google.errorprone.deps_for_test_inputs classpath (when set).
    • getTask

      public static com.sun.tools.javac.api.JavacTaskImpl getTask(Writer out, DiagnosticListener<? super JavaFileObject> diagnosticListener, List<String> extraJavacArgs, Iterable<? extends JavaFileObject> compilationUnits)
      Creates a JavacTaskImpl using FileManagers.testFileManager() with Error Prone's required production javac options and preferred test defaults layered before extraJavacArgs.
    • getTask

      public static com.sun.tools.javac.api.JavacTaskImpl getTask(Writer out, DiagnosticListener<? super JavaFileObject> diagnosticListener, List<String> extraJavacArgs, Iterable<? extends JavaFileObject> compilationUnits, com.sun.tools.javac.util.Context context)
      Creates a JavacTaskImpl using FileManagers.testFileManager() and the given context, with Error Prone's required production javac options and preferred test defaults layered before extraJavacArgs.