gnodet opened a new pull request, #1144:
URL: https://github.com/apache/maven-compiler-plugin/pull/1144
## Summary
Adds an alternative incremental compilation strategy based on ABI
(Application Binary Interface) fingerprinting, alongside the existing
timestamp-based `IncrementalBuild`.
When enabled via `-Dmaven.compiler.incrementalStrategy=abi`, the compiler:
- **Extracts per-type dependencies** during javac's ANALYZE phase,
classifying each as signature-level (affects ABI consumers) or
implementation-level (body-only)
- **Computes ABI fingerprints** from the public API surface (method
signatures, field types, constants, generics, throws clauses)
- **Detects minimal recompilation sets**: body-only changes compile just the
changed file; ABI changes cascade through signature consumers transitively and
implementation consumers directly
- **Tracks cross-module ABI changes** via `.abi-fingerprints` manifests for
reactor builds
- **Caches external dependency fingerprints** by JAR identity (size + mtime)
to avoid redundant bytecode analysis
- **Supports annotation processor classification**
(isolating/aggregating/unknown) following the same META-INF convention as Gradle
### Key differences from the existing timestamp-based approach
| Aspect | Timestamp (current) | ABI (new) |
|---|---|---|
| Change detection | File modification time | Content hash (SHA-256) |
| Recompilation granularity | All-or-nothing on any add/delete | Per-type
with dependency cascade |
| Cross-module | Full rebuild on any dep change | Per-type ABI fingerprint
comparison |
| Dependency tracking | None | Signature vs implementation classification |
### Configuration
```xml
<configuration>
<incrementalStrategy>abi</incrementalStrategy>
</configuration>
```
Or via property: `mvn compile -Dmaven.compiler.incrementalStrategy=abi`
Default remains `timestamp` (existing behavior, unchanged).
### New classes
11 classes in `org.apache.maven.plugin.compiler.incremental`:
- `AbiIncrementalBuild` — engine entry point
- `CompilationAnalyzer` — TaskListener for javac ANALYZE phase
- `DependencyScanner` — TreePathScanner for dep classification
- `AbiExtractor` — ABI fingerprint from javax.lang.model
- `BytecodeAnalyzer` — ASM-based bytecode ABI (cross-module fallback)
- `IncrementalState` — persistent binary state
- `AbiManifest` — cross-module fingerprint manifest (versioned format)
- `ExternalAbiResolver` — classpath scanning with JAR caching
- `ProcessorClassification` — annotation processor type discovery
- `ProcessorType` — ISOLATING / AGGREGATING / UNKNOWN enum
- `SourceFileAnalysis` — per-type analysis record
### Test plan
- [x] 81 new unit tests across 8 test classes covering all incremental/ code
- [x] 2 integration tests (body-only change, ABI cascade)
- [x] All 16 existing tests pass unchanged
- [ ] Manual testing on a multi-module reactor project
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]