Thanks to visit codestin.com
Credit goes to github.com

Skip to content

JDK 25 restricted method warning #371

@lowecg

Description

@lowecg

As you're probably well aware, JDK 25 now emits the following warning:

WARNING: A restricted method in java.lang.System has been called
WARNING: java.lang.System::load has been called by com.github.luben.zstd.util.Native$2 in an unnamed module (file:/Users/xxx/.m2/repository/com/github/luben/zstd-jni/1.5.7-4/zstd-jni-1.5.7-4.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

The "Use --enable-native-access=ALL-UNNAMED" advice is clear enough, but I wanted to raise the question of what this means for future JDK releases with respect to this library.

Does this imply that JNI needs to be migrated to Java Foreign Function and Memory (FFM)? Or is it just saying that a future JDK release will start to enforce the need to specify native components irrespective of JNI or FFM?

I tried --enable-native-access=com.github.luben.zstd but that failed, as the warning already stated the module is unnamed!

Would it be possible to give this module a name so we can name it specifically for native access?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions