Browse Source

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
pull/31796/head
Stéphane Nicoll 2 years ago
parent
commit
33e4129155
  1. 4
      spring-core-test/src/main/java/org/springframework/core/test/tools/TestCompiler.java

4
spring-core-test/src/main/java/org/springframework/core/test/tools/TestCompiler.java

@ -311,9 +311,7 @@ public final class TestCompiler { @@ -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);
}
task.setProcessors(this.processors);
boolean result = task.call();
if (!result || errors.hasReportedErrors()) {
throw new CompilationException(errors.toString(), this.sourceFiles, this.resourceFiles);

Loading…
Cancel
Save