< prev index next >

src/hotspot/share/classfile/modules.cpp

Print this page




 290               "module is not an instance of type java.lang.Module");
 291   }
 292 
 293   char* module_name = get_module_name(module_handle(), CHECK);
 294   if (module_name == NULL) {
 295     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
 296               "Module name cannot be null");
 297   }
 298 
 299   // Special handling of java.base definition
 300   if (strcmp(module_name, JAVA_BASE_NAME) == 0) {
 301     assert(is_open == JNI_FALSE, "java.base module cannot be open");
 302     define_javabase_module(module, version, location, packages, num_packages, CHECK);
 303     return;
 304   }
 305 
 306   const char* module_version = get_module_version(version);
 307 
 308   oop loader = java_lang_Module::loader(module_handle());
 309   // Make sure loader is not the jdk.internal.reflect.DelegatingClassLoader.
 310   if (loader != java_lang_ClassLoader::non_reflection_class_loader(loader)) {
 311     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
 312               "Class loader is an invalid delegating class loader");
 313   }
 314   Handle h_loader = Handle(THREAD, loader);
 315   // define_module can be called during start-up, before the class loader's ClassLoaderData
 316   // has been created.  SystemDictionary::register_loader ensures creation, if needed.
 317   ClassLoaderData* loader_data = SystemDictionary::register_loader(h_loader);
 318   assert(loader_data != NULL, "class loader data shouldn't be null");
 319 
 320   // Check that the list of packages has no duplicates and that the
 321   // packages are syntactically ok.
 322   GrowableArray<Symbol*>* pkg_list = new GrowableArray<Symbol*>(num_packages);
 323   for (int x = 0; x < num_packages; x++) {
 324     const char* package_name = packages[x];
 325     if (!verify_package_name(package_name)) {
 326       THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
 327                 err_msg("Invalid package name: %s for module: %s",
 328                         package_name, module_name));
 329     }
 330 




 290               "module is not an instance of type java.lang.Module");
 291   }
 292 
 293   char* module_name = get_module_name(module_handle(), CHECK);
 294   if (module_name == NULL) {
 295     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
 296               "Module name cannot be null");
 297   }
 298 
 299   // Special handling of java.base definition
 300   if (strcmp(module_name, JAVA_BASE_NAME) == 0) {
 301     assert(is_open == JNI_FALSE, "java.base module cannot be open");
 302     define_javabase_module(module, version, location, packages, num_packages, CHECK);
 303     return;
 304   }
 305 
 306   const char* module_version = get_module_version(version);
 307 
 308   oop loader = java_lang_Module::loader(module_handle());
 309   // Make sure loader is not the jdk.internal.reflect.DelegatingClassLoader.
 310   if (!oopDesc::unsafe_equals(loader, java_lang_ClassLoader::non_reflection_class_loader(loader))) {
 311     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
 312               "Class loader is an invalid delegating class loader");
 313   }
 314   Handle h_loader = Handle(THREAD, loader);
 315   // define_module can be called during start-up, before the class loader's ClassLoaderData
 316   // has been created.  SystemDictionary::register_loader ensures creation, if needed.
 317   ClassLoaderData* loader_data = SystemDictionary::register_loader(h_loader);
 318   assert(loader_data != NULL, "class loader data shouldn't be null");
 319 
 320   // Check that the list of packages has no duplicates and that the
 321   // packages are syntactically ok.
 322   GrowableArray<Symbol*>* pkg_list = new GrowableArray<Symbol*>(num_packages);
 323   for (int x = 0; x < num_packages; x++) {
 324     const char* package_name = packages[x];
 325     if (!verify_package_name(package_name)) {
 326       THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
 327                 err_msg("Invalid package name: %s for module: %s",
 328                         package_name, module_name));
 329     }
 330 


< prev index next >