-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
SecurityManager is deprecated for removal #1636
Comments
It's being used for StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).getCallerClass() That would require some extra work to support earlier Java versions, but it could potentially use reflection to call that API on Java 9+, or use a Multi-Release jar. |
Just to get some relaxation in here: The current JDK 24-EA happily lets you create a subclass of I think the relevant part is:
|
A lot of relevant discussion here: opensearch-project/OpenSearch#1687 OpenSearch uses JNA and JSM extensively, cc: @reta. |
The SecurityManager class is deprecated for removal since JDK 17. Its getClassContext method is used to optain the calling class when Native#register and Native#unregister are used without the target class being passed in. With JDK 9 the StalkWalker was introduced to make that information available. This change makes both methods available using method handles and prefers the StalkWalker codepath as that is the path expected to be invoked in most cases (on JDK 9+). The AccessController#doProvileged call is replaced by a method handle, assuming, that in an environment where WebStart is available, AccessController is also available. Closes: java-native-access#1636
If anyone is interested, PR #1638 is available with a MH based approach to replace |
The SecurityManager class is deprecated for removal since JDK 17. Its getClassContext method is used to optain the calling class when Native#register and Native#unregister are used without the target class being passed in. With JDK 9 the StalkWalker was introduced to make that information available. This change makes both methods available using method handles and prefers the StalkWalker codepath as that is the path expected to be invoked in most cases (on JDK 9+). The AccessController#doProvileged call is replaced by a method handle, assuming, that in an environment where WebStart is available, AccessController is also available. Closes: java-native-access#1636
SecurityManager
is deprecated for removal in JDK 24, but it's used inNative.getCallingClass()
. That usage has to be removed in order for JNA to be compatible with newer versions of Java.The text was updated successfully, but these errors were encountered: