116 * the boot class loader. It is not used for class loading. 117 */ 118 private static class BootClassLoader extends BuiltinClassLoader { 119 BootClassLoader(URLClassPath bcp) { 120 super(null, bcp); 121 } 122 123 @Override 124 protected Class<?> loadClassOrNull(String cn) { 125 return JLA.findBootstrapClassOrNull(this, cn); 126 } 127 }; 128 129 /** 130 * The extension class loader, a unique type to make it easier to distinguish 131 * from the application class loader. 132 */ 133 private static class ExtClassLoader extends BuiltinClassLoader { 134 static { 135 if (!ClassLoader.registerAsParallelCapable()) 136 throw new InternalError(); 137 } 138 139 ExtClassLoader(BootClassLoader parent) { 140 super(parent, null); 141 } 142 143 /** 144 * Called by the VM to support define package for AppCDS. 145 * 146 * Shared classes are returned in ClassLoader::findLoadedClass 147 * that bypass the defineClass call. 148 */ 149 private Package definePackage(String pn, Module module) { 150 return JLA.definePackage(this, pn, module); 151 } 152 } 153 154 /** 155 * The application class loader that is a {@code BuiltinClassLoader} with 156 * customizations to be compatible with long standing behavior. 157 */ 158 private static class AppClassLoader extends BuiltinClassLoader { 159 static { 160 if (!ClassLoader.registerAsParallelCapable()) 161 throw new InternalError(); 162 } 163 164 final URLClassPath ucp; 165 166 AppClassLoader(ExtClassLoader parent, URLClassPath ucp) { 167 super(parent, ucp); 168 this.ucp = ucp; 169 } 170 171 @Override 172 protected Class<?> loadClass(String cn, boolean resolve) 173 throws ClassNotFoundException 174 { 175 // for compatibility reasons, say where restricted package list has 176 // been updated to list API packages in the unnamed module. 177 SecurityManager sm = System.getSecurityManager(); 178 if (sm != null) { 179 int i = cn.lastIndexOf('.'); 180 if (i != -1) { 181 sm.checkPackageAccess(cn.substring(0, i)); | 116 * the boot class loader. It is not used for class loading. 117 */ 118 private static class BootClassLoader extends BuiltinClassLoader { 119 BootClassLoader(URLClassPath bcp) { 120 super(null, bcp); 121 } 122 123 @Override 124 protected Class<?> loadClassOrNull(String cn) { 125 return JLA.findBootstrapClassOrNull(this, cn); 126 } 127 }; 128 129 /** 130 * The extension class loader, a unique type to make it easier to distinguish 131 * from the application class loader. 132 */ 133 private static class ExtClassLoader extends BuiltinClassLoader { 134 static { 135 if (!ClassLoader.registerAsParallelCapable()) 136 throw new InternalError("Classloader is not registered" + 137 " as parallel capable."); 138 } 139 140 ExtClassLoader(BootClassLoader parent) { 141 super(parent, null); 142 } 143 144 /** 145 * Called by the VM to support define package for AppCDS. 146 * 147 * Shared classes are returned in ClassLoader::findLoadedClass 148 * that bypass the defineClass call. 149 */ 150 private Package definePackage(String pn, Module module) { 151 return JLA.definePackage(this, pn, module); 152 } 153 } 154 155 /** 156 * The application class loader that is a {@code BuiltinClassLoader} with 157 * customizations to be compatible with long standing behavior. 158 */ 159 private static class AppClassLoader extends BuiltinClassLoader { 160 static { 161 if (!ClassLoader.registerAsParallelCapable()) 162 throw new InternalError("Classloader is not registered" + 163 " as parallel capable."); 164 } 165 166 final URLClassPath ucp; 167 168 AppClassLoader(ExtClassLoader parent, URLClassPath ucp) { 169 super(parent, ucp); 170 this.ucp = ucp; 171 } 172 173 @Override 174 protected Class<?> loadClass(String cn, boolean resolve) 175 throws ClassNotFoundException 176 { 177 // for compatibility reasons, say where restricted package list has 178 // been updated to list API packages in the unnamed module. 179 SecurityManager sm = System.getSecurityManager(); 180 if (sm != null) { 181 int i = cn.lastIndexOf('.'); 182 if (i != -1) { 183 sm.checkPackageAccess(cn.substring(0, i)); |