comparison src/share/vm/oops/instanceKlass.cpp @ 17524:89152779163c

Merge with jdk8-b132
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 15 Oct 2014 11:59:32 +0200
parents ad431bf0de07
children 52b4284cb496
comparison
equal deleted inserted replaced
17450:45b45f902bed 17524:89152779163c
1533 return start; 1533 return start;
1534 } 1534 }
1535 return -1; 1535 return -1;
1536 } 1536 }
1537 1537
1538 // lookup_method searches both the local methods array and all superclasses methods arrays 1538 // uncached_lookup_method searches both the local class methods array and all
1539 // superclasses methods arrays, skipping any overpass methods in superclasses.
1539 Method* InstanceKlass::uncached_lookup_method(Symbol* name, Symbol* signature) const { 1540 Method* InstanceKlass::uncached_lookup_method(Symbol* name, Symbol* signature) const {
1540 Klass* klass = const_cast<InstanceKlass*>(this); 1541 Klass* klass = const_cast<InstanceKlass*>(this);
1542 bool dont_ignore_overpasses = true; // For the class being searched, find its overpasses.
1541 while (klass != NULL) { 1543 while (klass != NULL) {
1542 Method* method = InstanceKlass::cast(klass)->find_method(name, signature); 1544 Method* method = InstanceKlass::cast(klass)->find_method(name, signature);
1543 if (method != NULL) return method; 1545 if ((method != NULL) && (dont_ignore_overpasses || !method->is_overpass())) {
1546 return method;
1547 }
1544 klass = InstanceKlass::cast(klass)->super(); 1548 klass = InstanceKlass::cast(klass)->super();
1549 dont_ignore_overpasses = false; // Ignore overpass methods in all superclasses.
1545 } 1550 }
1546 return NULL; 1551 return NULL;
1547 } 1552 }
1548 1553
1549 // lookup a method in the default methods list then in all transitive interfaces 1554 // lookup a method in the default methods list then in all transitive interfaces
1554 if (default_methods() != NULL) { 1559 if (default_methods() != NULL) {
1555 m = find_method(default_methods(), name, signature); 1560 m = find_method(default_methods(), name, signature);
1556 } 1561 }
1557 // Look up interfaces 1562 // Look up interfaces
1558 if (m == NULL) { 1563 if (m == NULL) {
1559 m = lookup_method_in_all_interfaces(name, signature); 1564 m = lookup_method_in_all_interfaces(name, signature, false);
1560 } 1565 }
1561 return m; 1566 return m;
1562 } 1567 }
1563 1568
1564 // lookup a method in all the interfaces that this class implements 1569 // lookup a method in all the interfaces that this class implements
1565 // Do NOT return private or static methods, new in JDK8 which are not externally visible 1570 // Do NOT return private or static methods, new in JDK8 which are not externally visible
1566 // They should only be found in the initial InterfaceMethodRef 1571 // They should only be found in the initial InterfaceMethodRef
1567 Method* InstanceKlass::lookup_method_in_all_interfaces(Symbol* name, 1572 Method* InstanceKlass::lookup_method_in_all_interfaces(Symbol* name,
1568 Symbol* signature) const { 1573 Symbol* signature,
1574 bool skip_default_methods) const {
1569 Array<Klass*>* all_ifs = transitive_interfaces(); 1575 Array<Klass*>* all_ifs = transitive_interfaces();
1570 int num_ifs = all_ifs->length(); 1576 int num_ifs = all_ifs->length();
1571 InstanceKlass *ik = NULL; 1577 InstanceKlass *ik = NULL;
1572 for (int i = 0; i < num_ifs; i++) { 1578 for (int i = 0; i < num_ifs; i++) {
1573 ik = InstanceKlass::cast(all_ifs->at(i)); 1579 ik = InstanceKlass::cast(all_ifs->at(i));
1574 Method* m = ik->lookup_method(name, signature); 1580 Method* m = ik->lookup_method(name, signature);
1575 if (m != NULL && m->is_public() && !m->is_static()) { 1581 if (m != NULL && m->is_public() && !m->is_static() &&
1582 (!skip_default_methods || !m->is_default_method())) {
1576 return m; 1583 return m;
1577 } 1584 }
1578 } 1585 }
1579 return NULL; 1586 return NULL;
1580 } 1587 }