gnodet opened a new pull request, #1151: URL: https://github.com/apache/maven-compiler-plugin/pull/1151
## Summary Add multi-release JAR (MRJAR) build infrastructure so the plugin can use the standard `java.lang.classfile` API (JDK 24+) for bytecode analysis while remaining compatible with JDK 17+ at runtime. This is the foundational layer for upcoming ABI-based incremental compilation. This PR adds **no incremental strategy changes** — only the bytecode analysis infrastructure. ## Changes ### Build infrastructure (pom.xml) - **Enforcer**: Require JDK 25+ at build time (`compile-java24` execution needs a JDK that can target release 24) - **Compiler**: `compile-java24` execution compiles `src/main/java24/` into `META-INF/versions/24/` - **JAR plugin**: `Multi-Release: true` manifest entry - **Surefire**: `classesDirectory` trick to prepend `META-INF/versions/24/` on the test classpath (directory mode does not support MRJAR dispatch) ### CI - `.github/workflows/maven-verify.yml`: JDK 25 matrix, drop Microsoft distribution (no JDK 25) ### New source files - `BytecodeAnalyzer` (root, JDK < 24): stub — `isAvailable()` returns `false`, `analyze()` throws `UnsupportedOperationException` - `BytecodeAnalyzer` (java24, JDK 24+): delegates to `ClassfileClassAnalyzer` via `java.lang.classfile` - `ClassfileClassAnalyzer`: full implementation — extracts ABI canonical form, fingerprint, signature/implementation type refs, annotation tracking, module-info support, generic signature parsing - `ClassAnalyzer`: abstract base with shared records (`FieldInfo`, `MethodInfo`), access flag constants, canonical form builder - `Sha256`: truncated SHA-256 hashing utility ### Tests - `BytecodeAnalyzerTest`: descriptor parsing, analyze path/bytes equivalence, generic type fingerprinting, type parameter bounds tracking, idempotency - `CompilerTestHelper`: shared test utility for in-process javac compilation ## Design On JDK 24+, the JVM automatically loads the versioned `BytecodeAnalyzer` from `META-INF/versions/24/`, which delegates to `ClassfileClassAnalyzer` — no reflection needed. On JDK < 24, the root stub is loaded and the caller falls back to the timestamp strategy. Part 1 of 3: MRJAR infrastructure → dependency graph strategy → ABI fingerprint strategy. -- 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]
