efegokdemir opened a new pull request, #1160:
URL: https://github.com/apache/maven-compiler-plugin/pull/1160

   ## What
   
   Fall back to `Diagnostic.toString()` when formatting a compiler diagnostic 
throws, so an unavailable CLASS-retained annotation type does not abort 
compilation while logging a warning.
   
   ## Why
   
   On JDK 25, formatting a deprecation diagnostic for an API annotated with a 
non-transitive `CLASS`-retained type-use annotation can throw 
`CompletionFailure`. The exception currently escapes `DiagnosticLogger` and 
fails compilation even though the compiler can continue.
   
   ## How
   
   `DiagnosticLogger` now catches failures from `Diagnostic.getMessage(Locale)` 
and logs the diagnostic's string representation. A unit test covers the 
fallback, and an integration fixture models a provided annotation dependency 
that is absent from the consumer's classpath.
   
   ## Testing
   
   - Fail-before: the new Maven Invoker fixture failed on the unmodified 
implementation with `CompletionFailure: class file for lombok.NonNull not 
found`.
   - Pass-after: 
`JAVA_HOME=/opt/homebrew/opt/openjdk@25/libexec/openjdk.jdk/Contents/Home 
/tmp/maven4/apache-maven-4.0.0-rc-7/bin/mvn -B -Prun-its verify` — 20 unit 
tests passed; 82 integration tests passed, 2 skipped.
   - `JAVA_HOME=/opt/homebrew/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home 
/tmp/maven4/apache-maven-4.0.0-rc-7/bin/mvn -B -Dtest=DiagnosticLoggerTest 
test` — passed.
   
   ## Checklist
   
   - [x] I hereby declare this contribution to be licensed under the [Apache 
License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0)
   


-- 
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]

Reply via email to