desruisseaux commented on code in PR #1136:
URL:
https://github.com/apache/maven-compiler-plugin/pull/1136#discussion_r4178952373
##########
src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java:
##########
@@ -708,15 +708,24 @@ final EnumSet<IncrementalBuild.Aspect>
incrementalCompilationConfiguration() {
}
/**
- * Amends the configuration of incremental compilation for the presence of
annotation processors.
+ * Amends the default configuration of incremental compilation for
annotation processing.
+ * When processing is explicitly requested, incremental compilation is
disabled so that processors always run.
+ * On Java versions before 23, an absent {@code proc} value only implies
the compiler's default processing mode;
+ * it does not prove that a processor is present, so the traditional
rebuild-on-add/change behavior is retained.
+ * This method does not amend an explicitly configured {@link
#incrementalCompilation} value.
*
* @param aspects the configuration to amend if an annotation processor is
found
* @param dependencyTypes the type of dependencies, for checking if any of
them is a processor path
*/
final void amendincrementalCompilation(EnumSet<IncrementalBuild.Aspect>
aspects, Set<PathType> dependencyTypes) {
if (isAbsent(incrementalCompilation) &&
hasAnnotationProcessor(dependencyTypes)) {
- aspects.add(IncrementalBuild.Aspect.REBUILD_ON_ADD);
- aspects.add(IncrementalBuild.Aspect.REBUILD_ON_CHANGE);
+ if (isAbsent(proc) && !isVersionEqualOrNewer(RELEASE_23)) {
+ aspects.add(IncrementalBuild.Aspect.REBUILD_ON_ADD);
Review Comment:
Could you add the following comment (or something equivalent) just below the
`if` statement? In complement to the comment added in the
`hasAnnotationProcessor` method.
```java
// Case when `hasAnnotationProcessor(…)` cannot decide for sure.
// Apply an intermediate strategy between "no processor" and "processor for
sure".
```
--
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]