< prev index next >

src/hotspot/share/runtime/reflection.cpp

Print this page




1068             JvmtiExport::clear_detected_exception((JavaThread*)THREAD);
1069           }
1070           JavaCallArguments args(Handle(THREAD, resolution_exception));
1071           THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(),
1072                       vmSymbols::throwable_void_signature(),
1073                       &args);
1074         }
1075       }  else {
1076         // if the method can be overridden, we resolve using the vtable index.
1077         assert(!reflected_method->has_itable_index(), "");
1078         int index = reflected_method->vtable_index();
1079         method = reflected_method;
1080         if (index != Method::nonvirtual_vtable_index) {
1081           method = methodHandle(THREAD, target_klass->method_at_vtable(index));
1082         }
1083         if (!method.is_null()) {
1084           // Check for abstract methods as well
1085           if (method->is_abstract()) {
1086             // new default: 6531596
1087             ResourceMark rm(THREAD);
1088             stringStream ss;
1089             ss.print("'");
1090             Method::print_external_name(&ss, target_klass, method->name(), method->signature());
1091             ss.print("'");
1092             Handle h_origexception = Exceptions::new_exception(THREAD,
1093               vmSymbols::java_lang_AbstractMethodError(), ss.as_string());



1094             JavaCallArguments args(h_origexception);
1095             THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(),
1096               vmSymbols::throwable_void_signature(),
1097               &args);
1098           }
1099         }
1100       }
1101     }
1102   }
1103 
1104   // I believe this is a ShouldNotGetHere case which requires
1105   // an internal vtable bug. If you ever get this please let Karen know.
1106   if (method.is_null()) {
1107     ResourceMark rm(THREAD);
1108     stringStream ss;
1109     ss.print("'");
1110     Method::print_external_name(&ss, klass,
1111                                      reflected_method->name(),
1112                                      reflected_method->signature());
1113     ss.print("'");
1114     THROW_MSG_0(vmSymbols::java_lang_NoSuchMethodError(), ss.as_string());
1115   }
1116 
1117   assert(ptypes->is_objArray(), "just checking");
1118   int args_len = args.is_null() ? 0 : args->length();
1119   // Check number of arguments
1120   if (ptypes->length() != args_len) {
1121     THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
1122                 "wrong number of arguments");
1123   }
1124 
1125   // Create object to contain parameters for the JavaCall
1126   JavaCallArguments java_args(method->size_of_parameters());
1127 
1128   if (!is_static) {
1129     java_args.push_oop(receiver);
1130   }
1131 
1132   for (int i = 0; i < args_len; i++) {
1133     oop type_mirror = ptypes->obj_at(i);
1134     oop arg = args->obj_at(i);




1068             JvmtiExport::clear_detected_exception((JavaThread*)THREAD);
1069           }
1070           JavaCallArguments args(Handle(THREAD, resolution_exception));
1071           THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(),
1072                       vmSymbols::throwable_void_signature(),
1073                       &args);
1074         }
1075       }  else {
1076         // if the method can be overridden, we resolve using the vtable index.
1077         assert(!reflected_method->has_itable_index(), "");
1078         int index = reflected_method->vtable_index();
1079         method = reflected_method;
1080         if (index != Method::nonvirtual_vtable_index) {
1081           method = methodHandle(THREAD, target_klass->method_at_vtable(index));
1082         }
1083         if (!method.is_null()) {
1084           // Check for abstract methods as well
1085           if (method->is_abstract()) {
1086             // new default: 6531596
1087             ResourceMark rm(THREAD);




1088             Handle h_origexception = Exceptions::new_exception(THREAD,
1089               vmSymbols::java_lang_AbstractMethodError(),
1090               Method::name_and_sig_as_C_string(target_klass,
1091               method->name(),
1092               method->signature()));
1093             JavaCallArguments args(h_origexception);
1094             THROW_ARG_0(vmSymbols::java_lang_reflect_InvocationTargetException(),
1095               vmSymbols::throwable_void_signature(),
1096               &args);
1097           }
1098         }
1099       }
1100     }
1101   }
1102 
1103   // I believe this is a ShouldNotGetHere case which requires
1104   // an internal vtable bug. If you ever get this please let Karen know.
1105   if (method.is_null()) {
1106     ResourceMark rm(THREAD);
1107     THROW_MSG_0(vmSymbols::java_lang_NoSuchMethodError(),
1108                 Method::name_and_sig_as_C_string(klass,
1109                 reflected_method->name(),
1110                 reflected_method->signature()));



1111   }
1112 
1113   assert(ptypes->is_objArray(), "just checking");
1114   int args_len = args.is_null() ? 0 : args->length();
1115   // Check number of arguments
1116   if (ptypes->length() != args_len) {
1117     THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
1118                 "wrong number of arguments");
1119   }
1120 
1121   // Create object to contain parameters for the JavaCall
1122   JavaCallArguments java_args(method->size_of_parameters());
1123 
1124   if (!is_static) {
1125     java_args.push_oop(receiver);
1126   }
1127 
1128   for (int i = 0; i < args_len; i++) {
1129     oop type_mirror = ptypes->obj_at(i);
1130     oop arg = args->obj_at(i);


< prev index next >