Mercurial > hg > graal-jvmci-8
comparison src/share/vm/classfile/defaultMethods.cpp @ 13035: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 | f50418dfb1b7 |
children | fce21ac5968d |
comparison
equal
deleted
inserted
replaced
13002:1a04de1aaedb | 13035:fdd464c8d62e |
---|---|
390 if (has_target() || throws_exception()) { | 390 if (has_target() || throws_exception()) { |
391 return; | 391 return; |
392 } | 392 } |
393 | 393 |
394 GrowableArray<Method*> qualified_methods; | 394 GrowableArray<Method*> qualified_methods; |
395 int num_defaults = 0; | |
396 int default_index = -1; | |
395 for (int i = 0; i < _members.length(); ++i) { | 397 for (int i = 0; i < _members.length(); ++i) { |
396 Pair<Method*,QualifiedState> entry = _members.at(i); | 398 Pair<Method*,QualifiedState> entry = _members.at(i); |
397 if (entry.second == QUALIFIED) { | 399 if (entry.second == QUALIFIED) { |
398 qualified_methods.append(entry.first); | 400 qualified_methods.append(entry.first); |
401 default_index++; | |
402 if (entry.first->is_default_method()) { | |
403 num_defaults++; | |
404 } | |
399 } | 405 } |
400 } | 406 } |
401 | 407 |
402 if (qualified_methods.length() == 0) { | 408 if (qualified_methods.length() == 0) { |
403 _exception_message = generate_no_defaults_message(CHECK); | 409 _exception_message = generate_no_defaults_message(CHECK); |
406 // leave abstract methods alone, they will be found via normal search path | 412 // leave abstract methods alone, they will be found via normal search path |
407 Method* method = qualified_methods.at(0); | 413 Method* method = qualified_methods.at(0); |
408 if (!method->is_abstract()) { | 414 if (!method->is_abstract()) { |
409 _selected_target = qualified_methods.at(0); | 415 _selected_target = qualified_methods.at(0); |
410 } | 416 } |
417 // If only one qualified method is default, select that | |
418 } else if (num_defaults == 1) { | |
419 _selected_target = qualified_methods.at(default_index); | |
411 } else { | 420 } else { |
412 _exception_message = generate_conflicts_message(&qualified_methods,CHECK); | 421 _exception_message = generate_conflicts_message(&qualified_methods,CHECK); |
413 _exception_name = vmSymbols::java_lang_IncompatibleClassChangeError(); | 422 _exception_name = vmSymbols::java_lang_IncompatibleClassChangeError(); |
414 if (TraceDefaultMethods) { | 423 if (TraceDefaultMethods) { |
415 _exception_message->print_value_on(tty); | 424 _exception_message->print_value_on(tty); |