8161129: Unsafe::getUnsafe should allow the platform class loader to access it
authorpsandoz
Tue, 19 Jul 2016 16:36:09 +0200
changeset 39745 017b6227091d
parent 39744 cb1b0f85f8b4
child 39746 e3a56c19a668
8161129: Unsafe::getUnsafe should allow the platform class loader to access it Reviewed-by: forax, jrose
jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java
--- a/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java	Tue Jul 19 09:37:28 2016 +0800
+++ b/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java	Tue Jul 19 16:36:09 2016 +0200
@@ -26,8 +26,6 @@
 package jdk.internal.misc;
 
 import jdk.internal.HotSpotIntrinsicCandidate;
-import jdk.internal.reflect.CallerSensitive;
-import jdk.internal.reflect.Reflection;
 import jdk.internal.vm.annotation.ForceInline;
 
 import java.lang.reflect.Field;
@@ -57,7 +55,6 @@
     private static native void registerNatives();
     static {
         registerNatives();
-        Reflection.registerMethodsToFilter(Unsafe.class, "getUnsafe");
     }
 
     private Unsafe() {}
@@ -87,16 +84,8 @@
      * }}</pre>
      *
      * (It may assist compilers to make the local variable {@code final}.)
-     *
-     * @throws  SecurityException if the class loader of the caller
-     *          class is not in the system domain in which all permissions
-     *          are granted.
      */
-    @CallerSensitive
     public static Unsafe getUnsafe() {
-        Class<?> caller = Reflection.getCallerClass();
-        if (!VM.isSystemDomainLoader(caller.getClassLoader()))
-            throw new SecurityException("Unsafe");
         return theUnsafe;
     }