8177656: Closed/nashorn/JDK_8034967.java starts failing (all platforms) since 9/154
Reviewed-by: jlaskey
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java Wed Apr 19 13:38:54 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java Wed Apr 12 14:35:08 2017 +0530
@@ -114,7 +114,11 @@
@Override
public Class<?> loadClass(final String name, final boolean resolve) throws ClassNotFoundException {
try {
- Context.checkPackageAccess(name);
+ final int i = name.lastIndexOf('.');
+ if(i != -1){
+ final String pkgName = name.substring(0,i);
+ Context.checkPackageAccess(pkgName);
+ }
return super.loadClass(name, resolve);
} catch (final SecurityException se) {
// we may be implementing an interface or extending a class that was