// Keep a copy so that we can check that the one passed-in isn't mutated
Map<String, CompiledClass> knownValidClasses =
new HashMap<String, CompiledClass>(validClasses);
// Collect more compilation errors where extra units are thrown out by unit invalidation.
CompilerContext compilerContext = new CompilerContext.Builder().build();
// Invoke the method under test
CompilationUnitInvalidator.retainValidUnits(TreeLogger.NULL, units, validClasses,
compilerContext.getLocalCompilationErrorsIndex());
// Check that the compilation errors index was correctly populated.
UnitTestTreeLogger.Builder loggerBuilder = new UnitTestTreeLogger.Builder();
loggerBuilder.setLowestLogLevel(TreeLogger.TRACE);
loggerBuilder.expectTrace("Tracing compile failure path for type 'bad6'", null);