src/share/vm/prims/jvm.cpp

Print this page

        

*** 1796,1806 **** Method* method_ptr = jvm_get_method_common(method); methodHandle mh (THREAD, method_ptr); Handle reflected_method (THREAD, JNIHandles::resolve_non_null(method)); const int num_params = mh->method_parameters_length(); ! if (0 != num_params) { // make sure all the symbols are properly formatted for (int i = 0; i < num_params; i++) { MethodParametersElement* params = mh->method_parameters_start(); int index = params[i].name_cp_index; bounds_check(mh->constants(), index, CHECK_NULL); --- 1796,1816 ---- Method* method_ptr = jvm_get_method_common(method); methodHandle mh (THREAD, method_ptr); Handle reflected_method (THREAD, JNIHandles::resolve_non_null(method)); const int num_params = mh->method_parameters_length(); ! if (num_params < 0) { ! // A -1 return value from method_parameters_length means there is no ! // parameter data. Return null to indicate this to the reflection ! // API. ! assert(num_params == -1); ! return (jobjectArray)NULL; ! } else { ! // Otherwise, we return something up to reflection, even if it is ! // a zero-length array. Why? Because in some cases this can ! // trigger a MalformedParametersException. ! // make sure all the symbols are properly formatted for (int i = 0; i < num_params; i++) { MethodParametersElement* params = mh->method_parameters_start(); int index = params[i].name_cp_index; bounds_check(mh->constants(), index, CHECK_NULL);
*** 1824,1835 **** oop param = Reflection::new_parameter(reflected_method, i, sym, flags, CHECK_NULL); result->obj_at_put(i, param); } return (jobjectArray)JNIHandles::make_local(env, result()); - } else { - return (jobjectArray)NULL; } } JVM_END // New (JDK 1.4) reflection implementation ///////////////////////////////////// --- 1834,1843 ----