8032954: Nashorn: extend Java.extend
Reviewed-by: jlaskey, attila, ahgross
This commit is contained in:
parent
3d9115510c
commit
6d897ac7a8
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -1 +1,3 @@
|
||||
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")
|
||||
|
Loading…
Reference in New Issue
Block a user