equal
deleted
inserted
replaced
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 that gets put in its host's package cannot define |
44 // Test that an anonymous class that gets put in its host's package cannot define |
46 // an anonymous class in another package. |
45 // an anonymous class in another package. |
47 public class NestedUnsafe2 { |
46 public class NestedUnsafe2 { |
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("TestClass2", |
59 byte klassbuf2[] = InMemoryJavaCompiler.compile("TestClass2", |
61 "import jdk.internal.misc.Unsafe; " + |
60 "import jdk.internal.misc.Unsafe; " + |
62 "public class TestClass2 { " + |
61 "public class TestClass2 { " + |