hotspot/test/runtime/defineAnonClass/NestedUnsafe.java
changeset 41092 c388d897472d
parent 40923 10fe1c28b9f6
child 45112 fbec2bfa3839
equal deleted inserted replaced
41091:de3789bb384e 41092:c388d897472d
    37 import java.security.ProtectionDomain;
    37 import java.security.ProtectionDomain;
    38 import java.io.InputStream;
    38 import java.io.InputStream;
    39 import java.lang.*;
    39 import java.lang.*;
    40 import jdk.test.lib.*;
    40 import jdk.test.lib.*;
    41 import jdk.internal.misc.Unsafe;
    41 import jdk.internal.misc.Unsafe;
    42 import jdk.test.lib.unsafe.UnsafeHelper;
       
    43 
    42 
    44 
    43 
    45 // Test that an anonymous class in package 'p' cannot define its own anonymous class
    44 // Test that an anonymous class in package 'p' cannot define its own anonymous class
    46 // in another package.
    45 // in another package.
    47 public class NestedUnsafe {
    46 public class NestedUnsafe {
    52         "    public static void concat(String one, String two) throws Throwable { " +
    51         "    public static void concat(String one, String two) throws Throwable { " +
    53         "        System.out.println(one + two);" +
    52         "        System.out.println(one + two);" +
    54         " } } ");
    53         " } } ");
    55 
    54 
    56     public static void main(String args[]) throws Exception {
    55     public static void main(String args[]) throws Exception {
    57         Unsafe unsafe = UnsafeHelper.getUnsafe();
    56         Unsafe unsafe = Unsafe.getUnsafe();
    58 
    57 
    59         // The anonymous class calls defineAnonymousClass creating a nested anonymous class.
    58         // The anonymous class calls defineAnonymousClass creating a nested anonymous class.
    60         byte klassbuf2[] = InMemoryJavaCompiler.compile("p.TestClass2",
    59         byte klassbuf2[] = InMemoryJavaCompiler.compile("p.TestClass2",
    61             "package p; " +
    60             "package p; " +
    62             "import jdk.internal.misc.Unsafe; " +
    61             "import jdk.internal.misc.Unsafe; " +