8344549: Cleanup AccessController in sun.misc.Unsafe
Reviewed-by: alanb
This commit is contained in:
parent
78e5008e91
commit
191b38e712
@ -31,11 +31,7 @@ import java.lang.foreign.MemorySegment;
|
||||
import java.lang.foreign.ValueLayout;
|
||||
import java.lang.invoke.VarHandle;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URL;
|
||||
import java.security.AccessController;
|
||||
import java.security.CodeSource;
|
||||
import java.security.ProtectionDomain;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@ -1829,7 +1825,7 @@ public final class Unsafe {
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the options for the depreacted method-access methods.
|
||||
* Represents the options for the deprecated method-access methods.
|
||||
*/
|
||||
private enum MemoryAccessOption {
|
||||
/**
|
||||
@ -1881,14 +1877,8 @@ public final class Unsafe {
|
||||
* Holder for StackWalker that retains class references.
|
||||
*/
|
||||
private static class StackWalkerHolder {
|
||||
static final StackWalker INSTANCE;
|
||||
static {
|
||||
PrivilegedAction<StackWalker> pa = () ->
|
||||
static final StackWalker INSTANCE =
|
||||
StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE);
|
||||
@SuppressWarnings("removal")
|
||||
StackWalker walker = AccessController.doPrivileged(pa);
|
||||
INSTANCE = walker;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1918,9 +1908,7 @@ public final class Unsafe {
|
||||
* Returns a string with the caller class and the location URL from the CodeSource.
|
||||
*/
|
||||
private static String callerAndLocation(Class<?> callerClass) {
|
||||
PrivilegedAction<ProtectionDomain> pa = callerClass::getProtectionDomain;
|
||||
@SuppressWarnings("removal")
|
||||
CodeSource cs = AccessController.doPrivileged(pa).getCodeSource();
|
||||
CodeSource cs = callerClass.getProtectionDomain().getCodeSource();
|
||||
String who = callerClass.getName();
|
||||
if (cs != null && cs.getLocation() != null) {
|
||||
who += " (" + cs.getLocation() + ")";
|
||||
|
Loading…
Reference in New Issue
Block a user