Re: [Sablevm-developer] reflection methods
Brought to you by:
egagnon
From: David P. B. <db...@CS...> - 2003-01-27 22:53:24
|
Hello, I got several methods somewhat working and I also came up with questions/issues.=20 Here are the first few: 1) All the native Class methods: Class.m(JNIEnv *_env, jobject this) already implemented does a segmentation fault at: _svmt_type_info *type =3D _svmf_unwrap_class_instance (env, this) if the Class object represents a primitive (ex: int.class). Example: int.class.getSuperclass() (but it applies to several) crashes instead of returning null. (Note: getSuperclass() has other bugs, but I fixed them.). I am fixing this by simply checking if it represents a primitive type in Class.java and calling the native function only if does not. This avoid "switching" to native mode for primitive types. I am not sure if _svmf_unwrap_class_instance was designed with that assumption in mind or if this is a bug. 2) I changed one of the native declaration: from: JNIEXPORT jint JNICALL Java_java_lang_reflect_Method_getModifiers(JNIEnv *, jobject); to: JNIEXPORT jint JNICALL Java_java_lang_reflect_Method_nativeGetModifiers(JNIEnv *, jclass, jbyteArray); This makes it look similar in prototype to the others and simplifies the implementation. This may be a Classpath bug. David On Sun, Jan 26, 2003 at 10:55:28AM -0500, David Paul BELANGER wrote: >=20 > Hello, >=20 > I volunteered to help implement the native methods in the reflection > classes (java.lang.Class and classes in java.lang.reflect). > These include methods such as Class.getMethods() that have > been asked a few times on this list. >=20 > My short term goal is to implement enough methods to run Ant and JUnit > as soon as possible. >=20 > I have a partially working getMethods(). I will made my code public as > soon as a have a reasonable set of working functions. >=20 >=20 > David >=20 >=20 > --- >=20 > David B=E9langer > Graduate Student > School of Computer Science > McGill University > Office: MC226 >=20 > Web page: http://www.cs.mcgill.ca/~dbelan2/ > Public key: http://www.cs.mcgill.ca/~dbelan2/public_key.txt >=20 >=20 >=20 > ------------------------------------------------------- > This SF.NET email is sponsored by: > SourceForge Enterprise Edition + IBM + LinuxWorld http://www.vasoftware= .com > _______________________________________________ > Sablevm-developer mailing list > Sab...@li... --=20 --- David B=E9langer Graduate Student School of Computer Science McGill University Office: MC226 Web page: http://www.cs.mcgill.ca/~dbelan2/ Public key: http://www.cs.mcgill.ca/~dbelan2/public_key.txt |