Mercurial > hg > graal-jvmci-8
comparison src/share/vm/classfile/defaultMethods.cpp @ 17464:5832cdaf89c6
8027804: JCK resolveMethod test fails expecting AbstractMethodError
Summary: Create AME overpass methods and fix method search logic
Reviewed-by: kamg, acorn, lfoltan, coleenp
author | hseigel |
---|---|
date | Mon, 16 Dec 2013 08:24:33 -0500 |
parents | 379f11bc04fc |
children | e9b6b2aa5125 |
comparison
equal
deleted
inserted
replaced
17452:7469c9ca967a | 17464:5832cdaf89c6 |
---|---|
347 guarantee(index != NULL && *index >= 0 && *index < _members.length(), "bad index"); | 347 guarantee(index != NULL && *index >= 0 && *index < _members.length(), "bad index"); |
348 _members.at(*index).second = DISQUALIFIED; | 348 _members.at(*index).second = DISQUALIFIED; |
349 } | 349 } |
350 | 350 |
351 Symbol* generate_no_defaults_message(TRAPS) const; | 351 Symbol* generate_no_defaults_message(TRAPS) const; |
352 Symbol* generate_method_message(Symbol *klass_name, Method* method, TRAPS) const; | |
352 Symbol* generate_conflicts_message(GrowableArray<Method*>* methods, TRAPS) const; | 353 Symbol* generate_conflicts_message(GrowableArray<Method*>* methods, TRAPS) const; |
353 | 354 |
354 public: | 355 public: |
355 | 356 |
356 MethodFamily() | 357 MethodFamily() |
412 | 413 |
413 } | 414 } |
414 } | 415 } |
415 } | 416 } |
416 | 417 |
417 if (qualified_methods.length() == 0) { | 418 if (num_defaults == 0) { |
418 _exception_message = generate_no_defaults_message(CHECK); | 419 if (qualified_methods.length() == 0) { |
420 _exception_message = generate_no_defaults_message(CHECK); | |
421 } else { | |
422 assert(root != NULL, "Null root class"); | |
423 _exception_message = generate_method_message(root->name(), qualified_methods.at(0), CHECK); | |
424 } | |
419 _exception_name = vmSymbols::java_lang_AbstractMethodError(); | 425 _exception_name = vmSymbols::java_lang_AbstractMethodError(); |
420 // If only one qualified method is default, select that | 426 // If only one qualified method is default, select that |
421 } else if (num_defaults == 1) { | 427 } else if (num_defaults == 1) { |
422 _selected_target = qualified_methods.at(default_index); | 428 _selected_target = qualified_methods.at(default_index); |
423 } else if (num_defaults > 1) { | 429 } else if (num_defaults > 1) { |
424 _exception_message = generate_conflicts_message(&qualified_methods,CHECK); | 430 _exception_message = generate_conflicts_message(&qualified_methods,CHECK); |
425 _exception_name = vmSymbols::java_lang_IncompatibleClassChangeError(); | 431 _exception_name = vmSymbols::java_lang_IncompatibleClassChangeError(); |
426 if (TraceDefaultMethods) { | 432 if (TraceDefaultMethods) { |
427 _exception_message->print_value_on(tty); | 433 _exception_message->print_value_on(tty); |
428 tty->print_cr(""); | 434 tty->print_cr(""); |
429 } | 435 } |
430 } | 436 } |
431 // leave abstract methods alone, they will be found via normal search path | |
432 } | 437 } |
433 | 438 |
434 bool contains_signature(Symbol* query) { | 439 bool contains_signature(Symbol* query) { |
435 for (int i = 0; i < _members.length(); ++i) { | 440 for (int i = 0; i < _members.length(); ++i) { |
436 if (query == _members.at(i).first->signature()) { | 441 if (query == _members.at(i).first->signature()) { |
482 #endif // ndef PRODUCT | 487 #endif // ndef PRODUCT |
483 }; | 488 }; |
484 | 489 |
485 Symbol* MethodFamily::generate_no_defaults_message(TRAPS) const { | 490 Symbol* MethodFamily::generate_no_defaults_message(TRAPS) const { |
486 return SymbolTable::new_symbol("No qualifying defaults found", CHECK_NULL); | 491 return SymbolTable::new_symbol("No qualifying defaults found", CHECK_NULL); |
492 } | |
493 | |
494 Symbol* MethodFamily::generate_method_message(Symbol *klass_name, Method* method, TRAPS) const { | |
495 stringStream ss; | |
496 ss.print("Method "); | |
497 Symbol* name = method->name(); | |
498 Symbol* signature = method->signature(); | |
499 ss.write((const char*)klass_name->bytes(), klass_name->utf8_length()); | |
500 ss.print("."); | |
501 ss.write((const char*)name->bytes(), name->utf8_length()); | |
502 ss.write((const char*)signature->bytes(), signature->utf8_length()); | |
503 ss.print(" is abstract"); | |
504 return SymbolTable::new_symbol(ss.base(), (int)ss.size(), CHECK_NULL); | |
487 } | 505 } |
488 | 506 |
489 Symbol* MethodFamily::generate_conflicts_message(GrowableArray<Method*>* methods, TRAPS) const { | 507 Symbol* MethodFamily::generate_conflicts_message(GrowableArray<Method*>* methods, TRAPS) const { |
490 stringStream ss; | 508 stringStream ss; |
491 ss.print("Conflicting default methods:"); | 509 ss.print("Conflicting default methods:"); |