GeezerVison is showing github.com — Add jextract plugin for code generation by miroswan · Pull Request #17084 · netty/netty
Conversation
miroswan
commented
Jul 10, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Motivation:
Netty's upcoming java.lang.foreign (FFM) transports (starting with kqueue on macOS) need Java bindings to libc and syscalls. jextract can generate those from C headers, but making jextract a build dependency would put a JDK tool on every contributor's and CI build path, and generating at build time makes the output depend on whatever toolchain happens to be installed. We want the generated bindings committed to git, reproducible, and produced without jextract ever being required to build Netty. No existing Netty build step provides a declarative, testable generator with a reproducibility gate around committed generated code.
Modification:
Adds netty5-jextract-maven-plugin (new module, registered in the root <modules>). Its generate goal drives a pre-installed jextract, one invocation per <binding>, and is deliberately not bound to any lifecycle phase, so it runs on demand and the output is committed. Ordinary builds and CI compile the committed sources and never invoke or require jextract.
Key behaviors:
- Verifies
jextract --version against a configured <jextractVersion> and fails on mismatch, so a divergent binary cannot silently produce different sources.
- Reads the OS SDK's system headers directly (no vendored headers);
<functions>/<structs>/... map to jextract --include-* flags. Generation is inherently per-OS.
- Generates into
target/, then prunes the target package and swaps the new tree into src/main/java via an atomic rename, rolling back and preserving the previous tree if the swap fails.
- Writes a deterministic
GENERATED.properties provenance manifest (jextract version, OS, SDK id) beside the sources.
- Validates configuration up front: duplicate class names, shared struct/union/typedef symbols (which would clobber on disk), blank symbols, and an invalid
targetPackage are rejected with actionable messages.
Also adds docs/Jextract.md (plugin usage and the recommended <bindings> layout) and docs/FFM-Build-Strategy.md (how the FFM transport modules will be structured). No FFM transport module is added in this PR.
The plugin targets Java 17 (it runs in Maven's JVM using only ProcessBuilder); the generated bindings and the future transports target Java 25.
Result:
No existing behavior changes: no current module or consumer build path is affected. Netty gains a reproducible, on-demand generator for committed FFM bindings, with jextract required only when regenerating, never to build.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
|
|
- Module naming: `transport-ffm-native-kqueue` vs `transport-ffm-bindings-kqueue`.
|
|
|
- JDK gating: profile-skip on JDK < 25 vs. hard-require 25 to build.
|
|
|
- Exact jextract option for pinning the SDK sysroot (may be `SDKROOT` or a clang-arg passthrough
|
|
|
rather than a first-class flag).
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what this means.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
miroswan
Aug 7, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, that was too terse. The intent: for reproducible output jextract must always read a fixed SDK's headers rather than whatever the host happens to resolve. I reworded the bullet to say that plainly and list the candidate mechanisms (SDKROOT, which xcrun and clang honor, or passing -isysroot/--sysroot through jextract's clang argument passthrough, since jextract has no first class flag for it). It stays an open question and is not being solved in this PR.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just two small things, and then I think it's good.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…ails a completed generation
…truct/typedef/union vs header class
…h, ALL-UNNAMED on the classpath
testlens-app
Bot
commented
Aug 7, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
🚨 TestLens detected 1 failed test 🚨
Here is what you can do:
- Inspect the test failures carefully.
- If you are convinced that some of the tests are flaky, you can mute them below.
- Finally, trigger a rerun by checking the rerun checkbox.
Test Summary
| Test |
Runs |
Flakiness |
| OpenSslCertificateCompressionTest |
🚫 ❌ |
0% 🟢 |
🏷️ Commit: 0473878
▶️ Tests: 218314 executed
⚪️ Checks: 12/12 completed
Test Failures
OpenSslCertificateCompressionTest (Netty/Handler in Build PR / windows-x86_64-java25-boringssl)
java.lang.IllegalStateException: Possible memory leak detected for resource scope 'OpenSslCertificateCompressionTest'. Please use paranoid leak detection to get more information, or set -Dio.netty.util.LeakPresenceDetector.trackCreationStack=true
at io.netty.util.LeakPresenceDetector$ResourceScope.check(LeakPresenceDetector.java:308)
at io.netty.util.LeakPresenceDetector$ResourceScope.close(LeakPresenceDetector.java:328)
at io.netty.util.test.LeakPresenceExtension.afterAll(LeakPresenceExtension.java:140)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:511)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1450)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:2019)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:187)
Muted Tests
Select tests to mute in this pull request:
- OpenSslCertificateCompressionTest
Reuse successful test results:
- ♻️ Only rerun the tests that failed or were muted before
Click the checkbox to trigger a rerun:
Learn more about TestLens at testlens.app.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|