From 33e4129155b8e16a532cd1aba057ddaa1eae84a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Nicoll?= Date: Fri, 8 Dec 2023 14:11:38 +0100 Subject: [PATCH] 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 --- .../org/springframework/core/test/tools/TestCompiler.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/spring-core-test/src/main/java/org/springframework/core/test/tools/TestCompiler.java b/spring-core-test/src/main/java/org/springframework/core/test/tools/TestCompiler.java index 9d5b15d1eb74..bb77051b9e7f 100644 --- a/spring-core-test/src/main/java/org/springframework/core/test/tools/TestCompiler.java +++ b/spring-core-test/src/main/java/org/springframework/core/test/tools/TestCompiler.java @@ -311,9 +311,7 @@ private DynamicClassLoader compile() { 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);