diff src/share/vm/classfile/defaultMethods.cpp @ 18041:52b4284cb496

Merge with jdk8u20-b26
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 15 Oct 2014 16:02:50 +0200
parents 89152779163c 78bbf4d43a14
children 12dcf5ba8b34
line wrap: on
line diff
--- a/src/share/vm/classfile/defaultMethods.cpp	Thu Oct 16 10:21:29 2014 +0200
+++ b/src/share/vm/classfile/defaultMethods.cpp	Wed Oct 15 16:02:50 2014 +0200
@@ -390,20 +390,6 @@
   Symbol* get_exception_message() { return _exception_message; }
   Symbol* get_exception_name() { return _exception_name; }
 
-  // Return true if the specified klass has a static method that matches
-  // the name and signature of the target method.
-  bool has_matching_static(InstanceKlass* root) {
-    if (_members.length() > 0) {
-      Pair<Method*,QualifiedState> entry = _members.at(0);
-      Method* impl = root->find_method(entry.first->name(),
-                                       entry.first->signature());
-      if ((impl != NULL) && impl->is_static()) {
-        return true;
-      }
-    }
-    return false;
-  }
-
   // Either sets the target or the exception error message
   void determine_target(InstanceKlass* root, TRAPS) {
     if (has_target() || throws_exception()) {
@@ -433,26 +419,24 @@
       // If the root klass has a static method with matching name and signature
       // then do not generate an overpass method because it will hide the
       // static method during resolution.
-      if (!has_matching_static(root)) {
-        if (qualified_methods.length() == 0) {
-          _exception_message = generate_no_defaults_message(CHECK);
-        } else {
-          assert(root != NULL, "Null root class");
-          _exception_message = generate_method_message(root->name(), qualified_methods.at(0), CHECK);
-        }
-        _exception_name = vmSymbols::java_lang_AbstractMethodError();
+      if (qualified_methods.length() == 0) {
+        _exception_message = generate_no_defaults_message(CHECK);
+      } else {
+        assert(root != NULL, "Null root class");
+        _exception_message = generate_method_message(root->name(), qualified_methods.at(0), CHECK);
       }
+      _exception_name = vmSymbols::java_lang_AbstractMethodError();
 
     // If only one qualified method is default, select that
     } else if (num_defaults == 1) {
         _selected_target = qualified_methods.at(default_index);
 
-    } else if (num_defaults > 1 && !has_matching_static(root)) {
+    } else if (num_defaults > 1) {
       _exception_message = generate_conflicts_message(&qualified_methods,CHECK);
       _exception_name = vmSymbols::java_lang_IncompatibleClassChangeError();
       if (TraceDefaultMethods) {
         _exception_message->print_value_on(tty);
-        tty->print_cr("");
+        tty->cr();
       }
     }
   }
@@ -479,7 +463,7 @@
       if (_members.at(i).second == DISQUALIFIED) {
         str->print(" (disqualified)");
       }
-      str->print_cr("");
+      str->cr();
     }
 
     if (_selected_target != NULL) {
@@ -496,7 +480,7 @@
     if (!method_holder->is_interface()) {
       tty->print(" : in superclass");
     }
-    str->print_cr("");
+    str->cr();
   }
 
   void print_exception(outputStream* str, int indent) {
@@ -704,7 +688,7 @@
     for (int i = 0; i < slots->length(); ++i) {
       tty->indent();
       slots->at(i)->print_on(tty);
-      tty->print_cr("");
+      tty->cr();
     }
   }
 #endif // ndef PRODUCT
@@ -844,7 +828,7 @@
       streamIndentor si(tty, 2);
       tty->indent().print("Looking for default methods for slot ");
       slot->print_on(tty);
-      tty->print_cr("");
+      tty->cr();
     }
 #endif // ndef PRODUCT
 
@@ -962,7 +946,7 @@
       if (TraceDefaultMethods) {
         tty->print("for slot: ");
         slot->print_on(tty);
-        tty->print_cr("");
+        tty->cr();
         if (method->has_target()) {
           method->print_selected(tty, 1);
         } else if (method->throws_exception()) {