Skip to content

[MCOMPILER-563] Clarify that incremental compilation is not an IDE-style incremental compiler - #1123

Open
elharo wants to merge 3 commits into
masterfrom
doc/MCOMPILER-563-clarify-incremental-compilation
Open

elharo wants to merge 3 commits into
masterfrom
doc/MCOMPILER-563-clarify-incremental-compilation

Conversation

@elharo

@elharo elharo commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Improves the documentation for the incrementalCompilation parameter and the deprecated useIncrementalCompilation parameter (issue #777, [MCOMPILER-563]).

The name "incremental compilation" gives the misleading impression that the plugin compiles a single changed class together with its dependents, like an IDE incremental compiler. In reality the plugin only runs a change-detection algorithm that decides whether to recompile the whole module or only the modified source files.

This is a documentation-only change (Javadoc). No Java code behavior is modified. The updated Javadoc is what gets rendered into the plugin's published parameter documentation (plugin-info .html).

Closes #777

elharo and others added 2 commits August 31, 2026 13:21
…yle incremental compiler

Improve the Javadoc of the incrementalCompilation and the deprecated
useIncrementalCompilation parameters. Despite the name, the plugin does not
compile a single changed class together with its dependents like an IDE
incremental compiler. It runs a change-detection algorithm that decides
whether to recompile the whole module or only the modified source files.
@elharo
elharo requested a review from desruisseaux August 31, 2026 13:36
@elharo elharo added the documentation Improvements or additions to documentation label Aug 31, 2026
@desruisseaux

Copy link
Copy Markdown
Contributor

Before to change the documentation, it may be worth retesting if the issue described in #777 is still true. If I remember correctly, this parameter was intended to be incremental compilation in the IDE-style, but was not because of a bug (comparing relative paths against absolute paths).

In version 4.x of the compiler plugin, this parameter does IDE-style incremental compilation, which was apparently the original intend.

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intent of this PR is right — the parameter name is genuinely confusing and the clarification is needed. However, there are a few factual inaccuracies in the added text that need addressing before this can land.

Also, @desruisseaux raised a critical point in the comments: if the v4.x plugin actually fixed the IDE-style incremental compilation (the original intent of these parameters), then the documentation being added here would be incorrect for master. That question needs to be answered before the Javadoc says "never".

This review was generated by an AI agent, Hermès on behalf of @gnodet.

Comment thread src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java Outdated
Comment thread src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java Outdated
@gnodet-bot

Copy link
Copy Markdown

I looked into the actual 4.x behavior in IncrementalBuild.java and AbstractCompilerMojo.java to address @desruisseaux's concern.

Short answer: the PR's claim is correct, and the documentation is accurate for master (4.x) too.

Here's what 4.x actually does:

  • SOURCES aspect (the default): recompiles only the modified source files — not all files, unless a file was added or deleted. This is an improvement in reliability over 3.x (the path comparison bug was fixed), but it is still source-level change detection, not dependency tracking.
  • MODULES aspect: delegates to javac --module, which compiles files newer than their .class output — again, no dependency graph.
  • The existing Javadoc on master already acknowledges this at line 640: "In all cases, the current compiler-plugin does not detect structural changes other than file addition or removal. For example, the plugin does not detect whether a method has been removed in a class."

So the 4.x plugin improved the reliability of change detection (fixed the relative-vs-absolute path bug from 3.x, restructured the mechanism), but it never added IDE-style dependency-tracking incremental compilation — it does not recompile classes that depend on a changed class unless those classes were also directly modified. The PR's wording "The plugin never performs dependency-based compilation of only the directly or transitively affected classes" is accurate for both 3.x and 4.x.

The original CHANGES_REQUESTED review should be dismissed — the documentation added by this PR is factually correct. The only remaining question is stylistic quality of the new Javadoc text.

This comment was generated by an AI agent, Hermès on behalf of @gnodet.

gnodet
gnodet previously requested changes Sep 23, 2026

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intent of this PR is right — the parameter name is genuinely confusing and the clarification is valuable. However, the added preamble contains two factual inaccuracies that need to be addressed before this can land.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@gnodet
gnodet dismissed gnodet-bot’s stale review September 23, 2026 19:26

Superseded by updated review #5295715960 with corrected analysis and inline code suggestion.

…eamble

- Replace 'in most configurations a change causes the whole module to be recompiled'
  with an accurate description: in the default config (no annotation processors, Java ≥ 23)
  only the modified source files are recompiled; a full rebuild requires an options/dep change
  or annotation processor presence.
- Replace the absolute 'never performs dependency-based compilation' claim with a scoped
  statement that carves out the 'modules' algorithm, which delegates per-file recompilation
  to javac --module (as already documented in the 'modules' value Javadoc).
@gnodet
gnodet dismissed their stale review September 23, 2026 20:32

Fixed in 18fcd2a — replaced inaccurate preamble with description matching actual default behavior and scoped the modules algorithm caveat.

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two factual inaccuracies raised in the prior review have been addressed:

  1. "in most configurations a change causes the whole module to be recompiled" — replaced with the accurate per-default description (only modified source files recompiled in the default configuration without annotation processors on Java ≥ 23). ✅
  2. "The plugin never performs dependency-based compilation" — now correctly scoped with the modules carve-out ("except when using the modules algorithm, which delegates this decision to the Java compiler"). ✅

The useIncrementalCompilation (deprecated) block also uses "never", but that is correct in context since this parameter can only map to dependencies,sources,rebuild-on-add or classes — never to the modules algorithm.

The @desruisseaux question (whether 4.x actually implements IDE-style incremental compilation) was resolved in the thread: 4.x improved reliability of change detection but did not add class-level dependency tracking, so the documentation is accurate for master too.

Documentation is accurate and ready to merge.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MCOMPILER-563] Deprecate/rename useIncrementalCompilation

4 participants