From 06bb1a744d0240b4bde7b6a3168d388aa43dc405 Mon Sep 17 00:00:00 2001 From: Charles Oliver Nutter Date: Wed, 30 Sep 2026 01:05:28 -0500 Subject: [PATCH 1/4] Update jffi dependency scope to 'provided' JFFI should not be a hard dependency of Redline, because that disallows having the version float in projects that utilize Redline like JRuby. Moving this to "provided" makes the dependency soft, expecting that Redline users will "provide" JFFI at an appropriate level. This was previously fixed for Redline in https://github.com/roastedroot/chicory-redline/pull/20 but it appears to have gotten lost along the way. --- redline/runner-jffi/pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/redline/runner-jffi/pom.xml b/redline/runner-jffi/pom.xml index 19da77872..1e29c0035 100644 --- a/redline/runner-jffi/pom.xml +++ b/redline/runner-jffi/pom.xml @@ -17,6 +17,7 @@ com.github.jnr jffi + provided run.endive @@ -38,7 +39,7 @@ com.github.jnr jffi native - runtime + provided From 29c9826bd2a46eb087c76aca0f9c43c5d384875f Mon Sep 17 00:00:00 2001 From: andreatp Date: Wed, 30 Sep 2026 13:20:37 +0100 Subject: [PATCH 2/4] Declare jffi explicitly where the JFFI runner is used With jffi in provided scope, the dependency analyzer flags the native classifier jar as unused, since it has no classes. Its pattern filter cannot match a classifier, so exempt com.github.jnr:jffi in runner-jffi; the main jar is genuinely used there. Provided is not transitive, so runner-jffi-tests and the redline-e2e IT now declare jffi and jffi:native themselves; without them the IT fails with NoClassDefFoundError: com/kenai/jffi/MemoryIO. Document that jffi users add both artifacts, and that a missing jffi is an error rather than a silent fallback. --- docs/docs/experimental/redline.md | 26 ++++++++++++++++++++++++-- redline/it/src/it/redline-e2e/pom.xml | 15 +++++++++++++-- redline/runner-jffi-tests/pom.xml | 20 ++++++++++++++++++++ redline/runner-jffi/pom.xml | 24 +++++++++++++++++++----- 4 files changed, 76 insertions(+), 9 deletions(-) diff --git a/docs/docs/experimental/redline.md b/docs/docs/experimental/redline.md index c43929162..74ede4c27 100644 --- a/docs/docs/experimental/redline.md +++ b/docs/docs/experimental/redline.md @@ -96,7 +96,28 @@ versions use `redline-runner-jffi-experimental`, which needs only Java 11: ``` -If both are present, the Panama runner is used wherever the JDK supports it. +The jffi runner does not bring in [jffi](https://github.com/jnr/jffi) itself, so its version can +follow the rest of your application. Add it next to the runner, together with its native +libraries: + +```xml + + com.github.jnr + jffi + ${jffi.version} + + + com.github.jnr + jffi + ${jffi.version} + native + +``` + +Without them, `builder()` fails with `NoClassDefFoundError: com/kenai/jffi/MemoryIO` instead of +falling back. + +If both runners are present, the Panama runner is used wherever the JDK supports it. Your module is then used exactly as it would be without redline: @@ -110,7 +131,8 @@ try (var instance = MyModule.builder().build()) { When native code cannot be used, `builder()` falls back to the bytecode produced by the [Build Time Compiler](../execution/build-time-compiler.md), which is always generated alongside it. -This happens on platforms outside the table above, or when no runner is on the classpath. +This happens on platforms outside the table above, or when no runner is on the classpath. A jffi +runner without jffi is an error, not a fallback. Your module keeps working either way, so the fallback is silent. To check which one you got: diff --git a/redline/it/src/it/redline-e2e/pom.xml b/redline/it/src/it/redline-e2e/pom.xml index b6b1a7a47..3932dfe0a 100644 --- a/redline/it/src/it/redline-e2e/pom.xml +++ b/redline/it/src/it/redline-e2e/pom.xml @@ -8,8 +8,19 @@ jar - + + + com.github.jnr + jffi + @jffi.version@ + + + com.github.jnr + jffi + @jffi.version@ + native + run.endive redline-runner-jffi-experimental diff --git a/redline/runner-jffi-tests/pom.xml b/redline/runner-jffi-tests/pom.xml index 3c4a56fcc..df72e2c3c 100644 --- a/redline/runner-jffi-tests/pom.xml +++ b/redline/runner-jffi-tests/pom.xml @@ -18,6 +18,17 @@ + + com.github.jnr + jffi + test + + + com.github.jnr + jffi + native + test + org.junit.jupiter junit-jupiter-api @@ -67,6 +78,15 @@ + + org.apache.maven.plugins + maven-dependency-plugin + + + com.github.jnr:jffi + + + run.endive test-gen-plugin diff --git a/redline/runner-jffi/pom.xml b/redline/runner-jffi/pom.xml index 1e29c0035..9d94b82db 100644 --- a/redline/runner-jffi/pom.xml +++ b/redline/runner-jffi/pom.xml @@ -14,11 +14,6 @@ Native code execution via JFFI (Java 11+) - - com.github.jnr - jffi - provided - run.endive redline-api-experimental @@ -35,6 +30,11 @@ run.endive wasm + + com.github.jnr + jffi + provided + com.github.jnr jffi @@ -42,4 +42,18 @@ provided + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + com.github.jnr:jffi + + + + + From 2887a771bf53933c1c96dcffe869d38d8f24371f Mon Sep 17 00:00:00 2001 From: andreatp Date: Thu, 1 Oct 2026 10:19:46 +0100 Subject: [PATCH 3/4] Keep jffi transitive and mark the runner provided in libraries Restore jffi to its normal scopes in redline-runner-jffi, so an application that adds the runner gets jffi with it, and drop the analyzer exclusion and the explicit jffi dependencies that the provided scope required. The version conflict comes from libraries such as prism-parser-wasm depending on the runner at compile scope, which forces their jffi version on applications like JRuby. Document that libraries declare the runner as provided, so the application picks the runner and jffi. --- docs/docs/experimental/redline.md | 29 +++++++++------------------ redline/it/src/it/redline-e2e/pom.xml | 15 ++------------ redline/runner-jffi-tests/pom.xml | 20 ------------------ redline/runner-jffi/pom.xml | 25 +++++------------------ 4 files changed, 17 insertions(+), 72 deletions(-) diff --git a/docs/docs/experimental/redline.md b/docs/docs/experimental/redline.md index 74ede4c27..20be4ec81 100644 --- a/docs/docs/experimental/redline.md +++ b/docs/docs/experimental/redline.md @@ -96,29 +96,21 @@ versions use `redline-runner-jffi-experimental`, which needs only Java 11: ``` -The jffi runner does not bring in [jffi](https://github.com/jnr/jffi) itself, so its version can -follow the rest of your application. Add it next to the runner, together with its native -libraries: +If both are present, the Panama runner is used wherever the JDK supports it. + +If you publish a library rather than an application, declare the runner as `provided`. The +application using your library then picks the runner, and with it the jffi version, instead of +inheriting yours: ```xml - com.github.jnr - jffi - ${jffi.version} - - - com.github.jnr - jffi - ${jffi.version} - native + run.endive + redline-runner-jffi-experimental + ${endive.version} + provided ``` -Without them, `builder()` fails with `NoClassDefFoundError: com/kenai/jffi/MemoryIO` instead of -falling back. - -If both runners are present, the Panama runner is used wherever the JDK supports it. - Your module is then used exactly as it would be without redline: ```text @@ -131,8 +123,7 @@ try (var instance = MyModule.builder().build()) { When native code cannot be used, `builder()` falls back to the bytecode produced by the [Build Time Compiler](../execution/build-time-compiler.md), which is always generated alongside it. -This happens on platforms outside the table above, or when no runner is on the classpath. A jffi -runner without jffi is an error, not a fallback. +This happens on platforms outside the table above, or when no runner is on the classpath. Your module keeps working either way, so the fallback is silent. To check which one you got: diff --git a/redline/it/src/it/redline-e2e/pom.xml b/redline/it/src/it/redline-e2e/pom.xml index 3932dfe0a..b6b1a7a47 100644 --- a/redline/it/src/it/redline-e2e/pom.xml +++ b/redline/it/src/it/redline-e2e/pom.xml @@ -8,19 +8,8 @@ jar - - - com.github.jnr - jffi - @jffi.version@ - - - com.github.jnr - jffi - @jffi.version@ - native - + run.endive redline-runner-jffi-experimental diff --git a/redline/runner-jffi-tests/pom.xml b/redline/runner-jffi-tests/pom.xml index df72e2c3c..3c4a56fcc 100644 --- a/redline/runner-jffi-tests/pom.xml +++ b/redline/runner-jffi-tests/pom.xml @@ -18,17 +18,6 @@ - - com.github.jnr - jffi - test - - - com.github.jnr - jffi - native - test - org.junit.jupiter junit-jupiter-api @@ -78,15 +67,6 @@ - - org.apache.maven.plugins - maven-dependency-plugin - - - com.github.jnr:jffi - - - run.endive test-gen-plugin diff --git a/redline/runner-jffi/pom.xml b/redline/runner-jffi/pom.xml index 9d94b82db..19da77872 100644 --- a/redline/runner-jffi/pom.xml +++ b/redline/runner-jffi/pom.xml @@ -14,6 +14,10 @@ Native code execution via JFFI (Java 11+) + + com.github.jnr + jffi + run.endive redline-api-experimental @@ -30,30 +34,11 @@ run.endive wasm - - com.github.jnr - jffi - provided - com.github.jnr jffi native - provided + runtime - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - com.github.jnr:jffi - - - - - From b79d220caba32a71f80a5559d49870ceb590edfc Mon Sep 17 00:00:00 2001 From: andreatp Date: Thu, 1 Oct 2026 13:16:28 +0100 Subject: [PATCH 4/4] Mark jffi as provided in the JFFI runner --- docs/docs/experimental/redline.md | 29 ++++++++++++++++++--------- redline/it/src/it/redline-e2e/pom.xml | 15 ++++++++++++-- redline/runner-jffi-tests/pom.xml | 11 ++++++++++ redline/runner-jffi/pom.xml | 7 +------ 4 files changed, 44 insertions(+), 18 deletions(-) diff --git a/docs/docs/experimental/redline.md b/docs/docs/experimental/redline.md index 20be4ec81..74ede4c27 100644 --- a/docs/docs/experimental/redline.md +++ b/docs/docs/experimental/redline.md @@ -96,21 +96,29 @@ versions use `redline-runner-jffi-experimental`, which needs only Java 11: ``` -If both are present, the Panama runner is used wherever the JDK supports it. - -If you publish a library rather than an application, declare the runner as `provided`. The -application using your library then picks the runner, and with it the jffi version, instead of -inheriting yours: +The jffi runner does not bring in [jffi](https://github.com/jnr/jffi) itself, so its version can +follow the rest of your application. Add it next to the runner, together with its native +libraries: ```xml - run.endive - redline-runner-jffi-experimental - ${endive.version} - provided + com.github.jnr + jffi + ${jffi.version} + + + com.github.jnr + jffi + ${jffi.version} + native ``` +Without them, `builder()` fails with `NoClassDefFoundError: com/kenai/jffi/MemoryIO` instead of +falling back. + +If both runners are present, the Panama runner is used wherever the JDK supports it. + Your module is then used exactly as it would be without redline: ```text @@ -123,7 +131,8 @@ try (var instance = MyModule.builder().build()) { When native code cannot be used, `builder()` falls back to the bytecode produced by the [Build Time Compiler](../execution/build-time-compiler.md), which is always generated alongside it. -This happens on platforms outside the table above, or when no runner is on the classpath. +This happens on platforms outside the table above, or when no runner is on the classpath. A jffi +runner without jffi is an error, not a fallback. Your module keeps working either way, so the fallback is silent. To check which one you got: diff --git a/redline/it/src/it/redline-e2e/pom.xml b/redline/it/src/it/redline-e2e/pom.xml index b6b1a7a47..3932dfe0a 100644 --- a/redline/it/src/it/redline-e2e/pom.xml +++ b/redline/it/src/it/redline-e2e/pom.xml @@ -8,8 +8,19 @@ jar - + + + com.github.jnr + jffi + @jffi.version@ + + + com.github.jnr + jffi + @jffi.version@ + native + run.endive redline-runner-jffi-experimental diff --git a/redline/runner-jffi-tests/pom.xml b/redline/runner-jffi-tests/pom.xml index 3c4a56fcc..e84f52570 100644 --- a/redline/runner-jffi-tests/pom.xml +++ b/redline/runner-jffi-tests/pom.xml @@ -18,6 +18,17 @@ + + com.github.jnr + jffi + runtime + + + com.github.jnr + jffi + native + runtime + org.junit.jupiter junit-jupiter-api diff --git a/redline/runner-jffi/pom.xml b/redline/runner-jffi/pom.xml index 19da77872..17917a57c 100644 --- a/redline/runner-jffi/pom.xml +++ b/redline/runner-jffi/pom.xml @@ -14,10 +14,6 @@ Native code execution via JFFI (Java 11+) - - com.github.jnr - jffi - run.endive redline-api-experimental @@ -37,8 +33,7 @@ com.github.jnr jffi - native - runtime + provided