hotspot/src/share/vm/oops/instanceKlass.cpp
changeset 41669 2091069b6851
parent 41293 871b2f487dc0
child 42031 55dc92f033b9
equal deleted inserted replaced
41668:e9c6bbf513e5 41669:2091069b6851
   672   }
   672   }
   673 }
   673 }
   674 
   674 
   675 // Eagerly initialize superinterfaces that declare default methods (concrete instance: any access)
   675 // Eagerly initialize superinterfaces that declare default methods (concrete instance: any access)
   676 void InstanceKlass::initialize_super_interfaces(instanceKlassHandle this_k, TRAPS) {
   676 void InstanceKlass::initialize_super_interfaces(instanceKlassHandle this_k, TRAPS) {
   677   assert (this_k->has_default_methods(), "caller should have checked this");
   677   assert (this_k->has_nonstatic_concrete_methods(), "caller should have checked this");
   678   for (int i = 0; i < this_k->local_interfaces()->length(); ++i) {
   678   for (int i = 0; i < this_k->local_interfaces()->length(); ++i) {
   679     Klass* iface = this_k->local_interfaces()->at(i);
   679     Klass* iface = this_k->local_interfaces()->at(i);
   680     InstanceKlass* ik = InstanceKlass::cast(iface);
   680     InstanceKlass* ik = InstanceKlass::cast(iface);
   681 
   681 
   682     // Initialization is depth first search ie. we start with top of the inheritance tree
   682     // Initialization is depth first search ie. we start with top of the inheritance tree
   683     // has_default_methods drives searching superinterfaces since it
   683     // has_nonstatic_concrete_methods drives searching superinterfaces since it
   684     // means has_default_methods in its superinterface hierarchy
   684     // means has_nonstatic_concrete_methods in its superinterface hierarchy
   685     if (ik->has_default_methods()) {
   685     if (ik->has_nonstatic_concrete_methods()) {
   686       ik->initialize_super_interfaces(ik, CHECK);
   686       ik->initialize_super_interfaces(ik, CHECK);
   687     }
   687     }
   688 
   688 
   689     // Only initialize() interfaces that "declare" concrete methods.
   689     // Only initialize() interfaces that "declare" concrete methods.
   690     if (ik->should_be_initialized() && ik->declares_default_methods()) {
   690     if (ik->should_be_initialized() && ik->declares_nonstatic_concrete_methods()) {
   691       ik->initialize(CHECK);
   691       ik->initialize(CHECK);
   692     }
   692     }
   693   }
   693   }
   694 }
   694 }
   695 
   695 
   759   if (!this_k->is_interface()) {
   759   if (!this_k->is_interface()) {
   760     Klass* super_klass = this_k->super();
   760     Klass* super_klass = this_k->super();
   761     if (super_klass != NULL && super_klass->should_be_initialized()) {
   761     if (super_klass != NULL && super_klass->should_be_initialized()) {
   762       super_klass->initialize(THREAD);
   762       super_klass->initialize(THREAD);
   763     }
   763     }
   764     // If C implements any interfaces that declares a non-abstract, non-static method,
   764     // If C implements any interface that declares a non-static, concrete method,
   765     // the initialization of C triggers initialization of its super interfaces.
   765     // the initialization of C triggers initialization of its super interfaces.
   766     // Only need to recurse if has_default_methods which includes declaring and
   766     // Only need to recurse if has_nonstatic_concrete_methods which includes declaring and
   767     // inheriting default methods
   767     // having a superinterface that declares, non-static, concrete methods
   768     if (!HAS_PENDING_EXCEPTION && this_k->has_default_methods()) {
   768     if (!HAS_PENDING_EXCEPTION && this_k->has_nonstatic_concrete_methods()) {
   769       this_k->initialize_super_interfaces(this_k, THREAD);
   769       this_k->initialize_super_interfaces(this_k, THREAD);
   770     }
   770     }
   771 
   771 
   772     // If any exceptions, complete abruptly, throwing the same exception as above.
   772     // If any exceptions, complete abruptly, throwing the same exception as above.
   773     if (HAS_PENDING_EXCEPTION) {
   773     if (HAS_PENDING_EXCEPTION) {