gnodet opened a new pull request, #1153:
URL: https://github.com/apache/maven-compiler-plugin/pull/1153
## Summary
Adds the MRJAR (multi-release JAR) infrastructure for bytecode analysis as
the foundation for a class-level dependency-graph incremental build strategy
(follow-up PR).
## What this PR adds
- **`BytecodeAnalyzer`** — public MRJAR facade with two implementations:
- Root (JDK < 24 stub): `isAvailable()` returns `false`; all `analyze()`
calls throw `UnsupportedOperationException`
- `META-INF/versions/24/` (JDK 24+ real impl): delegates to
`ClassfileClassAnalyzer`
- **`ClassfileClassAnalyzer`** — full bytecode analysis using
`java.lang.classfile` API:
- Classifies type references into `signatureTypes` (public API surface)
and `implementationTypes` (method bodies, private members) using
`isPrivateOrSynthetic()` consistently for both fields and methods (bridge
method correctness)
- Extracts `annotationTypes` for annotation processor cascade decisions
- Handles `module-info.class` with the `module:` prefix convention
- Parses JVM generic signatures (JVMS §4.7.9.1) to track type-argument
dependencies
- Sorts interface list in ABI canonical form for fingerprint stability
- **`ClassAnalyzer`** — abstract base class with shared
`buildCanonicalForm()`, `FieldInfo`/`MethodInfo` records, and
`isPrivateOrSynthetic()` utility
- **`Sha256`** — SHA-256 hash utility (16-char hex prefix for fingerprints)
- **Build configuration**: enforcer requires JDK 25+ to build;
`compile-java24` execution targets `--release 24`, outputs to
`META-INF/versions/24/`; `Multi-Release: true` manifest; Surefire
`classesDirectory` points to versions/24/ so tests exercise the real analyzer
## Test coverage
- `BytecodeAnalyzerTest`: 29 tests covering descriptor parsing, generic
signatures, type arg tracking, formal type parameter bounds, sig/impl split,
`annotationTypes`, `sourceFileName`, `module-info.class` fingerprinting, and
idempotency
## Relation to follow-up PRs
- **PR B (dep-graph)**: adds `SourceFileAnalysis`, `IncrementalState`,
`AbiIncrementalBuild` using `BytecodeAnalyzer` for the `graph` incremental
strategy
- **PR C (abi)**: adds ABI fingerprint-aware cascade on top of PR B
This PR intentionally contains no incremental strategy wiring.
--
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]