-/* nat/VMClass.c - java/lang/Class
+/* native/vm/VMClass.c - java/lang/Class
- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
- R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser,
- M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck,
- P. Tomsich, J. Wenninger
+ Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
+ R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
+ C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
+ Institut f. Computersprachen - TU Wien
This file is part of CACAO.
Changes: Joseph Wenninger
- $Id: VMClass.c 1313 2004-07-14 18:30:37Z twisti $
+ $Id: VMClass.c 1735 2004-12-07 14:33:27Z twisti $
*/
#include <string.h>
-#include "jni.h"
+
#include "types.h"
-#include "global.h"
-#include "builtin.h"
-#include "loader.h"
-#include "native.h"
-#include "tables.h"
+#include "mm/memory.h"
+#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_ClassLoader.h"
+#include "native/include/java_security_ProtectionDomain.h"
+#include "native/include/java_lang_reflect_Constructor.h"
+#include "native/include/java_lang_reflect_Field.h"
+#include "native/include/java_lang_reflect_Method.h"
+#include "native/include/java_lang_Throwable.h" /* java_lang_VMClass.h */
+#include "native/include/java_lang_VMClass.h"
#include "toolbox/logging.h"
-#include "toolbox/memory.h"
-#include "java_lang_Object.h"
-#include "java_lang_Class.h"
-#include "java_lang_ClassLoader.h"
-#include "java_security_ProtectionDomain.h"
-#include "java_lang_reflect_Constructor.h"
-#include "java_lang_reflect_Field.h"
-#include "java_lang_reflect_Method.h"
-#include "java_lang_Throwable.h" /* needed for java_lang_VMClass.h */
-#include "java_lang_VMClass.h"
+#include "vm/exceptions.h"
+#include "vm/global.h"
+#include "vm/loader.h"
+#include "vm/tables.h"
+#include "vm/builtin.h"
/* for selecting public members */
*/
JNIEXPORT java_lang_ClassLoader* JNICALL Java_java_lang_VMClass_getClassLoader(JNIEnv *env, jclass clazz, java_lang_Class *that)
{
- return ((classinfo*)that)->classloader;
+ return (java_lang_ClassLoader *) ((classinfo *) that)->classloader;
+
/* init_systemclassloader();
return SystemClassLoader;*/
setfield_critical(c,o,"declaringClass", "Ljava/lang/Class;", jobject, (jobject) that /*this*/);
/* ((java_lang_reflect_Field*)(o))->flag=f->flags;*/
/* save type in slot-field for faster processing */
- /* setfield_critical(c,o,"flag", "I", jint, (jint) f->flags); */
+ /* setfield_critical(c,o,"flag", "I", jint, (jint) f->flags); */
+ o->flag = f->flags;
setfield_critical(c,o,"slot", "I", jint, (jint) idx);
setfield_critical(c,o,"name", "Ljava/lang/String;", jstring, (jstring) name);
/*setfield_critical(c,o,"type", "Ljava/lang/Class;", jclass, fieldtype);*/
return NULL;
}
- /* array of exceptions declared to be thrown, information not available !! */
+ /* array of exceptions declared to be thrown, information not available! */
exceptiontypes = builtin_anewarray(0, class_java_lang_Class);
/* initialize instance fields */
- setfield_critical(c,o,"clazz", "Ljava/lang/Class;", jobject, (jobject) clazz /*this*/);
- setfield_critical(c,o,"parameterTypes", "[Ljava/lang/Class;", jobject, (jobject) types);
- setfield_critical(c,o,"exceptionTypes", "[Ljava/lang/Class;", jobject, (jobject) exceptiontypes);
- setfield_critical(c,o,"name", "Ljava/lang/String;", jstring, javastring_new(m->name));
- setfield_critical(c,o,"modifiers", "I", jint, m->flags);
- setfield_critical(c,o,"slot", "I", jint, 0);
- setfield_critical(c,o,"returnType", "Ljava/lang/Class;", jclass, get_returntype(m));
+
+ setfield_critical(c, o, "clazz", "Ljava/lang/Class;", jobject,
+ (jobject) clazz /*this*/);
+
+ setfield_critical(c, o, "parameterTypes", "[Ljava/lang/Class;", jobject,
+ (jobject) types);
+
+ setfield_critical(c, o, "exceptionTypes", "[Ljava/lang/Class;", jobject,
+ (jobject) exceptiontypes);
+
+ setfield_critical(c, o, "name", "Ljava/lang/String;", jstring,
+ (jobject) javastring_new(m->name));
+
+ setfield_critical(c, o, "modifiers", "I", jint,
+ m->flags);
+
+ setfield_critical(c, o, "slot", "I", jint,
+ 0);
+
+ setfield_critical(c, o, "returnType", "Ljava/lang/Class;", jclass,
+ get_returntype(m));
return o;
}
ACC_SYNCHRONIZED | ACC_NATIVE | ACC_STRICT)
);*/
setfield_critical(class_method,o,"declaringClass", "Ljava/lang/Class;", jobject, (jobject) c /*this*/);
- setfield_critical(class_method,o,"name", "Ljava/lang/String;", jstring, javastring_new(m->name));
+ setfield_critical(class_method,o,"name", "Ljava/lang/String;", jstring, (jobject) javastring_new(m->name));
/* setfield_critical(class_method,o,"flag", "I", jint, (m->flags &
(ACC_PUBLIC | ACC_PRIVATE | ACC_PROTECTED | ACC_ABSTRACT | ACC_STATIC | ACC_FINAL |
ACC_SYNCHRONIZED | ACC_NATIVE | ACC_STRICT)));*/
{
/* classinfo *clazz = (classinfo *) that; */
- return (*env)->IsInstanceOf(env, (jobject) obj, that);
+ return (*env)->IsInstanceOf(env, (jobject) obj, (jclass) that);
}
/* initialize class */
if (!ci->initialized)
- class_init(ci);
+ /* No need to check return value, because class_init already sets the */
+ /* exception pointer. */
+ (void) class_init(ci);
}
/*
- * Class: java_lang_VMClass
+ * Class: java/lang/VMClass
* Method: throwException
* Signature: (Ljava/lang/Throwable;)V
*/
-JNIEXPORT void JNICALL Java_java_lang_VMClass_throwException(JNIEnv *env, jclass clazz, java_lang_Throwable *par1)
+JNIEXPORT void JNICALL Java_java_lang_VMClass_throwException(JNIEnv *env, jclass clazz, java_lang_Throwable *t)
{
- log_text("Won't implement VmClass.throwException. (Not needed according to spec) Is only needed to be bug compatible with the SUN VM. (according to gnuclasspath team)");
+ *exceptionptr = (java_objectheader *) t;
}
-
-
-
/*
* These are local overrides for various environment variables in Emacs.
* Please do not remove this and leave it at the end of the file, where