8235521: Replacement API for Unsafe::ensureClassInitialized

Reviewed-by: alanb, chegar, psandoz
This commit is contained in:
Mandy Chung 2020-06-08 16:55:45 -07:00
parent 6fc6476da8
commit 71d646a160
22 changed files with 708 additions and 83 deletions

View file

@ -25,6 +25,7 @@
package sun.management;
import java.lang.invoke.MethodHandles;
import java.lang.management.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@ -39,7 +40,6 @@ import java.security.AccessController;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import jdk.internal.access.SharedSecrets;
import jdk.internal.misc.VM;
import jdk.internal.misc.VM.BufferPool;
@ -63,7 +63,9 @@ public class ManagementFactoryHelper {
static {
// make sure that the management lib is loaded within
// java.lang.management.ManagementFactory
jdk.internal.misc.Unsafe.getUnsafe().ensureClassInitialized(ManagementFactory.class);
try {
MethodHandles.lookup().ensureInitialized(ManagementFactory.class);
} catch (IllegalAccessException e) {}
}
private static final VMManagement jvm = new VMManagementImpl();