You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace usage of SecurityManager and AccessController#doPrivileged
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: #1636
Copy file name to clipboardExpand all lines: CHANGES.md
+2-1
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,8 @@ Next Release (5.16.0)
7
7
8
8
Features
9
9
--------
10
-
*[#1626](https://github.com/java-native-access/jna/pull/1626): Add caching of field list and field validation in `Structure` along with more efficient reentrant read-write locking instead of synchronized() blocks - [@BrettWooldridge](https://github.com/brettwooldridge)
10
+
*[#1626](https://github.com/java-native-access/jna/pull/1626): Add caching of field list and field validation in `Structure` along with more efficient reentrant read-write locking instead of synchronized() blocks - [@BrettWooldridge](https://github.com/brettwooldridge).
11
+
*[#1636](https://github.com/java-native-access/jna/issues/1636): Drop hard dependency on java.lang.SecurityManager/java.security.AccessController - [@matthiasblaesing](https://github.com/matthiasblaesing).
LOG.log(Level.WARNING, "Failed to invoke SecurityManagerExposer#<init> or SecurityManagerExposer#getClassContext", ex);
1620
+
}
1621
+
1622
+
if (context == null) {
1623
+
thrownewIllegalStateException("The SecurityManager implementation on this platform is broken; you must explicitly provide the class to register");
1624
+
}
1625
+
if (context.length < 4) {
1626
+
thrownewIllegalStateException("This method must be called from the static initializer of a class");
1627
+
}
1628
+
returncontext[3];
1537
1629
}
1538
-
returncontext[3];
1630
+
1631
+
thrownewIllegalStateException("Neither the StackWalker, nor the SecurityManager based getCallingClass implementation are useable; you must explicitly provide the class to register");
0 commit comments