Skip to content

Commit

Permalink
Removed dependency on BuiltInCheckerSuppliers from ErrorProneTestComp…
Browse files Browse the repository at this point in the history
…iler

This is breaking a loop in preparation for separating out maven
artifacts for compiling the tests.

RELNOTES: Removed dependency on BuiltInCheckerSuppliers from
ErrorProneTestCompiler

MOE_MIGRATED_REVID=134140791
  • Loading branch information
andrewrice authored and cushon committed Oct 3, 2016
1 parent c2747d0 commit 953940b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
Expand Up @@ -27,6 +27,7 @@
import com.google.errorprone.bugpatterns.BugChecker.ReturnTreeMatcher; import com.google.errorprone.bugpatterns.BugChecker.ReturnTreeMatcher;
import com.google.errorprone.bugpatterns.EmptyIfStatement; import com.google.errorprone.bugpatterns.EmptyIfStatement;
import com.google.errorprone.matchers.Description; import com.google.errorprone.matchers.Description;
import com.google.errorprone.scanner.BuiltInCheckerSuppliers;
import com.google.errorprone.scanner.ScannerSupplier; import com.google.errorprone.scanner.ScannerSupplier;
import com.sun.source.tree.ReturnTree; import com.sun.source.tree.ReturnTree;
import com.sun.tools.javac.main.Main.Result; import com.sun.tools.javac.main.Main.Result;
Expand Down Expand Up @@ -100,9 +101,11 @@ public Description matchReturn(ReturnTree tree, VisitorState state) {
public void setUp() { public void setUp() {
output = new StringWriter(); output = new StringWriter();
diagnosticHelper = new DiagnosticTestHelper(); diagnosticHelper = new DiagnosticTestHelper();
builder = new ErrorProneTestCompiler.Builder() builder =
.listenToDiagnostics(diagnosticHelper.collector) new ErrorProneTestCompiler.Builder()
.redirectOutputTo(new PrintWriter(output, true)); .report(BuiltInCheckerSuppliers.defaultChecks())
.listenToDiagnostics(diagnosticHelper.collector)
.redirectOutputTo(new PrintWriter(output, true));
} }




Expand Down
Expand Up @@ -40,6 +40,7 @@
import com.google.errorprone.bugpatterns.BugChecker.ReturnTreeMatcher; import com.google.errorprone.bugpatterns.BugChecker.ReturnTreeMatcher;
import com.google.errorprone.bugpatterns.NonAtomicVolatileUpdate; import com.google.errorprone.bugpatterns.NonAtomicVolatileUpdate;
import com.google.errorprone.matchers.Description; import com.google.errorprone.matchers.Description;
import com.google.errorprone.scanner.BuiltInCheckerSuppliers;
import com.google.errorprone.scanner.ScannerSupplier; import com.google.errorprone.scanner.ScannerSupplier;
import com.sun.source.tree.ExpressionStatementTree; import com.sun.source.tree.ExpressionStatementTree;
import com.sun.source.tree.IdentifierTree; import com.sun.source.tree.IdentifierTree;
Expand Down Expand Up @@ -90,10 +91,12 @@ public class ErrorProneCompilerIntegrationTest {
public void setUp() { public void setUp() {
diagnosticHelper = new DiagnosticTestHelper(); diagnosticHelper = new DiagnosticTestHelper();
outputStream = new StringWriter(); outputStream = new StringWriter();
compilerBuilder = new ErrorProneTestCompiler.Builder() compilerBuilder =
.named("test") new ErrorProneTestCompiler.Builder()
.redirectOutputTo(new PrintWriter(outputStream, true)) .named("test")
.listenToDiagnostics(diagnosticHelper.collector); .report(BuiltInCheckerSuppliers.defaultChecks())
.redirectOutputTo(new PrintWriter(outputStream, true))
.listenToDiagnostics(diagnosticHelper.collector);
compiler = compilerBuilder.build(); compiler = compilerBuilder.build();
} }


Expand Down
Expand Up @@ -34,7 +34,7 @@ public class ErrorProneTestCompiler {
/** Wraps {@link com.google.errorprone.ErrorProneCompiler.Builder} */ /** Wraps {@link com.google.errorprone.ErrorProneCompiler.Builder} */
public static class Builder { public static class Builder {


final ErrorProneCompiler.Builder wrappedCompilerBuilder = ErrorProneCompiler.builder(); final BaseErrorProneCompiler.Builder wrappedCompilerBuilder = BaseErrorProneCompiler.builder();


public ErrorProneTestCompiler build() { public ErrorProneTestCompiler build() {
return new ErrorProneTestCompiler(wrappedCompilerBuilder.build()); return new ErrorProneTestCompiler(wrappedCompilerBuilder.build());
Expand All @@ -61,14 +61,14 @@ public Builder redirectOutputTo(PrintWriter printWriter) {
} }
} }


private final ErrorProneCompiler compiler; private final BaseErrorProneCompiler compiler;
private final ErrorProneInMemoryFileManager fileManager = new ErrorProneInMemoryFileManager(); private final ErrorProneInMemoryFileManager fileManager = new ErrorProneInMemoryFileManager();


public ErrorProneInMemoryFileManager fileManager() { public ErrorProneInMemoryFileManager fileManager() {
return fileManager; return fileManager;
} }


private ErrorProneTestCompiler(ErrorProneCompiler compiler) { private ErrorProneTestCompiler(BaseErrorProneCompiler compiler) {
this.compiler = compiler; this.compiler = compiler;
} }


Expand Down

0 comments on commit 953940b

Please sign in to comment.