@TestTargetNew( level = TestLevel.PARTIAL, notes = "", method = "getUnsafe", args = {} ) public void test_getUnsafeForbiddenWithSystemCaller() throws Exception { Callable<Object> callable = Executors.callable(new Runnable() { public void run() { Unsafe.getUnsafe(); } }); try { callable.call(); fail(); } catch (SecurityException expected) { } }
public static Unsafe getUnsafe() { ClassLoader calling = VMStack.getCallingClassLoader(); if ((calling != null) && (calling != Unsafe.class.getClassLoader())) { throw new SecurityException("Unsafe access denied"); } return THE_ONE; }
Unsafe { public static Unsafe getUnsafe() { ClassLoader calling = VMStack.getCallingClassLoader(); if ((calling != null) && (calling != Unsafe.class.getClassLoader())) { throw new SecurityException("Unsafe access denied"); } return THE_ONE; } }
Unsafe { public static Unsafe getUnsafe() { ClassLoader calling = VMStack.getCallingClassLoader(); if ((calling != null) && (calling != Unsafe.class.getClassLoader())) { throw new SecurityException("Unsafe access denied"); } return THE_ONE; } private  Unsafe(); }
Unsafe { public static Unsafe getUnsafe() { ClassLoader calling = VMStack.getCallingClassLoader(); if ((calling != null) && (calling != Unsafe.class.getClassLoader())) { throw new SecurityException("Unsafe access denied"); } return THE_ONE; } private  Unsafe(); static Unsafe getUnsafe(); long objectFieldOffset(Field field); int arrayBaseOffset(Class clazz); int arrayIndexScale(Class clazz); native boolean compareAndSwapInt(Object obj, long offset,
            int expectedValue, int newValue); native boolean compareAndSwapLong(Object obj, long offset,
            long expectedValue, long newValue); native boolean compareAndSwapObject(Object obj, long offset,
            Object expectedValue, Object newValue); native int getIntVolatile(Object obj, long offset); native void putIntVolatile(Object obj, long offset, int newValue); native long getLongVolatile(Object obj, long offset); native void putLongVolatile(Object obj, long offset, long newValue); native Object getObjectVolatile(Object obj, long offset); native void putObjectVolatile(Object obj, long offset,
            Object newValue); native int getInt(Object obj, long offset); native void putInt(Object obj, long offset, int newValue); native long getLong(Object obj, long offset); native void putLong(Object obj, long offset, long newValue); native Object getObject(Object obj, long offset); native void putObject(Object obj, long offset, Object newValue); void park(boolean absolute, long time); void unpark(Object obj); }
Unsafe { public static Unsafe getUnsafe() { ClassLoader calling = VMStack.getCallingClassLoader(); if ((calling != null) && (calling != Unsafe.class.getClassLoader())) { throw new SecurityException("Unsafe access denied"); } return THE_ONE; } private  Unsafe(); static Unsafe getUnsafe(); long objectFieldOffset(Field field); int arrayBaseOffset(Class clazz); int arrayIndexScale(Class clazz); native boolean compareAndSwapInt(Object obj, long offset,
            int expectedValue, int newValue); native boolean compareAndSwapLong(Object obj, long offset,
            long expectedValue, long newValue); native boolean compareAndSwapObject(Object obj, long offset,
            Object expectedValue, Object newValue); native int getIntVolatile(Object obj, long offset); native void putIntVolatile(Object obj, long offset, int newValue); native long getLongVolatile(Object obj, long offset); native void putLongVolatile(Object obj, long offset, long newValue); native Object getObjectVolatile(Object obj, long offset); native void putObjectVolatile(Object obj, long offset,
            Object newValue); native int getInt(Object obj, long offset); native void putInt(Object obj, long offset, int newValue); native long getLong(Object obj, long offset); native void putLong(Object obj, long offset, long newValue); native Object getObject(Object obj, long offset); native void putObject(Object obj, long offset, Object newValue); void park(boolean absolute, long time); void unpark(Object obj);  }