[kaffe] libraries/clib/native/Field.c

Jukka Santala jsantala at tml.hut.fi
Wed May 8 02:32:49 PDT 2002


On Tue, 7 May 2002, Godmar Back wrote:
> Methods that start with Java_ are called using the JNI calling convention.
> See jni.c::Kaffe_JNI_native 

Oops, I wasn't paying attention to the function names. In that case, the
question becomes whether those functions should use the JNI or straight
calling convention; PocketLinux uses JNI for them, which does make some
things easier... But I went with the flow and simply turned them into
straight calls as was originally intended. Also modified the exception to
match the form of Sun JDK, so that the earlier posted test-case passes.
Overall it doesn't appear JNI convention is used in many classes; are
there some specific constraints on choosing one over the other?

 -Jukka Santala
-------------- next part --------------
Index: libraries/clib/native/Class.c
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/native/Class.c,v
retrieving revision 1.60
diff -u -r1.60 Class.c
--- libraries/clib/native/Class.c	12 Apr 2002 21:13:59 -0000	1.60
+++ libraries/clib/native/Class.c	8 May 2002 09:20:42 -0000
@@ -927,7 +927,12 @@
 	if (f != 0) {
 		return (f);
 	}
-	SignalError("java.lang.NoSuchFieldException", ""); /* FIXME */
+	/* like SignalError, except that the name of the field that is
+	 * not found becomes the error message
+	 */
+	throwException((struct Hjava_lang_Throwable*)execute_java_constructor(
+		"java.lang.NoSuchFieldException", 0, 0,
+		"(Ljava/lang/String;)V", name));
 }
 
 HArrayOfObject*
Index: libraries/clib/native/Field.c
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/native/Field.c,v
retrieving revision 1.14
diff -u -r1.14 Field.c
--- libraries/clib/native/Field.c	6 May 2002 02:27:33 -0000	1.14
+++ libraries/clib/native/Field.c	8 May 2002 09:20:42 -0000
@@ -81,111 +81,111 @@
 }
 
 struct Hjava_lang_Object*
-Java_java_lang_reflect_Field_getObject0(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj)
+java_lang_reflect_Field_getObject0(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj)
 {
 	return ((struct Hjava_lang_Object*)getFieldAddress(this, obj));
 }
 
 jboolean
-Java_java_lang_reflect_Field_getBoolean0(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj)
+java_lang_reflect_Field_getBoolean0(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj)
 {
 	return (*(jboolean*)getFieldAddress(this, obj));
 }
 
 jbyte
-Java_java_lang_reflect_Field_getByte0(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj)
+java_lang_reflect_Field_getByte0(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj)
 {
 	return (*(jbyte*)getFieldAddress(this, obj));
 }
 
 jchar
-Java_java_lang_reflect_Field_getChar0(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj)
+java_lang_reflect_Field_getChar0(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj)
 {
 	return (*(jchar*)getFieldAddress(this, obj));
 }
 
 
 jshort
-Java_java_lang_reflect_Field_getShort0(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj)
+java_lang_reflect_Field_getShort0(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj)
 {
 	return (*(jshort*)getFieldAddress(this, obj));
 }
 
 jint
-Java_java_lang_reflect_Field_getInt0(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj)
+java_lang_reflect_Field_getInt0(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj)
 {
 	return (*(jint*)getFieldAddress(this, obj));
 }
 
 jlong
-Java_java_lang_reflect_Field_getLong0(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj)
+java_lang_reflect_Field_getLong0(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj)
 {
 	return (*(jlong*)getFieldAddress(this, obj));
 }
 
 jfloat
-Java_java_lang_reflect_Field_getFloat0(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj)
+java_lang_reflect_Field_getFloat0(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj)
 {
 	return (*(jfloat*)getFieldAddress(this, obj));
 }
 
 jdouble
-Java_java_lang_reflect_Field_getDouble0(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj)
+java_lang_reflect_Field_getDouble0(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj)
 {
 	return (*(jdouble*)getFieldAddress(this, obj));
 }
 
 
 void
-Java_java_lang_reflect_Field_setBoolean(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj, jboolean val)
+java_lang_reflect_Field_setBoolean(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj, jboolean val)
 {
 	*(jboolean*)getFieldAddress(this, obj) = val;
 }
 
 void
-Java_java_lang_reflect_Field_setByte(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj, jbyte val)
+java_lang_reflect_Field_setByte(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj, jbyte val)
 {
 	*(jbyte*)getFieldAddress(this, obj) = val;
 }
 
 void
-Java_java_lang_reflect_Field_setChar(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj, jchar val)
+java_lang_reflect_Field_setChar(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj, jchar val)
 {
 	*(jchar*)getFieldAddress(this, obj) = val;
 }
 
 void
-Java_java_lang_reflect_Field_setShort(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj, jshort val)
+java_lang_reflect_Field_setShort(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj, jshort val)
 {
 	*(jshort*)getFieldAddress(this, obj) = val;
 }
 
 void
-Java_java_lang_reflect_Field_setInt(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj, jint val)
+java_lang_reflect_Field_setInt(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj, jint val)
 {
 	*(jint*)getFieldAddress(this, obj) = val;
 }
 
 void
-Java_java_lang_reflect_Field_setLong(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj, jlong val)
+java_lang_reflect_Field_setLong(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj, jlong val)
 {
 	*(jlong*)getFieldAddress(this, obj) = val;
 }
 
 void
-Java_java_lang_reflect_Field_setFloat(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj, jfloat val)
+java_lang_reflect_Field_setFloat(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj, jfloat val)
 {
 	*(jfloat*)getFieldAddress(this, obj) = val;
 }
 
 void
-Java_java_lang_reflect_Field_setDouble(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj, jdouble val)
+java_lang_reflect_Field_setDouble(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj, jdouble val)
 {
 	*(jdouble*)getFieldAddress(this, obj) = val;
 }
 
 void
-Java_java_lang_reflect_Field_set(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj, struct Hjava_lang_Object* val)
+java_lang_reflect_Field_set(struct Hjava_lang_reflect_Field * this, struct Hjava_lang_Object* obj, struct Hjava_lang_Object* val)
 {
 	*(jobject*)getFieldAddress(this, obj) = val;
 }


More information about the kaffe mailing list