Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_reflect_Method.c 7356 2007-02-14 11:00:28Z twisti $
+ $Id: java_lang_reflect_Method.c 7910 2007-05-16 08:02:52Z twisti $
*/
#include "native/jni.h"
#include "native/native.h"
+
#include "native/include/java_lang_Object.h"
#include "native/include/java_lang_Class.h"
#include "native/include/java_lang_String.h"
+
#include "native/include/java_lang_reflect_Method.h"
#include "vm/access.h"
#include "vm/builtin.h"
#include "vm/exceptions.h"
#include "vm/initialize.h"
+#include "vm/resolve.h"
#include "vm/stringlocal.h"
+/* native methods implemented by this file ************************************/
+
+static JNINativeMethod methods[] = {
+ { "getModifiersInternal", "()I", (void *) (ptrint) &Java_java_lang_reflect_Method_getModifiersInternal },
+ { "getReturnType", "()Ljava/lang/Class;", (void *) (ptrint) &Java_java_lang_reflect_Method_getReturnType },
+ { "getParameterTypes", "()[Ljava/lang/Class;", (void *) (ptrint) &Java_java_lang_reflect_Method_getParameterTypes },
+ { "getExceptionTypes", "()[Ljava/lang/Class;", (void *) (ptrint) &Java_java_lang_reflect_Method_getExceptionTypes },
+ { "invokeNative", "(Ljava/lang/Object;[Ljava/lang/Object;Ljava/lang/Class;I)Ljava/lang/Object;", (void *) (ptrint) &Java_java_lang_reflect_Method_invokeNative },
+ { "getSignature", "()Ljava/lang/String;", (void *) (ptrint) &Java_java_lang_reflect_Method_getSignature },
+};
+
+
+/* _Jv_java_lang_reflect_Method_init *******************************************
+
+ Register native functions.
+
+*******************************************************************************/
+
+void _Jv_java_lang_reflect_Method_init(void)
+{
+ utf *u;
+
+ u = utf_new_char("java/lang/reflect/Method");
+
+ native_method_register(u, methods, NATIVE_METHODS_COUNT);
+}
+
+
/*
* Class: java/lang/reflect/Method
* Method: getModifiersInternal
c = (classinfo *) this->declaringClass;
m = &(c->methods[this->slot]);
- return native_get_parametertypes(m);
+ return method_get_parametertypearray(m);
}
c = (classinfo *) this->declaringClass;
m = &(c->methods[this->slot]);
- return native_get_exceptiontypes(m);
+ return method_get_exceptionarray(m);
}
m = &(c->methods[slot]);
/* check method access */
+
/* check if we should bypass security checks (AccessibleObject) */
if (this->flag == false) {
- if (!access_check_caller(c, m->flags, 1))
+ if (!access_check_member(c, m->flags, 1))
return NULL;
}
*/
JNIEXPORT java_lang_String* JNICALL Java_java_lang_reflect_Method_getSignature(JNIEnv *env, java_lang_reflect_Method* this)
{
- classinfo *c;
- methodinfo *m;
- java_lang_String *s;
+ classinfo *c;
+ methodinfo *m;
+ java_objectheader *o;
c = (classinfo *) this->declaringClass;
m = &(c->methods[this->slot]);
if (m->signature == NULL)
return NULL;
- s = javastring_new(m->signature);
+ o = javastring_new(m->signature);
- /* in error case, s == NULL */
+ /* in error case o is NULL */
- return s;
+ return (java_lang_String *) o;
}