src/share/vm/prims/jvm.cpp

Print this page




1603     for (int i = 0; i < num_params; i++) {
1604       MethodParametersElement* params = mh->method_parameters_start();
1605       int index = params[i].name_cp_index;
1606       bounds_check(mh->constants(), index, CHECK_NULL);
1607 
1608       if (0 != index && !mh->constants()->tag_at(index).is_utf8()) {
1609         THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
1610                     "Wrong type at constant pool index");
1611       }
1612 
1613     }
1614 
1615     objArrayOop result_oop = oopFactory::new_objArray(SystemDictionary::reflect_Parameter_klass(), num_params, CHECK_NULL);
1616     objArrayHandle result (THREAD, result_oop);
1617 
1618     for (int i = 0; i < num_params; i++) {
1619       MethodParametersElement* params = mh->method_parameters_start();
1620       // For a 0 index, give a NULL symbol
1621       Symbol* const sym = 0 != params[i].name_cp_index ?
1622         mh->constants()->symbol_at(params[i].name_cp_index) : NULL;
1623       int flags = build_int_from_shorts(params[i].flags_lo, params[i].flags_hi);
1624       oop param = Reflection::new_parameter(reflected_method, i, sym,
1625                                             flags, CHECK_NULL);
1626       result->obj_at_put(i, param);
1627     }
1628     return (jobjectArray)JNIHandles::make_local(env, result());
1629   } else {
1630     return (jobjectArray)NULL;
1631   }
1632 }
1633 JVM_END
1634 
1635 // New (JDK 1.4) reflection implementation /////////////////////////////////////
1636 
1637 JVM_ENTRY(jobjectArray, JVM_GetClassDeclaredFields(JNIEnv *env, jclass ofClass, jboolean publicOnly))
1638 {
1639   JVMWrapper("JVM_GetClassDeclaredFields");
1640   JvmtiVMObjectAllocEventCollector oam;
1641 
1642   // Exclude primitive types and array types
1643   if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass)) ||




1603     for (int i = 0; i < num_params; i++) {
1604       MethodParametersElement* params = mh->method_parameters_start();
1605       int index = params[i].name_cp_index;
1606       bounds_check(mh->constants(), index, CHECK_NULL);
1607 
1608       if (0 != index && !mh->constants()->tag_at(index).is_utf8()) {
1609         THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
1610                     "Wrong type at constant pool index");
1611       }
1612 
1613     }
1614 
1615     objArrayOop result_oop = oopFactory::new_objArray(SystemDictionary::reflect_Parameter_klass(), num_params, CHECK_NULL);
1616     objArrayHandle result (THREAD, result_oop);
1617 
1618     for (int i = 0; i < num_params; i++) {
1619       MethodParametersElement* params = mh->method_parameters_start();
1620       // For a 0 index, give a NULL symbol
1621       Symbol* const sym = 0 != params[i].name_cp_index ?
1622         mh->constants()->symbol_at(params[i].name_cp_index) : NULL;
1623       int flags = params[i].flags;
1624       oop param = Reflection::new_parameter(reflected_method, i, sym,
1625                                             flags, CHECK_NULL);
1626       result->obj_at_put(i, param);
1627     }
1628     return (jobjectArray)JNIHandles::make_local(env, result());
1629   } else {
1630     return (jobjectArray)NULL;
1631   }
1632 }
1633 JVM_END
1634 
1635 // New (JDK 1.4) reflection implementation /////////////////////////////////////
1636 
1637 JVM_ENTRY(jobjectArray, JVM_GetClassDeclaredFields(JNIEnv *env, jclass ofClass, jboolean publicOnly))
1638 {
1639   JVMWrapper("JVM_GetClassDeclaredFields");
1640   JvmtiVMObjectAllocEventCollector oam;
1641 
1642   // Exclude primitive types and array types
1643   if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(ofClass)) ||