Class TestCompilations
java.lang.Object
com.google.errorprone.TestCompilations
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 Summary
Modifier and TypeMethodDescriptionstatic com.google.common.collect.ImmutableList<String> defaultTestArgs(List<String> extraArgs) ReturnsextraArgsprefixed with Error Prone's preferred test defaults and-proc:none(unless annotation processing is explicitly configured inextraArgs).static com.google.common.collect.ImmutableList<String> defaultTestArgs(List<String> extraArgs, boolean disableImplicitProcessing) ReturnsextraArgsprefixed with Error Prone's preferred test defaults and, whendisableImplicitProcessingistrueand annotation processing is not explicitly configured inextraArgs,-proc:none.static com.sun.tools.javac.api.JavacTaskImplgetTask(Writer out, DiagnosticListener<? super JavaFileObject> diagnosticListener, List<String> extraJavacArgs, Iterable<? extends JavaFileObject> compilationUnits) Creates aJavacTaskImplusingFileManagers.testFileManager()with Error Prone's required production javac options and preferred test defaults layered beforeextraJavacArgs.static com.sun.tools.javac.api.JavacTaskImplgetTask(Writer out, DiagnosticListener<? super JavaFileObject> diagnosticListener, List<String> extraJavacArgs, Iterable<? extends JavaFileObject> compilationUnits, com.sun.tools.javac.util.Context context) Creates aJavacTaskImplusingFileManagers.testFileManager()and the givencontext, with Error Prone's required production javac options and preferred test defaults layered beforeextraJavacArgs.static com.google.common.collect.ImmutableList<String> withTestOnlyAndDeps(List<String> args, boolean testOnly) Augmentsargswith-XepCompilingTestOnlyCode(whentestOnlyistrue) and thecom.google.errorprone.deps_for_test_inputsclasspath (when set).
-
Method Details
-
defaultTestArgs
-
defaultTestArgs
public static com.google.common.collect.ImmutableList<String> defaultTestArgs(List<String> extraArgs, boolean disableImplicitProcessing) ReturnsextraArgsprefixed with Error Prone's preferred test defaults and, whendisableImplicitProcessingistrueand annotation processing is not explicitly configured inextraArgs,-proc:none. -
withTestOnlyAndDeps
-
getTask
public static com.sun.tools.javac.api.JavacTaskImpl getTask(Writer out, DiagnosticListener<? super JavaFileObject> diagnosticListener, List<String> extraJavacArgs, Iterable<? extends JavaFileObject> compilationUnits) Creates aJavacTaskImplusingFileManagers.testFileManager()with Error Prone's required production javac options and preferred test defaults layered beforeextraJavacArgs. -
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 aJavacTaskImplusingFileManagers.testFileManager()and the givencontext, with Error Prone's required production javac options and preferred test defaults layered beforeextraJavacArgs.
-