changeset 5625:fdd464c8d62e

8027304: Lambda: inheriting abstract + 1 default -> default, not ICCE Reviewed-by: hseigel, zgu
author acorn
date Wed, 30 Oct 2013 09:11:04 -0700
parents 1a04de1aaedb
children 4fe7815b04f5
files src/share/vm/classfile/defaultMethods.cpp
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/classfile/defaultMethods.cpp	Mon Oct 28 21:41:48 2013 +0400
+++ b/src/share/vm/classfile/defaultMethods.cpp	Wed Oct 30 09:11:04 2013 -0700
@@ -392,10 +392,16 @@
     }
 
     GrowableArray<Method*> qualified_methods;
+    int num_defaults = 0;
+    int default_index = -1;
     for (int i = 0; i < _members.length(); ++i) {
       Pair<Method*,QualifiedState> entry = _members.at(i);
       if (entry.second == QUALIFIED) {
         qualified_methods.append(entry.first);
+        default_index++;
+        if (entry.first->is_default_method()) {
+          num_defaults++;
+        }
       }
     }
 
@@ -408,6 +414,9 @@
       if (!method->is_abstract()) {
         _selected_target = qualified_methods.at(0);
       }
+      // If only one qualified method is default, select that
+    } else if (num_defaults == 1) {
+        _selected_target = qualified_methods.at(default_index);
     } else {
       _exception_message = generate_conflicts_message(&qualified_methods,CHECK);
       _exception_name = vmSymbols::java_lang_IncompatibleClassChangeError();