Skip to content

Allow native access in JDK 25#410

Open
wfouche wants to merge 1 commit intojython:masterfrom
wfouche:dev/enable-native-access
Open

Allow native access in JDK 25#410
wfouche wants to merge 1 commit intojython:masterfrom
wfouche:dev/enable-native-access

Conversation

@wfouche
Copy link
Member

@wfouche wfouche commented Dec 20, 2025

Without this PR fix applied, Jython displays the following warning when using Java 25:

$ java -jar dist/jython-standalone.jar
WARNING: A restricted method in java.lang.System has been called
WARNING: java.lang.System::loadLibrary has been called by org.fusesource.hawtjni.runtime.Library in an unnamed module (file:/C:/Users/wfouche/IdeaProjects/jython/dist/jython-standalone.jar)
WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module
WARNING: Restricted methods will be blocked in a future release unless native access is enabled

Jython 2.7.5a1-SNAPSHOT (heads/dev/console-utf8:26b2e12c0, Mar 11 2026, 11:27:16)
[OpenJDK 64-Bit Server VM (Eclipse Adoptium)] on java25.0.2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

With the fix applied, the warning is suppressed.

$ java -jar dist/jython-standalone.jar
Jython 2.7.5a1-SNAPSHOT (heads/dev/enable-native-access:524cabda9, Mar 11 2026, 11:40:02)
[OpenJDK 64-Bit Server VM (Eclipse Adoptium)] on java25.0.2
Type "help", "copyright", "credits" or "license" for more information.
>>>

To be considered for inclusion in Jython 2.7.5

@wfouche
Copy link
Member Author

wfouche commented Dec 20, 2025

@jeff5 , please review this PR.

@wfouche
Copy link
Member Author

wfouche commented Mar 11, 2026

@Stewori , please review this PR.

@Stewori
Copy link
Member

Stewori commented Mar 11, 2026

Yes, I took a look. IIRC we discussed the idea somewhere else earlier. I was concerned to simply bypass this safety measure in Java, at least as long as it's just a warning. Given that they announce to block it more strictly it is probably indeed the most future-proof decision to adjust this as you suggest. To keep for Jython the "business as usual". I am certain, Jeff will find time to look at this before release. It won't be forgotten, I just won't merge it right now without a second opinion.

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.

2 participants