< prev index next >
test/hotspot/jtreg/runtime/Dictionary/CleanProtectionDomain.java
Print this page
*** 55,69 ****
output.shouldHaveExitValue(0);
}
static class Test {
public static void test() throws Exception {
- Unsafe unsafe = Unsafe.getUnsafe();
TestClassLoader classloader = new TestClassLoader();
ProtectionDomain pd = new ProtectionDomain(null, null);
byte klassbuf[] = InMemoryJavaCompiler.compile("TestClass", "class TestClass { }");
! Class klass = unsafe.defineClass(null, klassbuf, 0, klassbuf.length, classloader, pd);
}
public static void main(String[] args) throws Exception {
WhiteBox wb = WhiteBox.getWhiteBox();
int removedCountOrig = wb.protectionDomainRemovedCount();
--- 55,68 ----
output.shouldHaveExitValue(0);
}
static class Test {
public static void test() throws Exception {
TestClassLoader classloader = new TestClassLoader();
ProtectionDomain pd = new ProtectionDomain(null, null);
byte klassbuf[] = InMemoryJavaCompiler.compile("TestClass", "class TestClass { }");
! Class<?> klass = classloader.defineClass("TestClass", klassbuf, pd);
}
public static void main(String[] args) throws Exception {
WhiteBox wb = WhiteBox.getWhiteBox();
int removedCountOrig = wb.protectionDomainRemovedCount();
*** 89,96 ****
--- 88,99 ----
private static class TestClassLoader extends ClassLoader {
public TestClassLoader() {
super();
}
+
+ public Class<?> defineClass(String name, byte[] bytes, ProtectionDomain pd) {
+ return defineClass(name, bytes, 0, bytes.length, pd);
+ }
}
}
}
< prev index next >