feat: add a JPMS module descriptor#25
Open
dfa1 wants to merge 1 commit into
Open
Conversation
- module-info.java exports the single public package. Lets modular consumers `requires io.github.dfa1.zstd` and scope native access with `--enable-native-access=io.github.dfa1.zstd` instead of ALL-UNNAMED. - Suppress the module-name lint: the `dfa1` component ends in a digit (flagged as possibly version-like), but it mirrors the verified io.github.dfa1 namespace and the package, so keep it. - NativeLibrary now loads the bundled library through the class loader (no leading slash) rather than Class#getResourceAsStream: the library lives in a separate zstd-native-<classifier> module and a named module only finds resources in itself. The classifier directory has a dash, so it is not a package and the resource is not module-encapsulated — the class loader reads it across modules and on the classpath alike. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make
zstda proper named module:module io.github.dfa1.zstd { exports io.github.dfa1.zstd; }.Why
Modular consumers can now
requires io.github.dfa1.zstdand grant native access to just this module (--enable-native-access=io.github.dfa1.zstd) instead of the blanketALL-UNNAMED. (The flag is still required either way — FFM downcalls are restricted.)Notes / gotchas handled
dfa1(terminal digit, possibly version-like) and the build uses-Werror. Suppressed with@SuppressWarnings("module")+ a comment — it mirrors the Sonatype-verifiedio.github.dfa1namespace and the package name, so diverging would be worse.zstdmodule runs on the module path, whereClass#getResourceAsStreamonly sees its own module — so the bundledlibzstd(in a separatezstd-native-<classifier>jar) wasn't found and every test failed withUnsatisfiedLinkError. Fixed by loading through the class loader (no leading slash); the classifier directory name has a dash, so the resource isn't in a package and isn't module-encapsulated → readable across modules and on the classpath alike.Retest
./mvnw verify(full reactor) — all unit + 79 integration tests green, checkstyle + javadoc clean across all 12 modules. Native library loads on the module path.Known benign warning: the
benchmarkJMH uber-jar shade reports "Discovered module-info.class. Shading will break its strong encapsulation" — harmless for the non-published benchmark harness.🤖 Generated with Claude Code