src/java.base/share/classes/sun/invoke/anon/AnonymousClassLoader.java

Print this page
rev 12972 : 8140606: Update library code to use internal Unsafe
Reviewed-by: duke

@@ -76,11 +76,11 @@
     // Privileged constructor.
     private AnonymousClassLoader(Class<?> hostClass) {
         this.hostClass = hostClass;
     }
 
-    public static AnonymousClassLoader make(sun.misc.Unsafe unsafe, Class<?> hostClass) {
+    public static AnonymousClassLoader make(jdk.internal.misc.Unsafe unsafe, Class<?> hostClass) {
         if (unsafe == null)  throw new NullPointerException();
         return new AnonymousClassLoader(hostClass);
     }
 
     public Class<?> loadClass(byte[] classFile) {

@@ -187,17 +187,17 @@
                                   hostClass.getProtectionDomain());
     }
     private static int fakeNameCounter = 99999;
 
     // ignore two warnings on this line:
-    private static sun.misc.Unsafe unsafe = sun.misc.Unsafe.getUnsafe();
+    private static jdk.internal.misc.Unsafe unsafe = jdk.internal.misc.Unsafe.getUnsafe();
     // preceding line requires that this class be on the boot class path
 
     private static final Method defineAnonymousClass;
     static {
         Method dac = null;
-        Class<? extends sun.misc.Unsafe> unsafeClass = unsafe.getClass();
+        Class<? extends jdk.internal.misc.Unsafe> unsafeClass = unsafe.getClass();
         try {
             dac = unsafeClass.getMethod("defineAnonymousClass",
                                         Class.class,
                                         byte[].class,
                                         Object[].class);