< prev index next >

src/hotspot/share/cds/classListParser.cpp

Print this page

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




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

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