src/hotspot/share/interpreter/linkResolver.cpp
changeset 54432 532e88de77eb
parent 53838 c8c9bd65c198
child 54600 69cfd80f8706
equal deleted inserted replaced
54431:ad9fa99fa48e 54432:532e88de77eb
   260   _current_klass = pool->pool_holder();
   260   _current_klass = pool->pool_holder();
   261   _current_method = methodHandle();
   261   _current_method = methodHandle();
   262 
   262 
   263   // Coming from the constant pool always checks access
   263   // Coming from the constant pool always checks access
   264   _check_access  = true;
   264   _check_access  = true;
   265 }
       
   266 
       
   267 char* LinkInfo::method_string() const {
       
   268   return Method::name_and_sig_as_C_string(_resolved_klass, _name, _signature);
       
   269 }
   265 }
   270 
   266 
   271 #ifndef PRODUCT
   267 #ifndef PRODUCT
   272 void LinkInfo::print() {
   268 void LinkInfo::print() {
   273   ResourceMark rm;
   269   ResourceMark rm;
   591     ResourceMark rm(THREAD);
   587     ResourceMark rm(THREAD);
   592     bool same_module = (sel_klass->module() == ref_klass->module());
   588     bool same_module = (sel_klass->module() == ref_klass->module());
   593     Exceptions::fthrow(
   589     Exceptions::fthrow(
   594       THREAD_AND_LOCATION,
   590       THREAD_AND_LOCATION,
   595       vmSymbols::java_lang_IllegalAccessError(),
   591       vmSymbols::java_lang_IllegalAccessError(),
   596       "class %s tried to access %s%s%smethod %s.%s%s (%s%s%s)",
   592       "class %s tried to access %s%s%smethod '%s' (%s%s%s)",
   597       ref_klass->external_name(),
   593       ref_klass->external_name(),
   598       sel_method->is_abstract()  ? "abstract "  : "",
   594       sel_method->is_abstract()  ? "abstract "  : "",
   599       sel_method->is_protected() ? "protected " : "",
   595       sel_method->is_protected() ? "protected " : "",
   600       sel_method->is_private()   ? "private "   : "",
   596       sel_method->is_private()   ? "private "   : "",
   601       sel_klass->external_name(),
   597       sel_method->external_name(),
   602       sel_method->name()->as_C_string(),
       
   603       sel_method->signature()->as_C_string(),
       
   604       (same_module) ? ref_klass->joint_in_module_of_loader(sel_klass) : ref_klass->class_in_module_of_loader(),
   598       (same_module) ? ref_klass->joint_in_module_of_loader(sel_klass) : ref_klass->class_in_module_of_loader(),
   605       (same_module) ? "" : "; ",
   599       (same_module) ? "" : "; ",
   606       (same_module) ? "" : sel_klass->class_in_module_of_loader()
   600       (same_module) ? "" : sel_klass->class_in_module_of_loader()
   607     );
   601     );
   608     return;
   602     return;
   668     Klass* resolved_method_class = resolved_method->method_holder();
   662     Klass* resolved_method_class = resolved_method->method_holder();
   669     ClassLoaderData* target_loader_data = resolved_method_class->class_loader_data();
   663     ClassLoaderData* target_loader_data = resolved_method_class->class_loader_data();
   670     assert(target_loader_data != NULL, "resolved method's class has no class loader data");
   664     assert(target_loader_data != NULL, "resolved method's class has no class loader data");
   671 
   665 
   672     stringStream ss;
   666     stringStream ss;
   673     ss.print("loader constraint violation: when resolving %s"
   667     ss.print("loader constraint violation: when resolving %s '", method_type);
   674              " \"%s\" the class loader %s of the current class, %s,"
   668     Method::print_external_name(&ss, link_info.resolved_klass(), link_info.name(), link_info.signature());
       
   669     ss.print("' the class loader %s of the current class, %s,"
   675              " and the class loader %s for the method's defining class, %s, have"
   670              " and the class loader %s for the method's defining class, %s, have"
   676              " different Class objects for the type %s used in the signature (%s; %s)",
   671              " different Class objects for the type %s used in the signature (%s; %s)",
   677              method_type,
       
   678              link_info.method_string(),
       
   679              current_loader_data->loader_name_and_id(),
   672              current_loader_data->loader_name_and_id(),
   680              current_class->name()->as_C_string(),
   673              current_class->name()->as_C_string(),
   681              target_loader_data->loader_name_and_id(),
   674              target_loader_data->loader_name_and_id(),
   682              resolved_method_class->name()->as_C_string(),
   675              resolved_method_class->name()->as_C_string(),
   683              failed_type_symbol->as_C_string(),
   676              failed_type_symbol->as_C_string(),
   737   }
   730   }
   738 
   731 
   739   // 2. check constant pool tag for called method - must be JVM_CONSTANT_Methodref
   732   // 2. check constant pool tag for called method - must be JVM_CONSTANT_Methodref
   740   if (!link_info.tag().is_invalid() && !link_info.tag().is_method()) {
   733   if (!link_info.tag().is_invalid() && !link_info.tag().is_method()) {
   741     ResourceMark rm(THREAD);
   734     ResourceMark rm(THREAD);
   742     char buf[200];
   735     stringStream ss;
   743     jio_snprintf(buf, sizeof(buf), "Method %s must be Methodref constant", link_info.method_string());
   736     ss.print("Method '");
   744     THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
   737     Method::print_external_name(&ss, link_info.resolved_klass(), link_info.name(), link_info.signature());
       
   738     ss.print("' must be Methodref constant");
       
   739     THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), ss.as_string());
   745   }
   740   }
   746 
   741 
   747   // 3. lookup method in resolved klass and its super klasses
   742   // 3. lookup method in resolved klass and its super klasses
   748   methodHandle resolved_method(THREAD, lookup_method_in_klasses(link_info, true, false));
   743   methodHandle resolved_method(THREAD, lookup_method_in_klasses(link_info, true, false));
   749 
   744 
   762   }
   757   }
   763 
   758 
   764   // 5. method lookup failed
   759   // 5. method lookup failed
   765   if (resolved_method.is_null()) {
   760   if (resolved_method.is_null()) {
   766     ResourceMark rm(THREAD);
   761     ResourceMark rm(THREAD);
       
   762     stringStream ss;
       
   763     ss.print("'");
       
   764     Method::print_external_name(&ss, resolved_klass, link_info.name(), link_info.signature());
       
   765     ss.print("'");
   767     THROW_MSG_CAUSE_(vmSymbols::java_lang_NoSuchMethodError(),
   766     THROW_MSG_CAUSE_(vmSymbols::java_lang_NoSuchMethodError(),
   768                     Method::name_and_sig_as_C_string(resolved_klass,
   767                      ss.as_string(), nested_exception, NULL);
   769                                                      link_info.name(),
       
   770                                                      link_info.signature()),
       
   771                     nested_exception, NULL);
       
   772   }
   768   }
   773 
   769 
   774   // 6. access checks, access checking may be turned off when calling from within the VM.
   770   // 6. access checks, access checking may be turned off when calling from within the VM.
   775   Klass* current_klass = link_info.current_klass();
   771   Klass* current_klass = link_info.current_klass();
   776   if (link_info.check_access()) {
   772   if (link_info.check_access()) {
   838   }
   834   }
   839 
   835 
   840   // check constant pool tag for called method - must be JVM_CONSTANT_InterfaceMethodref
   836   // check constant pool tag for called method - must be JVM_CONSTANT_InterfaceMethodref
   841   if (!link_info.tag().is_invalid() && !link_info.tag().is_interface_method()) {
   837   if (!link_info.tag().is_invalid() && !link_info.tag().is_interface_method()) {
   842     ResourceMark rm(THREAD);
   838     ResourceMark rm(THREAD);
   843     char buf[200];
   839     stringStream ss;
   844     jio_snprintf(buf, sizeof(buf), "Method %s must be InterfaceMethodref constant", link_info.method_string());
   840     ss.print("Method '");
   845     THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
   841     Method::print_external_name(&ss, link_info.resolved_klass(), link_info.name(), link_info.signature());
       
   842     ss.print("' must be InterfaceMethodref constant");
       
   843     THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), ss.as_string());
   846   }
   844   }
   847 
   845 
   848   // lookup method in this interface or its super, java.lang.Object
   846   // lookup method in this interface or its super, java.lang.Object
   849   // JDK8: also look for static methods
   847   // JDK8: also look for static methods
   850   methodHandle resolved_method(THREAD, lookup_method_in_klasses(link_info, false, true));
   848   methodHandle resolved_method(THREAD, lookup_method_in_klasses(link_info, false, true));
   855   }
   853   }
   856 
   854 
   857   if (resolved_method.is_null()) {
   855   if (resolved_method.is_null()) {
   858     // no method found
   856     // no method found
   859     ResourceMark rm(THREAD);
   857     ResourceMark rm(THREAD);
   860     THROW_MSG_NULL(vmSymbols::java_lang_NoSuchMethodError(),
   858     stringStream ss;
   861                    Method::name_and_sig_as_C_string(resolved_klass,
   859     ss.print("'");
   862                                                     link_info.name(),
   860     Method::print_external_name(&ss, resolved_klass, link_info.name(), link_info.signature());
   863                                                     link_info.signature()));
   861     ss.print("'");
       
   862     THROW_MSG_NULL(vmSymbols::java_lang_NoSuchMethodError(), ss.as_string());
   864   }
   863   }
   865 
   864 
   866   if (link_info.check_access()) {
   865   if (link_info.check_access()) {
   867     // JDK8 adds non-public interface methods, and accessability check requirement
   866     // JDK8 adds non-public interface methods, and accessability check requirement
   868     Klass* current_klass = link_info.current_klass();
   867     Klass* current_klass = link_info.current_klass();
   879     check_method_loader_constraints(link_info, resolved_method, "interface method", CHECK_NULL);
   878     check_method_loader_constraints(link_info, resolved_method, "interface method", CHECK_NULL);
   880   }
   879   }
   881 
   880 
   882   if (code != Bytecodes::_invokestatic && resolved_method->is_static()) {
   881   if (code != Bytecodes::_invokestatic && resolved_method->is_static()) {
   883     ResourceMark rm(THREAD);
   882     ResourceMark rm(THREAD);
   884     char buf[200];
   883     stringStream ss;
   885     jio_snprintf(buf, sizeof(buf), "Expected instance not static method %s",
   884     ss.print("Expected instance not static method '");
   886                  Method::name_and_sig_as_C_string(resolved_klass,
   885     Method::print_external_name(&ss, resolved_klass,
   887                  resolved_method->name(), resolved_method->signature()));
   886                                 resolved_method->name(), resolved_method->signature());
   888     THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
   887     ss.print("'");
       
   888     THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), ss.as_string());
   889   }
   889   }
   890 
   890 
   891   if (log_develop_is_enabled(Trace, itables)) {
   891   if (log_develop_is_enabled(Trace, itables)) {
   892     char buf[200];
   892     char buf[200];
   893     jio_snprintf(buf, sizeof(buf), "%s resolved interface method: caller-class:",
   893     jio_snprintf(buf, sizeof(buf), "%s resolved interface method: caller-class:",
  1084   assert(resolved_method->name() != vmSymbols::class_initializer_name(), "should have been checked in verifier");
  1084   assert(resolved_method->name() != vmSymbols::class_initializer_name(), "should have been checked in verifier");
  1085 
  1085 
  1086   // check if static
  1086   // check if static
  1087   if (!resolved_method->is_static()) {
  1087   if (!resolved_method->is_static()) {
  1088     ResourceMark rm(THREAD);
  1088     ResourceMark rm(THREAD);
  1089     char buf[200];
  1089     stringStream ss;
  1090     jio_snprintf(buf, sizeof(buf), "Expected static method %s", Method::name_and_sig_as_C_string(resolved_klass,
  1090     ss.print("Expected static method '");
  1091                                                       resolved_method->name(),
  1091     resolved_method()->print_external_name(&ss);
  1092                                                       resolved_method->signature()));
  1092     ss.print("'");
  1093     THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
  1093     THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), ss.as_string());
  1094   }
  1094   }
  1095   return resolved_method;
  1095   return resolved_method;
  1096 }
  1096 }
  1097 
  1097 
  1098 
  1098 
  1125 
  1125 
  1126   // check if method name is <init>, that it is found in same klass as static type
  1126   // check if method name is <init>, that it is found in same klass as static type
  1127   if (resolved_method->name() == vmSymbols::object_initializer_name() &&
  1127   if (resolved_method->name() == vmSymbols::object_initializer_name() &&
  1128       resolved_method->method_holder() != resolved_klass) {
  1128       resolved_method->method_holder() != resolved_klass) {
  1129     ResourceMark rm(THREAD);
  1129     ResourceMark rm(THREAD);
       
  1130     stringStream ss;
       
  1131     ss.print("%s: method '", resolved_klass->external_name());
       
  1132     resolved_method->signature()->print_as_signature_external_return_type(&ss);
       
  1133     ss.print(" %s(", resolved_method->name()->as_C_string());
       
  1134     resolved_method->signature()->print_as_signature_external_parameters(&ss);
       
  1135     ss.print(")' not found");
  1130     Exceptions::fthrow(
  1136     Exceptions::fthrow(
  1131       THREAD_AND_LOCATION,
  1137       THREAD_AND_LOCATION,
  1132       vmSymbols::java_lang_NoSuchMethodError(),
  1138       vmSymbols::java_lang_NoSuchMethodError(),
  1133       "%s: method %s%s not found",
  1139       "%s", ss.as_string());
  1134       resolved_klass->external_name(),
       
  1135       resolved_method->name()->as_C_string(),
       
  1136       resolved_method->signature()->as_C_string()
       
  1137     );
       
  1138     return NULL;
  1140     return NULL;
  1139   }
  1141   }
  1140 
  1142 
  1141   // ensure that invokespecial's interface method reference is in
  1143   // ensure that invokespecial's interface method reference is in
  1142   // a direct superinterface, not an indirect superinterface
  1144   // a direct superinterface, not an indirect superinterface
  1151                         SystemDictionary::reflect_MagicAccessorImpl_klass());
  1153                         SystemDictionary::reflect_MagicAccessorImpl_klass());
  1152 
  1154 
  1153     if (!is_reflect &&
  1155     if (!is_reflect &&
  1154         !klass_to_check->is_same_or_direct_interface(resolved_klass)) {
  1156         !klass_to_check->is_same_or_direct_interface(resolved_klass)) {
  1155       ResourceMark rm(THREAD);
  1157       ResourceMark rm(THREAD);
  1156       char buf[200];
  1158       stringStream ss;
  1157       jio_snprintf(buf, sizeof(buf),
  1159       ss.print("Interface method reference: '");
  1158                    "Interface method reference: %s, is in an indirect superinterface of %s",
  1160       resolved_method->print_external_name(&ss);
  1159                    Method::name_and_sig_as_C_string(resolved_klass,
  1161       ss.print("', is in an indirect superinterface of %s",
  1160                                                                            resolved_method->name(),
  1162                current_klass->external_name());
  1161                                                                            resolved_method->signature()),
  1163       THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), ss.as_string());
  1162                    current_klass->external_name());
       
  1163       THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
       
  1164     }
  1164     }
  1165   }
  1165   }
  1166 
  1166 
  1167   // check if not static
  1167   // check if not static
  1168   if (resolved_method->is_static()) {
  1168   if (resolved_method->is_static()) {
  1169     ResourceMark rm(THREAD);
  1169     ResourceMark rm(THREAD);
  1170     char buf[200];
  1170     stringStream ss;
  1171     jio_snprintf(buf, sizeof(buf),
  1171     ss.print("Expecting non-static method '");
  1172                  "Expecting non-static method %s",
  1172     resolved_method->print_external_name(&ss);
  1173                  Method::name_and_sig_as_C_string(resolved_klass,
  1173     ss.print("'");
  1174                                                   resolved_method->name(),
  1174     THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), ss.as_string());
  1175                                                   resolved_method->signature()));
       
  1176     THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
       
  1177   }
  1175   }
  1178 
  1176 
  1179   if (log_develop_is_enabled(Trace, itables)) {
  1177   if (log_develop_is_enabled(Trace, itables)) {
  1180     trace_method_resolution("invokespecial resolved method: caller-class:",
  1178     trace_method_resolution("invokespecial resolved method: caller-class:",
  1181                             current_klass, resolved_klass, resolved_method, true);
  1179                             current_klass, resolved_klass, resolved_method, true);
  1217                                                      resolved_method->signature(),
  1215                                                      resolved_method->signature(),
  1218                                                      Klass::find_private, CHECK);
  1216                                                      Klass::find_private, CHECK);
  1219       // check if found
  1217       // check if found
  1220       if (sel_method.is_null()) {
  1218       if (sel_method.is_null()) {
  1221         ResourceMark rm(THREAD);
  1219         ResourceMark rm(THREAD);
  1222         THROW_MSG(vmSymbols::java_lang_AbstractMethodError(),
  1220         stringStream ss;
  1223                   Method::name_and_sig_as_C_string(resolved_klass,
  1221         ss.print("'");
  1224                                             resolved_method->name(),
  1222         resolved_method->print_external_name(&ss);
  1225                                             resolved_method->signature()));
  1223         ss.print("'");
       
  1224         THROW_MSG(vmSymbols::java_lang_AbstractMethodError(), ss.as_string());
  1226       // check loader constraints if found a different method
  1225       // check loader constraints if found a different method
  1227       } else if (sel_method() != resolved_method()) {
  1226       } else if (sel_method() != resolved_method()) {
  1228         check_method_loader_constraints(link_info, sel_method, "method", CHECK);
  1227         check_method_loader_constraints(link_info, sel_method, "method", CHECK);
  1229       }
  1228       }
  1230     }
  1229     }
  1242       if (!receiver_klass->is_subtype_of(sender)) {
  1241       if (!receiver_klass->is_subtype_of(sender)) {
  1243         ResourceMark rm(THREAD);
  1242         ResourceMark rm(THREAD);
  1244         char buf[500];
  1243         char buf[500];
  1245         jio_snprintf(buf, sizeof(buf),
  1244         jio_snprintf(buf, sizeof(buf),
  1246                      "Receiver class %s must be the current class or a subtype of interface %s",
  1245                      "Receiver class %s must be the current class or a subtype of interface %s",
  1247                      receiver_klass->name()->as_C_string(),
  1246                      receiver_klass->external_name(),
  1248                      sender->name()->as_C_string());
  1247                      sender->external_name());
  1249         THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), buf);
  1248         THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), buf);
  1250       }
  1249       }
  1251     }
  1250     }
  1252   }
  1251   }
  1253 
  1252 
  1254   // check if not static
  1253   // check if not static
  1255   if (sel_method->is_static()) {
  1254   if (sel_method->is_static()) {
  1256     ResourceMark rm(THREAD);
  1255     ResourceMark rm(THREAD);
  1257     char buf[200];
  1256     stringStream ss;
  1258     jio_snprintf(buf, sizeof(buf), "Expecting non-static method %s", Method::name_and_sig_as_C_string(resolved_klass,
  1257     ss.print("Expecting non-static method '");
  1259                                                                                       resolved_method->name(),
  1258     resolved_method->print_external_name(&ss);
  1260                                                                                       resolved_method->signature()));
  1259     ss.print("'");
  1261     THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
  1260     THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), ss.as_string());
  1262   }
  1261   }
  1263 
  1262 
  1264   // check if abstract
  1263   // check if abstract
  1265   if (sel_method->is_abstract()) {
  1264   if (sel_method->is_abstract()) {
  1266     ResourceMark rm(THREAD);
  1265     ResourceMark rm(THREAD);
  1267     THROW_MSG(vmSymbols::java_lang_AbstractMethodError(),
  1266     stringStream ss;
  1268               Method::name_and_sig_as_C_string(resolved_klass,
  1267     ss.print("'");
  1269                                                sel_method->name(),
  1268     Method::print_external_name(&ss, resolved_klass, sel_method->name(), sel_method->signature());
  1270                                                sel_method->signature()));
  1269     ss.print("'");
       
  1270     THROW_MSG(vmSymbols::java_lang_AbstractMethodError(), ss.as_string());
  1271   }
  1271   }
  1272 
  1272 
  1273   if (log_develop_is_enabled(Trace, itables)) {
  1273   if (log_develop_is_enabled(Trace, itables)) {
  1274     trace_method_resolution("invokespecial selected method: resolved-class:",
  1274     trace_method_resolution("invokespecial selected method: resolved-class:",
  1275                             resolved_klass, resolved_klass, sel_method, true);
  1275                             resolved_klass, resolved_klass, sel_method, true);
  1303   Klass* current_klass = link_info.current_klass();
  1303   Klass* current_klass = link_info.current_klass();
  1304 
  1304 
  1305   // This is impossible, if resolve_klass is an interface, we've thrown icce in resolve_method
  1305   // This is impossible, if resolve_klass is an interface, we've thrown icce in resolve_method
  1306   if (resolved_klass->is_interface() && resolved_method->is_private()) {
  1306   if (resolved_klass->is_interface() && resolved_method->is_private()) {
  1307     ResourceMark rm(THREAD);
  1307     ResourceMark rm(THREAD);
  1308     char buf[200];
  1308     stringStream ss;
  1309     jio_snprintf(buf, sizeof(buf), "private interface method requires invokespecial, not invokevirtual: method %s, caller-class:%s",
  1309     ss.print("private interface method requires invokespecial, not invokevirtual: method '");
  1310                  Method::name_and_sig_as_C_string(resolved_klass,
  1310     resolved_method->print_external_name(&ss);
  1311                                                   resolved_method->name(),
  1311     ss.print("', caller-class: %s",
  1312                                                   resolved_method->signature()),
  1312              (current_klass == NULL ? "<null>" : current_klass->internal_name()));
  1313                    (current_klass == NULL ? "<NULL>" : current_klass->internal_name()));
  1313     THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), ss.as_string());
  1314     THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
       
  1315   }
  1314   }
  1316 
  1315 
  1317   // check if not static
  1316   // check if not static
  1318   if (resolved_method->is_static()) {
  1317   if (resolved_method->is_static()) {
  1319     ResourceMark rm(THREAD);
  1318     ResourceMark rm(THREAD);
  1320     char buf[200];
  1319     stringStream ss;
  1321     jio_snprintf(buf, sizeof(buf), "Expecting non-static method %s", Method::name_and_sig_as_C_string(resolved_klass,
  1320     ss.print("Expecting non-static method '");
  1322                                                                                            resolved_method->name(),
  1321     resolved_method->print_external_name(&ss);
  1323                                                                                            resolved_method->signature()));
  1322     ss.print("'");
  1324     THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
  1323     THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), ss.as_string());
  1325   }
  1324   }
  1326 
  1325 
  1327   if (log_develop_is_enabled(Trace, vtables)) {
  1326   if (log_develop_is_enabled(Trace, vtables)) {
  1328     trace_method_resolution("invokevirtual resolved method: caller-class:",
  1327     trace_method_resolution("invokevirtual resolved method: caller-class:",
  1329                             current_klass, resolved_klass, resolved_method, false);
  1328                             current_klass, resolved_klass, resolved_method, false);
  1468     }
  1467     }
  1469     // check access
  1468     // check access
  1470     // Throw Illegal Access Error if selected_method is not public.
  1469     // Throw Illegal Access Error if selected_method is not public.
  1471     if (!selected_method->is_public()) {
  1470     if (!selected_method->is_public()) {
  1472       ResourceMark rm(THREAD);
  1471       ResourceMark rm(THREAD);
  1473       THROW_MSG(vmSymbols::java_lang_IllegalAccessError(),
  1472       stringStream ss;
  1474                 Method::name_and_sig_as_C_string(recv_klass,
  1473       ss.print("'");
  1475                                                  selected_method->name(),
  1474       Method::print_external_name(&ss, recv_klass, selected_method->name(), selected_method->signature());
  1476                                                  selected_method->signature()));
  1475       ss.print("'");
       
  1476       THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string());
  1477     }
  1477     }
  1478     // check if abstract
  1478     // check if abstract
  1479     if (check_null_and_abstract && selected_method->is_abstract()) {
  1479     if (check_null_and_abstract && selected_method->is_abstract()) {
  1480       throw_abstract_method_error(resolved_method, selected_method, recv_klass, CHECK);
  1480       throw_abstract_method_error(resolved_method, selected_method, recv_klass, CHECK);
  1481     }
  1481     }
  1804   } else {
  1804   } else {
  1805     ss.print("Missing implementation of");
  1805     ss.print("Missing implementation of");
  1806   }
  1806   }
  1807 
  1807 
  1808   assert(resolved_method.not_null(), "Sanity");
  1808   assert(resolved_method.not_null(), "Sanity");
  1809   ss.print(" resolved method %s%s%s%s of %s %s.",
  1809   ss.print(" resolved method '%s%s",
  1810            resolved_method->is_abstract() ? "abstract " : "",
  1810            resolved_method->is_abstract() ? "abstract " : "",
  1811            resolved_method->is_private()  ? "private "  : "",
  1811            resolved_method->is_private()  ? "private "  : "");
  1812            resolved_method->name()->as_C_string(),
  1812   resolved_method->signature()->print_as_signature_external_return_type(&ss);
  1813            resolved_method->signature()->as_C_string(),
  1813   ss.print(" %s(", resolved_method->name()->as_C_string());
       
  1814   resolved_method->signature()->print_as_signature_external_parameters(&ss);
       
  1815   ss.print(")' of %s %s.",
  1814            resolved_klass->external_kind(),
  1816            resolved_klass->external_kind(),
  1815            resolved_klass->external_name());
  1817            resolved_klass->external_name());
  1816 
  1818 
  1817   if (selected_method.not_null() && !(resolved_method == selected_method)) {
  1819   if (selected_method.not_null() && !(resolved_method == selected_method)) {
  1818     ss.print(" Selected method is %s%s%s.",
  1820     ss.print(" Selected method is '%s%s",
  1819              selected_method->is_abstract() ? "abstract " : "",
  1821              selected_method->is_abstract() ? "abstract " : "",
  1820              selected_method->is_private()  ? "private "  : "",
  1822              selected_method->is_private()  ? "private "  : "");
  1821              selected_method->name_and_sig_as_C_string());
  1823     selected_method->print_external_name(&ss);
       
  1824     ss.print("'.");
  1822   }
  1825   }
  1823 
  1826 
  1824   THROW_MSG(vmSymbols::java_lang_AbstractMethodError(), ss.as_string());
  1827   THROW_MSG(vmSymbols::java_lang_AbstractMethodError(), ss.as_string());
  1825 }
  1828 }