comparison src/share/vm/oops/instanceKlass.cpp @ 17795:a9becfeecd1b

Merge
author kvn
date Wed, 22 Jan 2014 17:42:23 -0800
parents 5da8bb64b370 5832cdaf89c6
children 752ba2e5f6d0
comparison
equal deleted inserted replaced
17794:3514ee402842 17795:a9becfeecd1b
1500 return start; 1500 return start;
1501 } 1501 }
1502 return -1; 1502 return -1;
1503 } 1503 }
1504 1504
1505 // lookup_method searches both the local methods array and all superclasses methods arrays 1505 // uncached_lookup_method searches both the local class methods array and all
1506 // superclasses methods arrays, skipping any overpass methods in superclasses.
1506 Method* InstanceKlass::uncached_lookup_method(Symbol* name, Symbol* signature) const { 1507 Method* InstanceKlass::uncached_lookup_method(Symbol* name, Symbol* signature) const {
1507 Klass* klass = const_cast<InstanceKlass*>(this); 1508 Klass* klass = const_cast<InstanceKlass*>(this);
1509 bool dont_ignore_overpasses = true; // For the class being searched, find its overpasses.
1508 while (klass != NULL) { 1510 while (klass != NULL) {
1509 Method* method = InstanceKlass::cast(klass)->find_method(name, signature); 1511 Method* method = InstanceKlass::cast(klass)->find_method(name, signature);
1510 if (method != NULL) return method; 1512 if ((method != NULL) && (dont_ignore_overpasses || !method->is_overpass())) {
1513 return method;
1514 }
1511 klass = InstanceKlass::cast(klass)->super(); 1515 klass = InstanceKlass::cast(klass)->super();
1516 dont_ignore_overpasses = false; // Ignore overpass methods in all superclasses.
1512 } 1517 }
1513 return NULL; 1518 return NULL;
1514 } 1519 }
1515 1520
1516 // lookup a method in the default methods list then in all transitive interfaces 1521 // lookup a method in the default methods list then in all transitive interfaces
1521 if (default_methods() != NULL) { 1526 if (default_methods() != NULL) {
1522 m = find_method(default_methods(), name, signature); 1527 m = find_method(default_methods(), name, signature);
1523 } 1528 }
1524 // Look up interfaces 1529 // Look up interfaces
1525 if (m == NULL) { 1530 if (m == NULL) {
1526 m = lookup_method_in_all_interfaces(name, signature); 1531 m = lookup_method_in_all_interfaces(name, signature, false);
1527 } 1532 }
1528 return m; 1533 return m;
1529 } 1534 }
1530 1535
1531 // lookup a method in all the interfaces that this class implements 1536 // lookup a method in all the interfaces that this class implements
1532 // Do NOT return private or static methods, new in JDK8 which are not externally visible 1537 // Do NOT return private or static methods, new in JDK8 which are not externally visible
1533 // They should only be found in the initial InterfaceMethodRef 1538 // They should only be found in the initial InterfaceMethodRef
1534 Method* InstanceKlass::lookup_method_in_all_interfaces(Symbol* name, 1539 Method* InstanceKlass::lookup_method_in_all_interfaces(Symbol* name,
1535 Symbol* signature) const { 1540 Symbol* signature,
1541 bool skip_default_methods) const {
1536 Array<Klass*>* all_ifs = transitive_interfaces(); 1542 Array<Klass*>* all_ifs = transitive_interfaces();
1537 int num_ifs = all_ifs->length(); 1543 int num_ifs = all_ifs->length();
1538 InstanceKlass *ik = NULL; 1544 InstanceKlass *ik = NULL;
1539 for (int i = 0; i < num_ifs; i++) { 1545 for (int i = 0; i < num_ifs; i++) {
1540 ik = InstanceKlass::cast(all_ifs->at(i)); 1546 ik = InstanceKlass::cast(all_ifs->at(i));
1541 Method* m = ik->lookup_method(name, signature); 1547 Method* m = ik->lookup_method(name, signature);
1542 if (m != NULL && m->is_public() && !m->is_static()) { 1548 if (m != NULL && m->is_public() && !m->is_static() &&
1549 (!skip_default_methods || !m->is_default_method())) {
1543 return m; 1550 return m;
1544 } 1551 }
1545 } 1552 }
1546 return NULL; 1553 return NULL;
1547 } 1554 }