Skip to content

fix: Skip JNI native access check on JDK < 24 (fixes #1689)#1692

Merged
gnodet merged 1 commit intomasterfrom
fix/jni-native-access-check-1689
Mar 9, 2026
Merged

fix: Skip JNI native access check on JDK < 24 (fixes #1689)#1692
gnodet merged 1 commit intomasterfrom
fix/jni-native-access-check-1689

Conversation

@gnodet
Copy link
Copy Markdown
Member

@gnodet gnodet commented Mar 9, 2026

Summary

  • checkNativeAccess() in JniTerminalProvider and ExecTerminalProvider used reflection to call Module.isNativeAccessEnabled(), assuming it only exists on JDK 22+
  • OpenJDK 21.0.10 backported this method, causing it to return false and throw UnsupportedOperationException even though JNI works fine without --enable-native-access on JDK < 24
  • JNI native access restrictions are only enforced from JDK 24+, so skip the check on earlier versions

Fixes #1689

Module.isNativeAccessEnabled() was backported to some JDK 21 builds
(e.g. 21.0.10), causing a false UnsupportedOperationException since the
method returns false even though JNI works without --enable-native-access.
JNI native access restrictions are only enforced from JDK 24+, so skip
the check on earlier versions.
@gnodet gnodet merged commit f6a7673 into master Mar 9, 2026
9 checks passed
@gnodet gnodet added this to the 4.0.1 milestone Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JNI terminal is failing to load

1 participant