desruisseaux commented on code in PR #987:
URL:
https://github.com/apache/maven-compiler-plugin/pull/987#discussion_r2468403975
##########
src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java:
##########
@@ -1610,38 +1614,26 @@ final void resolveProcessorPathEntries(Map<PathType,
List<Path>> addTo) throws M
* {@return whether an annotation processor seems to be present}
* This method is invoked if the user did not specified explicit
incremental compilation options.
*
+ * @param dependencyTypes the type of dependencies, for checking if any of
them is a processor path
* @param strict whether to be conservative if the current Java version is
older than 23
*
* @see #incrementalCompilation
*/
- private boolean hasAnnotationProcessor(final boolean strict) {
+ private boolean hasAnnotationProcessor(final Set<PathType>
dependencyTypes, final boolean strict) {
if ("none".equalsIgnoreCase(proc)) {
return false;
}
if (proc == null || proc.isBlank()) {
- if (strict && !isVersionEqualOrNewer("RELEASE_23")) {
- return true; // Before Java 23, default value of `-proc` was
`full`.
- }
/*
* If the `proc` parameter was not specified, its default value
depends on the Java version.
* It was "full" prior Java 23 and become "none if no other
processor option" since Java 23.
*/
- if (annotationProcessors == null || annotationProcessors.length ==
0) {
- if (annotationProcessorPaths == null ||
annotationProcessorPaths.isEmpty()) {
- DependencyResolver resolver =
session.getService(DependencyResolver.class);
- if (resolver == null) { // Null value happen during tests,
depending on the mock used.
- return false;
+ if (!strict || isVersionEqualOrNewer("RELEASE_23")) {
+ if (annotationProcessors == null ||
annotationProcessors.length == 0) {
+ if (annotationProcessorPaths == null ||
annotationProcessorPaths.isEmpty()) {
+ return
dependencyTypes.contains(JavaPathType.PROCESSOR_CLASSES)
+ ||
dependencyTypes.contains(JavaPathType.PROCESSOR_MODULES);
}
Review Comment:
This is updated in the latest commit.
--
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]