Do not discover annotation processors from the classpath in tests

Previously, if an annotation processors was present in the classpath
it was executed as part of tests using `TestCompiler`.

This commit updates `TestCompiler` to always set the annotation
processors to use. By default, this sets an empty list which does not
use annotation processing.

Closes gh-31791
This commit is contained in:
Stéphane Nicoll 2023-12-08 14:11:38 +01:00
parent 0717ea5ca5
commit 33e4129155
1 changed files with 1 additions and 3 deletions

View File

@ -311,9 +311,7 @@ public final class TestCompiler {
Errors errors = new Errors();
CompilationTask task = this.compiler.getTask(null, fileManager, errors,
this.compilerOptions, null, compilationUnits);
if (!this.processors.isEmpty()) {
task.setProcessors(this.processors);
}
boolean result = task.call();
if (!result || errors.hasReportedErrors()) {
throw new CompilationException(errors.toString(), this.sourceFiles, this.resourceFiles);