hotspot/test/runtime/Unsafe/PrimitiveHostClass.java
changeset 41092 c388d897472d
parent 40631 ed82623d7831
equal deleted inserted replaced
41091:de3789bb384e 41092:c388d897472d
    37  * @run main/othervm PrimitiveHostClass
    37  * @run main/othervm PrimitiveHostClass
    38  */
    38  */
    39 
    39 
    40 public class PrimitiveHostClass {
    40 public class PrimitiveHostClass {
    41 
    41 
    42     static final Unsafe U;
    42     static final Unsafe U = Unsafe.getUnsafe();
    43     static {
       
    44         try {
       
    45             Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
       
    46             theUnsafe.setAccessible(true);
       
    47             U = (Unsafe) theUnsafe.get(null);
       
    48         } catch (Exception e) {
       
    49             throw new AssertionError(e);
       
    50         }
       
    51     }
       
    52 
    43 
    53     public static void testVMAnonymousClass(Class<?> hostClass) {
    44     public static void testVMAnonymousClass(Class<?> hostClass) {
    54 
    45 
    55         // choose a class name in the same package as the host class
    46         // choose a class name in the same package as the host class
    56         String prefix = packageName(hostClass);
    47         String prefix = packageName(hostClass);