### Question:
ErrorProneJavacPlugin implements Plugin { @Override public String getName() { return "ErrorProne"; }  @Override String getName(); @Override void init(JavacTask javacTask, String... args);  }### Answer:
@Test public void compilesWithFix() throws IOException { File libJar = tempFolder.newFile("lib.jar"); try (FileOutputStream fis = new FileOutputStream(libJar); JarOutputStream jos = new JarOutputStream(fis)) { jos.putNextEntry(new JarEntry("META-INF/services/" + BugChecker.class.getName())); jos.write(TestCompilesWithFix.class.getName().getBytes(UTF_8)); } FileSystem fileSystem = Jimfs.newFileSystem(Configuration.unix()); Path source = fileSystem.getPath("Test.java"); Files.write( source, ImmutableList.of( "import java.util.HashSet;", "import java.util.Set;", "class Test {", " void f() {", " return;", " }", "}"), UTF_8); JavacFileManager fileManager = new JavacFileManager(new Context(), false, UTF_8); fileManager.setLocation( StandardLocation.ANNOTATION_PROCESSOR_PATH, Streams.concat( Stream.of(libJar), Streams.stream( Splitter.on(File.pathSeparatorChar) .split(StandardSystemProperty.JAVA_CLASS_PATH.value())) .map(File::new)) .collect(toImmutableList())); DiagnosticCollector<JavaFileObject> diagnosticCollector = new DiagnosticCollector<>(); JavacTask task = JavacTool.create() .getTask( null, fileManager, diagnosticCollector, ImmutableList.of( "-Xplugin:ErrorProne -XepDisableAllChecks -Xep:TestCompilesWithFix:ERROR", "-XDcompilePolicy=byfile"), ImmutableList.of(), fileManager.getJavaFileObjects(source)); assertThat(task.call()).isFalse(); Diagnostic<? extends JavaFileObject> diagnostic = diagnosticCollector.getDiagnostics().stream() .filter(d -> d.getKind() == Diagnostic.Kind.ERROR) .collect(onlyElement()); assertThat(diagnostic.getMessage(ENGLISH)).contains("[TestCompilesWithFix]"); }