gnodet opened a new pull request, #1145:
URL: https://github.com/apache/maven-compiler-plugin/pull/1145

   ## Summary
   
   Builds on top of #1144 (ABI-fingerprint incremental compilation). Replaces 
the ASM bytecode analysis with the standard `java.lang.classfile` API when 
running on JDK 24 or later, keeping ASM as a transparent fallback on older JVMs.
   
   > **Base branch:** This PR is stacked on `feature/abi-incremental` (#1144). 
Please review after #1144 is merged; the diff against `master` includes the 
#1144 commits.
   
   ## Design
   
   Three new classes in the `incremental` package:
   
   | Class | Role |
   |---|---|
   | `ClassAnalyzer` | Strategy interface: `analyze(byte[]) → ClassAnalysis` |
   | `AsmClassAnalyzer` | Existing ASM logic, extracted from `BytecodeAnalyzer` 
|
   | `ClassfileClassAnalyzer` | New impl using `java.lang.classfile` (JDK 24+) |
   | `Sha256` | Shared hashing helper, extracted from `BytecodeAnalyzer` |
   
   `BytecodeAnalyzer` becomes a thin public facade. At class-load time it 
checks `Runtime.version().feature() >= 24` and loads `ClassfileClassAnalyzer` 
reflectively, falling back to `AsmClassAnalyzer` if unavailable.
   
   ## Compilation
   
   `ClassfileClassAnalyzer` is compiled separately with `--release 24` via a 
dedicated `maven-compiler-plugin` execution pointing at `src/main/java24/`. The 
main sources remain at the baseline Java version (17). Both outputs are bundled 
in the same plugin JAR.
   
   ## Correctness
   
   The new cross-validation test 
`asmAndClassfileAnalyzersProduceIdenticalResults` compiles a test class that 
exercises constants, generics, inheritance, exception types, and bytecode 
instructions, then asserts that both implementations produce identical 
`className`, `abiCanonical`, `abiFingerprint`, and `referencedTypes` results.
   
   ## Impact
   
   - **JDK ≥ 24**: uses `java.lang.classfile` — no ASM processing overhead.
   - **JDK < 24**: transparent fallback to ASM, no behaviour change.
   - All 98 unit tests pass (JDK 25).


-- 
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]

Reply via email to