8027304: Lambda: inheriting abstract + 1 default -> default, not ICCE

Wed, 30 Oct 2013 09:11:04 -0700

author
acorn
date
Wed, 30 Oct 2013 09:11:04 -0700
changeset 6060
fdd464c8d62e
parent 6031
1a04de1aaedb
child 6061
4fe7815b04f5

8027304: Lambda: inheriting abstract + 1 default -> default, not ICCE
Reviewed-by: hseigel, zgu

src/share/vm/classfile/defaultMethods.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/classfile/defaultMethods.cpp	Mon Oct 28 21:41:48 2013 +0400
     1.2 +++ b/src/share/vm/classfile/defaultMethods.cpp	Wed Oct 30 09:11:04 2013 -0700
     1.3 @@ -392,10 +392,16 @@
     1.4      }
     1.5  
     1.6      GrowableArray<Method*> qualified_methods;
     1.7 +    int num_defaults = 0;
     1.8 +    int default_index = -1;
     1.9      for (int i = 0; i < _members.length(); ++i) {
    1.10        Pair<Method*,QualifiedState> entry = _members.at(i);
    1.11        if (entry.second == QUALIFIED) {
    1.12          qualified_methods.append(entry.first);
    1.13 +        default_index++;
    1.14 +        if (entry.first->is_default_method()) {
    1.15 +          num_defaults++;
    1.16 +        }
    1.17        }
    1.18      }
    1.19  
    1.20 @@ -408,6 +414,9 @@
    1.21        if (!method->is_abstract()) {
    1.22          _selected_target = qualified_methods.at(0);
    1.23        }
    1.24 +      // If only one qualified method is default, select that
    1.25 +    } else if (num_defaults == 1) {
    1.26 +        _selected_target = qualified_methods.at(default_index);
    1.27      } else {
    1.28        _exception_message = generate_conflicts_message(&qualified_methods,CHECK);
    1.29        _exception_name = vmSymbols::java_lang_IncompatibleClassChangeError();

mercurial