提交 3928283a 编写于 作者: S sundar

8032954: Nashorn: extend Java.extend

Reviewed-by: attila, jlaskey, ahgross
上级 fd4ef569
......@@ -110,6 +110,8 @@ public final class JavaAdapterFactory {
for (Class<?> type : types) {
// check for restricted package access
Context.checkPackageAccess(type);
// check for classes, interfaces in reflection
ReflectionCheckLinker.checkReflectionAccess(type);
}
}
return getAdapterInfo(types).getAdapterClassFor(classOverrides);
......
......@@ -25,7 +25,7 @@
* Try to bind properties of StaticClass representing Class.
*
* @test
* @security
* @bug JDK-8032943: Improve reflection in Nashorn
*/
......
......@@ -26,6 +26,7 @@
*
* @test
* @security
* @bug JDK-8032954: Nashorn: extend Java.extend
*/
try {
......@@ -39,3 +40,24 @@ try {
}
}
try {
Java.extend(Java.type('java.lang.ClassLoader'));
fail("should have thrown SecurityException");
} catch (e) {
if (e instanceof java.lang.SecurityException) {
print(e);
} else {
fail("expected SecurityException, got " + e);
}
}
try {
Java.extend(Java.type("javax.management.loading.MLet"));
fail("should have thrown SecurityException");
} catch (e) {
if (e instanceof java.lang.SecurityException) {
print(e);
} else {
fail("expected SecurityException, got " + e);
}
}
java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "nashorn.JavaReflection")
java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "nashorn.JavaReflection")
java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "nashorn.JavaReflection")
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册