< prev index next >

src/hotspot/share/classfile/defaultMethods.cpp

Print this page




 457     assert(has_target(), "Should be called otherwise");
 458     streamIndentor si(str, indent * 2);
 459     str->indent().print("Selected method: ");
 460     print_method(str, _selected_target);
 461     Klass* method_holder = _selected_target->method_holder();
 462     if (!method_holder->is_interface()) {
 463       str->print(" : in superclass");
 464     }
 465     str->cr();
 466   }
 467 
 468   void print_exception(outputStream* str, int indent) {
 469     assert(throws_exception(), "Should be called otherwise");
 470     assert(_exception_name != NULL, "exception_name should be set");
 471     streamIndentor si(str, indent * 2);
 472     str->indent().print_cr("%s: %s", _exception_name->as_C_string(), _exception_message->as_C_string());
 473   }
 474 };
 475 
 476 Symbol* MethodFamily::generate_no_defaults_message(TRAPS) const {
 477   return SymbolTable::new_symbol("No qualifying defaults found", THREAD);

 478 }
 479 
 480 Symbol* MethodFamily::generate_method_message(Symbol *klass_name, Method* method, TRAPS) const {
 481   stringStream ss;
 482   ss.print("Method ");
 483   Symbol* name = method->name();
 484   Symbol* signature = method->signature();
 485   ss.write((const char*)klass_name->bytes(), klass_name->utf8_length());
 486   ss.print(".");
 487   ss.write((const char*)name->bytes(), name->utf8_length());
 488   ss.write((const char*)signature->bytes(), signature->utf8_length());
 489   ss.print(" is abstract");
 490   return SymbolTable::new_symbol(ss.base(), (int)ss.size(), THREAD);

 491 }
 492 
 493 Symbol* MethodFamily::generate_conflicts_message(GrowableArray<Method*>* methods, TRAPS) const {
 494   stringStream ss;
 495   ss.print("Conflicting default methods:");
 496   for (int i = 0; i < methods->length(); ++i) {
 497     Method* method = methods->at(i);
 498     Symbol* klass = method->klass_name();
 499     Symbol* name = method->name();
 500     ss.print(" ");
 501     ss.write((const char*)klass->bytes(), klass->utf8_length());
 502     ss.print(".");
 503     ss.write((const char*)name->bytes(), name->utf8_length());
 504   }
 505   return SymbolTable::new_symbol(ss.base(), (int)ss.size(), THREAD);

 506 }
 507 
 508 
 509 class StateRestorer;
 510 
 511 // StatefulMethodFamily is a wrapper around a MethodFamily that maintains the
 512 // qualification state during hierarchy visitation, and applies that state
 513 // when adding members to the MethodFamily
 514 class StatefulMethodFamily : public ResourceObj {
 515   friend class StateRestorer;
 516  private:
 517   QualifiedState _qualification_state;
 518 
 519   void set_qualification_state(QualifiedState state) {
 520     _qualification_state = state;
 521   }
 522 
 523  protected:
 524   MethodFamily* _method_family;
 525 




 457     assert(has_target(), "Should be called otherwise");
 458     streamIndentor si(str, indent * 2);
 459     str->indent().print("Selected method: ");
 460     print_method(str, _selected_target);
 461     Klass* method_holder = _selected_target->method_holder();
 462     if (!method_holder->is_interface()) {
 463       str->print(" : in superclass");
 464     }
 465     str->cr();
 466   }
 467 
 468   void print_exception(outputStream* str, int indent) {
 469     assert(throws_exception(), "Should be called otherwise");
 470     assert(_exception_name != NULL, "exception_name should be set");
 471     streamIndentor si(str, indent * 2);
 472     str->indent().print_cr("%s: %s", _exception_name->as_C_string(), _exception_message->as_C_string());
 473   }
 474 };
 475 
 476 Symbol* MethodFamily::generate_no_defaults_message(TRAPS) const {
 477   Symbol* s = SymbolTable::new_symbol("No qualifying defaults found", CHECK_NULL);
 478   return s;
 479 }
 480 
 481 Symbol* MethodFamily::generate_method_message(Symbol *klass_name, Method* method, TRAPS) const {
 482   stringStream ss;
 483   ss.print("Method ");
 484   Symbol* name = method->name();
 485   Symbol* signature = method->signature();
 486   ss.write((const char*)klass_name->bytes(), klass_name->utf8_length());
 487   ss.print(".");
 488   ss.write((const char*)name->bytes(), name->utf8_length());
 489   ss.write((const char*)signature->bytes(), signature->utf8_length());
 490   ss.print(" is abstract");
 491   Symbol* s = SymbolTable::new_symbol(ss.base(), (int)ss.size(), CHECK_NULL);
 492   return s;
 493 }
 494 
 495 Symbol* MethodFamily::generate_conflicts_message(GrowableArray<Method*>* methods, TRAPS) const {
 496   stringStream ss;
 497   ss.print("Conflicting default methods:");
 498   for (int i = 0; i < methods->length(); ++i) {
 499     Method* method = methods->at(i);
 500     Symbol* klass = method->klass_name();
 501     Symbol* name = method->name();
 502     ss.print(" ");
 503     ss.write((const char*)klass->bytes(), klass->utf8_length());
 504     ss.print(".");
 505     ss.write((const char*)name->bytes(), name->utf8_length());
 506   }
 507   Symbol* s = SymbolTable::new_symbol(ss.base(), (int)ss.size(), CHECK_NULL);
 508   return s;
 509 }
 510 
 511 
 512 class StateRestorer;
 513 
 514 // StatefulMethodFamily is a wrapper around a MethodFamily that maintains the
 515 // qualification state during hierarchy visitation, and applies that state
 516 // when adding members to the MethodFamily
 517 class StatefulMethodFamily : public ResourceObj {
 518   friend class StateRestorer;
 519  private:
 520   QualifiedState _qualification_state;
 521 
 522   void set_qualification_state(QualifiedState state) {
 523     _qualification_state = state;
 524   }
 525 
 526  protected:
 527   MethodFamily* _method_family;
 528 


< prev index next >