- Status: Accepted
- Date: 2026-06-27
- Deciders: project maintainer
The bundled libzstd must reach the JVM at runtime. A single fat jar carrying
all six platform libraries bloats every download ~6x. The library also has to
load correctly both on the classpath and as a named JPMS module (ADR 0011).
Ship one zstd-native-<classifier> artifact per platform, each packaging only
its own libzstd.{so,dylib,dll} under native/<classifier>/. At runtime
NativeLibrary computes the classifier from os.name/os.arch, loads the
resource via the class loader, extracts it to an owner-only temp dir, and
dlopens it once at class-init. Callers depend on the library jar plus the one
native jar for their platform (or via the BOM).
- A consumer downloads ~one platform's library, not six.
- The classifier directory name contains a dash, so it is not a valid package and the resource escapes module encapsulation — readable across modules and on the classpath alike.
- Consumers must select the right native artifact (eased by the BOM).
- Six native modules to build and publish.
- New CPU arch silently mis-resolving:
classifier()throws a clearUnsatisfiedLinkErrorfor unsupported arches rather than guessing.
- Fat jar (all platforms): simplest for consumers, 6x bloat for everyone.
- System-installed libzstd: version drift, no hermetic guarantee.
- [NativeLibrary.java], bom/
- ADR 0005 — no lib-path override