[MCOMPILER-607] - Build fails when annotation processor list is empty (but present) - #1077
Open
wilx wants to merge 2 commits into
Open
[MCOMPILER-607] - Build fails when annotation processor list is empty (but present)#1077wilx wants to merge 2 commits into
wilx wants to merge 2 commits into
Conversation
wilx
marked this pull request as ready for review
July 12, 2026 14:54
desruisseaux
approved these changes
Jul 20, 2026
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Fixes a Maven configuration edge case where an explicitly empty <annotationProcessors> block is mapped to an array containing blank strings, which then causes javac to be invoked with an invalid -processor "" argument.
Changes:
- Normalize
annotationProcessorsso an array containing only blank values is treated as “unspecified” (null) before passing to Plexus Compiler. - Add a regression unit test project/config that uses an actually empty
<annotationProcessors>XML block. - Add a unit test asserting compilation succeeds with that configuration.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java | Treats “all-blank” annotation processor arrays as unspecified to avoid passing -processor "" to javac. |
| src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTest.java | Adds a unit test that runs compilation with an empty <annotationProcessors> block and asserts output class exists. |
| src/test/resources/unit/compiler-empty-annotation-processors-test/plugin-config.xml | New test config reproducing Maven’s empty block mapping behavior. |
| src/test/resources/unit/compiler-empty-annotation-processors-test/src/main/java/TestCompile.java | Minimal compilation unit for the new regression test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+861
to
+865
| String[] processors = annotationProcessors; | ||
| if (processors != null && Arrays.stream(processors).allMatch(StringUtils::isBlank)) { | ||
| processors = null; | ||
| } | ||
| compilerConfiguration.setAnnotationProcessors(processors); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #892. [MCOMPILER-607] Build fails when annotation processor list is empty (but present)
When Maven maps an explicitly empty
<annotationProcessors>configuration block, the resulting array contains a blank value rather than being empty ornull. The 3.x compiler plugin passes that array to Plexus Compiler, which then invokesjavacwith-processor "". Compilation fails because the empty processor name cannot be resolved.This change treats an annotation processor array containing only blank values as unspecified before passing it to Plexus Compiler. Normal non-blank processor lists retain their existing behavior.
A regression test uses an actually empty XML
<annotationProcessors>block and verifies that compilation succeeds. This covers the Maven configuration-mapping behavior that caused the bug.Following this checklist to help us incorporate your
contribution quickly and easily:
for the change (usually before you start working on it). Trivial changes like typos do not
require a JIRA issue. Your pull request should address just this issue, without
pulling in other changes.
[MCOMPILER-XXX] - Fixes bug in ApproximateQuantiles,where you replace
MCOMPILER-XXXwith the appropriate JIRA issue. Best practiceis to use the JIRA issue title in the pull request title and in the first line of the
commit message.
mvn clean verifyto make sure basic checks pass. A more thorough check willbe performed on your pull request automatically.
mvn -Prun-its clean verify).If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.
I hereby declare this contribution to be licenced under the Apache License Version 2.0, January 2004
In any other case, please file an Apache Individual Contributor License Agreement.