diff 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
line wrap: on
line diff
--- a/src/share/vm/oops/instanceKlass.cpp	Wed Oct 15 15:35:33 2014 +0200
+++ b/src/share/vm/oops/instanceKlass.cpp	Wed Oct 15 11:59:32 2014 +0200
@@ -1535,13 +1535,18 @@
   return -1;
 }
 
-// lookup_method searches both the local methods array and all superclasses methods arrays
+// uncached_lookup_method searches both the local class methods array and all
+// superclasses methods arrays, skipping any overpass methods in superclasses.
 Method* InstanceKlass::uncached_lookup_method(Symbol* name, Symbol* signature) const {
   Klass* klass = const_cast<InstanceKlass*>(this);
+  bool dont_ignore_overpasses = true;  // For the class being searched, find its overpasses.
   while (klass != NULL) {
     Method* method = InstanceKlass::cast(klass)->find_method(name, signature);
-    if (method != NULL) return method;
+    if ((method != NULL) && (dont_ignore_overpasses || !method->is_overpass())) {
+      return method;
+    }
     klass = InstanceKlass::cast(klass)->super();
+    dont_ignore_overpasses = false;  // Ignore overpass methods in all superclasses.
   }
   return NULL;
 }
@@ -1556,7 +1561,7 @@
   }
   // Look up interfaces
   if (m == NULL) {
-    m = lookup_method_in_all_interfaces(name, signature);
+    m = lookup_method_in_all_interfaces(name, signature, false);
   }
   return m;
 }
@@ -1565,14 +1570,16 @@
 // Do NOT return private or static methods, new in JDK8 which are not externally visible
 // They should only be found in the initial InterfaceMethodRef
 Method* InstanceKlass::lookup_method_in_all_interfaces(Symbol* name,
-                                                         Symbol* signature) const {
+                                                       Symbol* signature,
+                                                       bool skip_default_methods) const {
   Array<Klass*>* all_ifs = transitive_interfaces();
   int num_ifs = all_ifs->length();
   InstanceKlass *ik = NULL;
   for (int i = 0; i < num_ifs; i++) {
     ik = InstanceKlass::cast(all_ifs->at(i));
     Method* m = ik->lookup_method(name, signature);
-    if (m != NULL && m->is_public() && !m->is_static()) {
+    if (m != NULL && m->is_public() && !m->is_static() &&
+        (!skip_default_methods || !m->is_default_method())) {
       return m;
     }
   }