Skip to content

Added JVM flag to disable JNI use warning with JDK 24. #338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

shivam71
Copy link
Member

@shivam71 shivam71 commented Dec 7, 2024

With reference to JEP 472 part of JDK 24. By default warnings are issued for use of JNI . Since nbcode/platform/modules/ext/jna-5.14.0.jar uses JNI adding JVM flag is necessary to ensure no warnings appear with JDK 24 and with future JDKs it works .

JVM Flag enable-native-access support with JDKs

  • The flag is officially supported by JDK 22 Java Command Standard Options section .
  • Though it was introduced as part of the Foreign Functions and Memory API when released as incubator feature in JDK 17 JEP 412 .
  • Manually checking with Oracle JDK 17 onwards using java --help also shows this flag .
  • This flag is part of the OpenJDK 17 onwards checked from JVM Runtime Args JDK 17 . So most vendors that build on top of OpenJDK should support this from JDK 17 onwards .(Checked corretto it does support this flag from 17 Onwards .)

For Testing

  • Download the latest JDK24-ea build.
  • Set JDK Home in JSON preferences in vscode .
  • Open Java project and see in the output channel for 'Oracle Java SE Language' no warnings for JNI appear.
  • Check that extension features work as it is.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Dec 7, 2024
@Achal1607 Achal1607 added this to the JVSC 23.1.0 milestone Dec 7, 2024
Copy link
Member

@lahodaj lahodaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me, thanks!

@Achal1607 Achal1607 merged commit 2ff0fb3 into oracle:main Dec 10, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants