Mercurial > hg > truffle
comparison src/share/vm/classfile/defaultMethods.cpp @ 17891:b6a2ba7d3ea7 hs25.20-b11
Merge
author | amurillo |
---|---|
date | Thu, 17 Apr 2014 16:09:07 -0700 |
parents | 386dd1c71858 |
children | 78bbf4d43a14 |
comparison
equal
deleted
inserted
replaced
17862:70dc2c030c69 | 17891:b6a2ba7d3ea7 |
---|---|
388 | 388 |
389 Method* get_selected_target() { return _selected_target; } | 389 Method* get_selected_target() { return _selected_target; } |
390 Symbol* get_exception_message() { return _exception_message; } | 390 Symbol* get_exception_message() { return _exception_message; } |
391 Symbol* get_exception_name() { return _exception_name; } | 391 Symbol* get_exception_name() { return _exception_name; } |
392 | 392 |
393 // Return true if the specified klass has a static method that matches | |
394 // the name and signature of the target method. | |
395 bool has_matching_static(InstanceKlass* root) { | |
396 if (_members.length() > 0) { | |
397 Pair<Method*,QualifiedState> entry = _members.at(0); | |
398 Method* impl = root->find_method(entry.first->name(), | |
399 entry.first->signature()); | |
400 if ((impl != NULL) && impl->is_static()) { | |
401 return true; | |
402 } | |
403 } | |
404 return false; | |
405 } | |
406 | |
407 // Either sets the target or the exception error message | 393 // Either sets the target or the exception error message |
408 void determine_target(InstanceKlass* root, TRAPS) { | 394 void determine_target(InstanceKlass* root, TRAPS) { |
409 if (has_target() || throws_exception()) { | 395 if (has_target() || throws_exception()) { |
410 return; | 396 return; |
411 } | 397 } |
431 | 417 |
432 if (num_defaults == 0) { | 418 if (num_defaults == 0) { |
433 // If the root klass has a static method with matching name and signature | 419 // If the root klass has a static method with matching name and signature |
434 // then do not generate an overpass method because it will hide the | 420 // then do not generate an overpass method because it will hide the |
435 // static method during resolution. | 421 // static method during resolution. |
436 if (!has_matching_static(root)) { | 422 if (qualified_methods.length() == 0) { |
437 if (qualified_methods.length() == 0) { | 423 _exception_message = generate_no_defaults_message(CHECK); |
438 _exception_message = generate_no_defaults_message(CHECK); | 424 } else { |
439 } else { | 425 assert(root != NULL, "Null root class"); |
440 assert(root != NULL, "Null root class"); | 426 _exception_message = generate_method_message(root->name(), qualified_methods.at(0), CHECK); |
441 _exception_message = generate_method_message(root->name(), qualified_methods.at(0), CHECK); | 427 } |
442 } | 428 _exception_name = vmSymbols::java_lang_AbstractMethodError(); |
443 _exception_name = vmSymbols::java_lang_AbstractMethodError(); | |
444 } | |
445 | 429 |
446 // If only one qualified method is default, select that | 430 // If only one qualified method is default, select that |
447 } else if (num_defaults == 1) { | 431 } else if (num_defaults == 1) { |
448 _selected_target = qualified_methods.at(default_index); | 432 _selected_target = qualified_methods.at(default_index); |
449 | 433 |
450 } else if (num_defaults > 1 && !has_matching_static(root)) { | 434 } else if (num_defaults > 1) { |
451 _exception_message = generate_conflicts_message(&qualified_methods,CHECK); | 435 _exception_message = generate_conflicts_message(&qualified_methods,CHECK); |
452 _exception_name = vmSymbols::java_lang_IncompatibleClassChangeError(); | 436 _exception_name = vmSymbols::java_lang_IncompatibleClassChangeError(); |
453 if (TraceDefaultMethods) { | 437 if (TraceDefaultMethods) { |
454 _exception_message->print_value_on(tty); | 438 _exception_message->print_value_on(tty); |
455 tty->print_cr(""); | 439 tty->print_cr(""); |