Skip to content

Commit

Permalink
Do not discover annotation processors from the classpath in tests
Browse files Browse the repository at this point in the history
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
  • Loading branch information
snicoll committed Dec 8, 2023
1 parent 0717ea5 commit 33e4129
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 33e4129

Please sign in to comment.