slachiewicz commented on PR #1077:
URL:
https://github.com/apache/maven-compiler-plugin/pull/1077#issuecomment-5400521736
Returning `null` rather than an empty array is load-bearing here, and it is
worth saying why so nobody "simplifies" it later.
`JavacCompiler` guards on null alone:
if (config.getAnnotationProcessors() != null) {
args.add("-processor");
// builds a comma-joined buffer, empty for a zero-length array
A zero-length array therefore still produces `-processor ""`, which is the
original failure. `EclipseJavaCompiler` guards on `!= null && length > 0` and
never had the problem, which is why it only reproduces under javac.
That also suggests where the durable fix lives: the two compilers disagree
about the same field, and the javac side is one condition away from matching.
Any other caller of Plexus Compiler can still reach `-processor ""`. Worth an
issue against plexus-compiler even with this merged.
Two smaller notes:
- The mixed case is a third behavior, and the description covers only two.
`{"", "First", " ", "Second"}` previously reached javac intact and now arrives
as `{"First", "Second"}` — the test asserts exactly this. That is an
improvement, but "normal non-blank processor lists retain their existing
behavior" does not describe it.
- After this change, an empty `<annotationProcessors/>` means "discover
processors normally", not "run none". A user who wrote it meaning the latter
wants `<proc>none</proc>`. No regression, since the build previously just
failed, but the choice is worth being explicit about.
*This comment was created with AI assistance.*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]