hotspot/test/runtime/contended/DefaultValue.java
changeset 41092 c388d897472d
parent 38152 80e5da81fb2c
--- a/hotspot/test/runtime/contended/DefaultValue.java	Tue Sep 13 21:29:30 2016 +0000
+++ b/hotspot/test/runtime/contended/DefaultValue.java	Wed Sep 14 08:17:50 2016 -0400
@@ -49,20 +49,11 @@
  */
 public class DefaultValue {
 
-    private static final Unsafe U;
+    private static final Unsafe U = Unsafe.getUnsafe();
     private static int ADDRESS_SIZE;
     private static int HEADER_SIZE;
 
     static {
-        // steal Unsafe
-        try {
-            Field unsafe = Unsafe.class.getDeclaredField("theUnsafe");
-            unsafe.setAccessible(true);
-            U = (Unsafe) unsafe.get(null);
-        } catch (NoSuchFieldException | IllegalAccessException e) {
-            throw new IllegalStateException(e);
-        }
-
         // When running with CompressedOops on 64-bit platform, the address size
         // reported by Unsafe is still 8, while the real reference fields are 4 bytes long.
         // Try to guess the reference field size with this naive trick.