8161129: Unsafe::getUnsafe should allow the platform class loader to access it
Reviewed-by: forax, jrose
--- 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;
}