Java's jlink tool is widely known for creating smaller custom runtime images, but it doesn't validate API signature consistency across modules. This means mismatched module versions (e.g., a method signature change in one module not reflected in another) only surface as NoSuchMethodError at runtime. A custom jlink plug-in using the Animal Sniffer library can perform this validation at link time, failing image creation when incompatible method signatures are detected. The approach is demonstrated with a proof-of-concept plug-in that traverses the resource pool, builds an API signature from all modules, and verifies all classes against it. A key caveat is that the jlink plug-in API is not yet a public, supported JDK API, requiring workarounds via a Java agent. The technique is especially valuable for large modular monolithic applications where converging to a single version of a transitive dependency can introduce subtle incompatibilities.
Sort: