528 }
529 if (strncmp(_class_name, "java/", 5) == 0) {
530 log_info(cds)("Prohibited package for non-bootstrap classes: %s.class from %s",
531 _class_name, _source);
532 THROW_NULL(vmSymbols::java_lang_ClassNotFoundException());
533 }
534
535 ResourceMark rm;
536 char * source_path = os::strdup_check_oom(ClassLoader::uri_to_path(_source));
537 InstanceKlass* specified_super = lookup_class_by_id(_super);
538 Handle super_class(THREAD, specified_super->java_mirror());
539 objArrayOop r = get_specified_interfaces(CHECK_NULL);
540 objArrayHandle interfaces(THREAD, r);
541 InstanceKlass* k = UnregisteredClasses::load_class(class_name, source_path,
542 super_class, interfaces, CHECK_NULL);
543 if (k->java_super() != specified_super) {
544 error("The specified super class %s (id %d) does not match actual super class %s",
545 specified_super->external_name(), _super,
546 k->java_super()->external_name());
547 }
548 if (k->local_interfaces()->length() != _interfaces->length()) {
549 print_specified_interfaces();
550 print_actual_interfaces(k);
551 error("The number of interfaces (%d) specified in class list does not match the class file (%d)",
552 _interfaces->length(), k->local_interfaces()->length());
553 }
554
555 assert(k->is_shared_unregistered_class(), "must be");
556
557 bool added = SystemDictionaryShared::add_unregistered_class(THREAD, k);
558 if (!added) {
559 // We allow only a single unregistered class for each unique name.
560 error("Duplicated class %s", _class_name);
561 }
562
563 return k;
564 }
565
566 void ClassListParser::populate_cds_indy_info(const constantPoolHandle &pool, int cp_index, CDSIndyInfo* cii, TRAPS) {
567 // Caller needs to allocate ResourceMark.
568 int type_index = pool->bootstrap_name_and_type_ref_index_at(cp_index);
569 int name_index = pool->name_ref_index_at(type_index);
570 cii->add_item(pool->symbol_at(name_index)->as_C_string());
571 int sig_index = pool->signature_ref_index_at(type_index);
572 cii->add_item(pool->symbol_at(sig_index)->as_C_string());
|
528 }
529 if (strncmp(_class_name, "java/", 5) == 0) {
530 log_info(cds)("Prohibited package for non-bootstrap classes: %s.class from %s",
531 _class_name, _source);
532 THROW_NULL(vmSymbols::java_lang_ClassNotFoundException());
533 }
534
535 ResourceMark rm;
536 char * source_path = os::strdup_check_oom(ClassLoader::uri_to_path(_source));
537 InstanceKlass* specified_super = lookup_class_by_id(_super);
538 Handle super_class(THREAD, specified_super->java_mirror());
539 objArrayOop r = get_specified_interfaces(CHECK_NULL);
540 objArrayHandle interfaces(THREAD, r);
541 InstanceKlass* k = UnregisteredClasses::load_class(class_name, source_path,
542 super_class, interfaces, CHECK_NULL);
543 if (k->java_super() != specified_super) {
544 error("The specified super class %s (id %d) does not match actual super class %s",
545 specified_super->external_name(), _super,
546 k->java_super()->external_name());
547 }
548 const int actual_num_interfaces = k->local_interfaces()->length();
549 const int specified_num_interfaces = _interfaces->length(); // specified in classlist
550 int expected_num_interfaces = actual_num_interfaces;
551
552 if (specified_num_interfaces != expected_num_interfaces) {
553 print_specified_interfaces();
554 print_actual_interfaces(k);
555 error("The number of interfaces (%d) specified in class list does not match the class file (%d)",
556 specified_num_interfaces, expected_num_interfaces);
557 }
558
559 assert(k->is_shared_unregistered_class(), "must be");
560
561 bool added = SystemDictionaryShared::add_unregistered_class(THREAD, k);
562 if (!added) {
563 // We allow only a single unregistered class for each unique name.
564 error("Duplicated class %s", _class_name);
565 }
566
567 return k;
568 }
569
570 void ClassListParser::populate_cds_indy_info(const constantPoolHandle &pool, int cp_index, CDSIndyInfo* cii, TRAPS) {
571 // Caller needs to allocate ResourceMark.
572 int type_index = pool->bootstrap_name_and_type_ref_index_at(cp_index);
573 int name_index = pool->name_ref_index_at(type_index);
574 cii->add_item(pool->symbol_at(name_index)->as_C_string());
575 int sig_index = pool->signature_ref_index_at(type_index);
576 cii->add_item(pool->symbol_at(sig_index)->as_C_string());
|