src/share/vm/oops/instanceKlass.cpp

Print this page




1462   }
1463   return -1;
1464 }
1465 
1466 // uncached_lookup_method searches both the local class methods array and all
1467 // superclasses methods arrays, skipping any overpass methods in superclasses.
1468 Method* InstanceKlass::uncached_lookup_method(Symbol* name, Symbol* signature) const {
1469   Klass* klass = const_cast<InstanceKlass*>(this);
1470   bool dont_ignore_overpasses = true;  // For the class being searched, find its overpasses.
1471   while (klass != NULL) {
1472     Method* method = InstanceKlass::cast(klass)->find_method(name, signature);
1473     if ((method != NULL) && (dont_ignore_overpasses || !method->is_overpass())) {
1474       return method;
1475     }
1476     klass = InstanceKlass::cast(klass)->super();
1477     dont_ignore_overpasses = false;  // Ignore overpass methods in all superclasses.
1478   }
1479   return NULL;
1480 }
1481 















1482 // lookup a method in the default methods list then in all transitive interfaces
1483 // Do NOT return private or static methods
1484 Method* InstanceKlass::lookup_method_in_ordered_interfaces(Symbol* name,
1485                                                          Symbol* signature) const {
1486   Method* m = NULL;
1487   if (default_methods() != NULL) {
1488     m = find_method(default_methods(), name, signature);
1489   }
1490   // Look up interfaces
1491   if (m == NULL) {
1492     m = lookup_method_in_all_interfaces(name, signature, false);
1493   }
1494   return m;
1495 }
1496 
1497 // lookup a method in all the interfaces that this class implements
1498 // Do NOT return private or static methods, new in JDK8 which are not externally visible
1499 // They should only be found in the initial InterfaceMethodRef
1500 Method* InstanceKlass::lookup_method_in_all_interfaces(Symbol* name,
1501                                                        Symbol* signature,




1462   }
1463   return -1;
1464 }
1465 
1466 // uncached_lookup_method searches both the local class methods array and all
1467 // superclasses methods arrays, skipping any overpass methods in superclasses.
1468 Method* InstanceKlass::uncached_lookup_method(Symbol* name, Symbol* signature) const {
1469   Klass* klass = const_cast<InstanceKlass*>(this);
1470   bool dont_ignore_overpasses = true;  // For the class being searched, find its overpasses.
1471   while (klass != NULL) {
1472     Method* method = InstanceKlass::cast(klass)->find_method(name, signature);
1473     if ((method != NULL) && (dont_ignore_overpasses || !method->is_overpass())) {
1474       return method;
1475     }
1476     klass = InstanceKlass::cast(klass)->super();
1477     dont_ignore_overpasses = false;  // Ignore overpass methods in all superclasses.
1478   }
1479   return NULL;
1480 }
1481 
1482 #ifdef ASSERT
1483 // search through class hierarchy and return true if this class or
1484 // one of the superclasses was redefined
1485 bool InstanceKlass::has_redefined_this_or_super() const {
1486   const InstanceKlass* klass = this;
1487   while (klass != NULL) {
1488     if (klass->has_been_redefined()) {
1489       return true;
1490     }
1491     klass = InstanceKlass::cast(klass->super());
1492   }
1493   return false;
1494 }
1495 #endif
1496 
1497 // lookup a method in the default methods list then in all transitive interfaces
1498 // Do NOT return private or static methods
1499 Method* InstanceKlass::lookup_method_in_ordered_interfaces(Symbol* name,
1500                                                          Symbol* signature) const {
1501   Method* m = NULL;
1502   if (default_methods() != NULL) {
1503     m = find_method(default_methods(), name, signature);
1504   }
1505   // Look up interfaces
1506   if (m == NULL) {
1507     m = lookup_method_in_all_interfaces(name, signature, false);
1508   }
1509   return m;
1510 }
1511 
1512 // lookup a method in all the interfaces that this class implements
1513 // Do NOT return private or static methods, new in JDK8 which are not externally visible
1514 // They should only be found in the initial InterfaceMethodRef
1515 Method* InstanceKlass::lookup_method_in_all_interfaces(Symbol* name,
1516                                                        Symbol* signature,