8024647: Default method resolution with private superclass method
authoracorn
Mon, 16 Sep 2013 17:57:56 -0400
changeset 19966 64732b96b5f5
parent 19964 a3a04a9d29ac
child 19967 bd360d86c499
8024647: Default method resolution with private superclass method Reviewed-by: kamg, minqi
hotspot/src/share/vm/classfile/defaultMethods.cpp
--- a/hotspot/src/share/vm/classfile/defaultMethods.cpp	Mon Sep 16 07:38:13 2013 -0400
+++ b/hotspot/src/share/vm/classfile/defaultMethods.cpp	Mon Sep 16 17:57:56 2013 -0400
@@ -450,6 +450,10 @@
     streamIndentor si(str, indent * 2);
     str->indent().print("Selected method: ");
     print_method(str, _selected_target);
+    Klass* method_holder = _selected_target->method_holder();
+    if (!method_holder->is_interface()) {
+      tty->print(" : in superclass");
+    }
     str->print_cr("");
   }
 
@@ -1141,19 +1145,23 @@
 #endif // ndef PRODUCT
       if (method->has_target()) {
         Method* selected = method->get_selected_target();
-        max_stack = assemble_redirect(
+        if (selected->method_holder()->is_interface()) {
+          max_stack = assemble_redirect(
             &bpool, &buffer, slot->signature(), selected, CHECK);
+        }
       } else if (method->throws_exception()) {
         max_stack = assemble_abstract_method_error(
             &bpool, &buffer, method->get_exception_message(), CHECK);
       }
-      AccessFlags flags = accessFlags_from(
+      if (max_stack != 0) {
+        AccessFlags flags = accessFlags_from(
           JVM_ACC_PUBLIC | JVM_ACC_SYNTHETIC | JVM_ACC_BRIDGE);
-      Method* m = new_method(&bpool, &buffer, slot->name(), slot->signature(),
+        Method* m = new_method(&bpool, &buffer, slot->name(), slot->signature(),
           flags, max_stack, slot->size_of_parameters(),
           ConstMethod::OVERPASS, CHECK);
-      if (m != NULL) {
-        overpasses.push(m);
+        if (m != NULL) {
+          overpasses.push(m);
+        }
       }
     }
   }