< prev index next >
test/runtime/Unsafe/PrimitiveHostClass.java
Print this page
@@ -37,20 +37,11 @@
* @run main/othervm PrimitiveHostClass
*/
public class PrimitiveHostClass {
- static final Unsafe U;
- static {
- try {
- Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
- theUnsafe.setAccessible(true);
- U = (Unsafe) theUnsafe.get(null);
- } catch (Exception e) {
- throw new AssertionError(e);
- }
- }
+ static final Unsafe U = Unsafe.getUnsafe();
public static void testVMAnonymousClass(Class<?> hostClass) {
// choose a class name in the same package as the host class
String prefix = packageName(hostClass);
< prev index next >