Add hegel-jna: a JNA-backed artifact supporting Java 17+ - #19
Merged
Conversation
Split the build into two published artifacts that share one API and one source tree: - dev.hegel:hegel — the existing FFM binding, unchanged for users (Java 22+, Automatic-Module-Name dev.hegel). - dev.hegel:hegel-jna — a new JNA binding (Java 17+), with net.java.dev.jna:jna as its only dependency. To make the binding seam backend-neutral, opaque engine handles now cross the Libhegel interface as raw addresses (long, 0 = NULL) instead of MemorySegment; RealLibhegel wraps/unwraps at the FFI boundary and FakeLibhegel no longer touches java.lang.foreign. Each module supplies a package-private LibhegelBackend.open(Path) that Engine calls without knowing which backend it got. The backend-neutral sources and tests move to shared/, compiled into both jars via build-helper add-source, so the whole behaviour suite runs against both bindings (242 tests on FFM, 241 on JNA, 100% instruction+branch coverage per module). JnaLibhegel maps C bool as byte and size_t as long (the bundled natives are all 64-bit), passes date/time structs by value, and holds each run's output callback strongly until runFree. Build and tooling follow the multi-module layout: hegel-parent pom, per-module natives fetch and jacoco gates, a test-jna CI job proving the artifact runs on JDK 17 and 21, release.py bumping all three poms and verifying both artifacts on Central, and README/CLAUDE.md docs. Surefire now passes --enable-native-access=ALL-UNNAMED in both modules (JNA triggers the JDK 24+ JEP 472 warning too). The shared suite's one Java-21 construct (record patterns in ConformanceTest) is rewritten for 17, and the Nd-category assertion tolerates codepoints newer than the running JVM's Unicode tables. Co-Authored-By: Claude Fable 5 <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.
Split the build into two published artifacts that share one API and one source tree:
Details
To make the binding seam backend-neutral, opaque engine handles now cross the Libhegel interface as raw addresses (long, 0 = NULL) instead of MemorySegment; RealLibhegel wraps/unwraps at the FFI boundary and FakeLibhegel no longer touches java.lang.foreign. Each module supplies a package-private LibhegelBackend.open(Path) that Engine calls without knowing which backend it got.The backend-neutral sources and tests move to shared/, compiled into both jars via build-helper add-source, so the whole behaviour suite runs against both bindings (242 tests on FFM, 241 on JNA, 100% instruction+branch coverage per module). JnaLibhegel maps C bool as byte and size_t as long (the bundled natives are all 64-bit), passes date/time structs by value, and holds each run's output callback strongly until runFree.
Build and tooling follow the multi-module layout: hegel-parent pom, per-module natives fetch and jacoco gates, a test-jna CI job proving the artifact runs on JDK 17 and 21, release.py bumping all three poms and verifying both artifacts on Central, and README/CLAUDE.md docs. Surefire now passes --enable-native-access=ALL-UNNAMED in both modules (JNA triggers the JDK 24+ JEP 472 warning too). The shared suite's one Java-21 construct (record patterns in ConformanceTest) is rewritten for 17, and the Nd-category assertion tolerates codepoints newer than the running JVM's Unicode tables.
Co-Authored-By: Claude Fable 5 noreply@anthropic.com