< prev index next >

src/hotspot/share/cds/classListParser.cpp

Print this page

549   }
550 
551   ResourceMark rm;
552   InstanceKlass* specified_super = lookup_class_by_id(_super);
553   GrowableArray<InstanceKlass*> specified_interfaces = get_specified_interfaces();
554   // Obstruction must be checked before the class loading attempt because it may
555   // cause class loading errors (JVMS 5.3.5.3-5.3.5.4)
556   check_supertype_obstruction(_super, specified_super, CHECK_NULL);
557   for (int i = 0; i < _interfaces->length(); i++) {
558     check_supertype_obstruction(_interfaces->at(i), specified_interfaces.at(i), CHECK_NULL);
559   }
560 
561   const char* source_path = ClassLoader::uri_to_path(_source);
562   InstanceKlass* k = UnregisteredClasses::load_class(class_name, source_path, CHECK_NULL);
563 
564   if (k->java_super() != specified_super) {
565     error("The specified super class %s (id %d) does not match actual super class %s",
566           specified_super->external_name(), _super,
567           k->java_super()->external_name());
568   }
569   if (k->local_interfaces()->length() != _interfaces->length()) {




570     print_specified_interfaces();
571     print_actual_interfaces(k);
572     error("The number of interfaces (%d) specified in class list does not match the class file (%d)",
573           _interfaces->length(), k->local_interfaces()->length());
574   }
575   for (int i = 0; i < _interfaces->length(); i++) {
576     InstanceKlass* specified_interface = specified_interfaces.at(i);
577     if (!k->local_interfaces()->contains(specified_interface)) {
578       print_specified_interfaces();
579       print_actual_interfaces(k);
580       error("Specified interface %s (id %d) is not directly implemented",
581             specified_interface->external_name(), _interfaces->at(i));
582       }
583   }
584 
585   assert(k->defined_by_other_loaders(), "must be");
586 
587   bool added = SystemDictionaryShared::add_unregistered_class(THREAD, k);
588   if (!added) {
589     // We allow only a single unregistered class for each unique name.
590     error("Duplicated class %s", _class_name);
591   }
592 
593   return k;

549   }
550 
551   ResourceMark rm;
552   InstanceKlass* specified_super = lookup_class_by_id(_super);
553   GrowableArray<InstanceKlass*> specified_interfaces = get_specified_interfaces();
554   // Obstruction must be checked before the class loading attempt because it may
555   // cause class loading errors (JVMS 5.3.5.3-5.3.5.4)
556   check_supertype_obstruction(_super, specified_super, CHECK_NULL);
557   for (int i = 0; i < _interfaces->length(); i++) {
558     check_supertype_obstruction(_interfaces->at(i), specified_interfaces.at(i), CHECK_NULL);
559   }
560 
561   const char* source_path = ClassLoader::uri_to_path(_source);
562   InstanceKlass* k = UnregisteredClasses::load_class(class_name, source_path, CHECK_NULL);
563 
564   if (k->java_super() != specified_super) {
565     error("The specified super class %s (id %d) does not match actual super class %s",
566           specified_super->external_name(), _super,
567           k->java_super()->external_name());
568   }
569   const int actual_num_interfaces = k->local_interfaces()->length();
570   const int specified_num_interfaces = _interfaces->length(); // specified in classlist
571   int expected_num_interfaces = actual_num_interfaces;
572 
573   if (specified_num_interfaces != expected_num_interfaces) {
574     print_specified_interfaces();
575     print_actual_interfaces(k);
576     error("The number of interfaces (%d) specified in class list does not match the class file (%d)",
577           specified_num_interfaces, expected_num_interfaces);
578   }
579   for (int i = 0; i < _interfaces->length(); i++) {
580     InstanceKlass* specified_interface = specified_interfaces.at(i);
581     if (!k->local_interfaces()->contains(specified_interface)) {
582       print_specified_interfaces();
583       print_actual_interfaces(k);
584       error("Specified interface %s (id %d) is not directly implemented",
585             specified_interface->external_name(), _interfaces->at(i));
586       }
587   }
588 
589   assert(k->defined_by_other_loaders(), "must be");
590 
591   bool added = SystemDictionaryShared::add_unregistered_class(THREAD, k);
592   if (!added) {
593     // We allow only a single unregistered class for each unique name.
594     error("Duplicated class %s", _class_name);
595   }
596 
597   return k;
< prev index next >