< prev index next >

src/hotspot/share/cds/classListParser.cpp

Print this page

449   // The only supported platforms are: (1) Linux/64-bit and (2) Solaris/64-bit and
450   // (3) MacOSX/64-bit and (4) Windowss/64-bit
451   // This #if condition should be in sync with the areCustomLoadersSupportedForCDS
452   // method in test/lib/jdk/test/lib/Platform.java.
453   error("AppCDS custom class loaders not supported on this platform");
454 #endif
455 
456   if (!is_super_specified()) {
457     error("If source location is specified, super class must be also specified");
458   }
459   if (!is_id_specified()) {
460     error("If source location is specified, id must be also specified");
461   }
462   if (strncmp(_class_name, "java/", 5) == 0) {
463     log_info(cds)("Prohibited package for non-bootstrap classes: %s.class from %s",
464           _class_name, _source);
465     THROW_NULL(vmSymbols::java_lang_ClassNotFoundException());
466   }
467 
468   InstanceKlass* k = UnregisteredClasses::load_class(class_name, _source, CHECK_NULL);
469   if (k->local_interfaces()->length() != _interfaces->length()) {




470     print_specified_interfaces();
471     print_actual_interfaces(k);
472     error("The number of interfaces (%d) specified in class list does not match the class file (%d)",
473           _interfaces->length(), k->local_interfaces()->length());
474   }
475 
476   assert(k->is_shared_unregistered_class(), "must be");
477 
478   bool added = SystemDictionaryShared::add_unregistered_class(THREAD, k);
479   if (!added) {
480     // We allow only a single unregistered class for each unique name.
481     error("Duplicated class %s", _class_name);
482   }
483 
484   return k;
485 }
486 
487 void ClassListParser::populate_cds_indy_info(const constantPoolHandle &pool, int cp_index, CDSIndyInfo* cii, TRAPS) {
488   // Caller needs to allocate ResourceMark.
489   int type_index = pool->bootstrap_name_and_type_ref_index_at(cp_index);
490   int name_index = pool->name_ref_index_at(type_index);
491   cii->add_item(pool->symbol_at(name_index)->as_C_string());
492   int sig_index = pool->signature_ref_index_at(type_index);
493   cii->add_item(pool->symbol_at(sig_index)->as_C_string());

449   // The only supported platforms are: (1) Linux/64-bit and (2) Solaris/64-bit and
450   // (3) MacOSX/64-bit and (4) Windowss/64-bit
451   // This #if condition should be in sync with the areCustomLoadersSupportedForCDS
452   // method in test/lib/jdk/test/lib/Platform.java.
453   error("AppCDS custom class loaders not supported on this platform");
454 #endif
455 
456   if (!is_super_specified()) {
457     error("If source location is specified, super class must be also specified");
458   }
459   if (!is_id_specified()) {
460     error("If source location is specified, id must be also specified");
461   }
462   if (strncmp(_class_name, "java/", 5) == 0) {
463     log_info(cds)("Prohibited package for non-bootstrap classes: %s.class from %s",
464           _class_name, _source);
465     THROW_NULL(vmSymbols::java_lang_ClassNotFoundException());
466   }
467 
468   InstanceKlass* k = UnregisteredClasses::load_class(class_name, _source, CHECK_NULL);
469   const int actual_num_interfaces = k->local_interfaces()->length();
470   const int specified_num_interfaces = _interfaces->length(); // specified in classlist
471   int expected_num_interfaces = actual_num_interfaces;
472 
473   if (specified_num_interfaces != expected_num_interfaces) {
474     print_specified_interfaces();
475     print_actual_interfaces(k);
476     error("The number of interfaces (%d) specified in class list does not match the class file (%d)",
477           specified_num_interfaces, expected_num_interfaces);
478   }
479 
480   assert(k->is_shared_unregistered_class(), "must be");
481 
482   bool added = SystemDictionaryShared::add_unregistered_class(THREAD, k);
483   if (!added) {
484     // We allow only a single unregistered class for each unique name.
485     error("Duplicated class %s", _class_name);
486   }
487 
488   return k;
489 }
490 
491 void ClassListParser::populate_cds_indy_info(const constantPoolHandle &pool, int cp_index, CDSIndyInfo* cii, TRAPS) {
492   // Caller needs to allocate ResourceMark.
493   int type_index = pool->bootstrap_name_and_type_ref_index_at(cp_index);
494   int name_index = pool->name_ref_index_at(type_index);
495   cii->add_item(pool->symbol_at(name_index)->as_C_string());
496   int sig_index = pool->signature_ref_index_at(type_index);
497   cii->add_item(pool->symbol_at(sig_index)->as_C_string());
< prev index next >