[Kaffe] new patch for Class.c
Moses DeJong
dejong at cs.umn.edu
Fri Jan 15 17:37:18 PST 1999
Looks like my patch for libraries/clib/native/Class.c was not correct.
The sig check did not work for methods that return anything other than
void. Here is a patch for the code in the CVS that fixes the problem.
*** Class.c Fri Jan 15 19:35:06 1999
--- copy_Class.c Fri Jan 15 19:29:02 1999
***************
*** 705,711 ****
* parameter to all get(Declared){Method|Constructor} functions
* is treated like passing an empty array "new Class [] {}"
*/
! if ((argtypes == NULL) && !strcmp(sig,"()V")) {
return (1);
}
--- 705,712 ----
* parameter to all get(Declared){Method|Constructor} functions
* is treated like passing an empty array "new Class [] {}"
*/
! if ((argtypes == NULL) &&
! (sig[0] == '(') && (sig[1] == ')')) {
return (1);
}
Here is a test case that shows the problem with the latest code
in the CVS. It will work correctly after this patch has been applied.
import java.lang.reflect.*;
import java.util.*;
public class MethodBug {
public static void main(String[] argv) throws Exception {
Method m1 = MethodBug.class.getMethod("m1", null);
System.out.println("m1 is " + m1);
Method m2 = MethodBug.class.getMethod("m2", null);
System.out.println("m2 is " + m2);
}
public void m1() {}
public String m2() {return null;}
}
thanks
mo dejong
dejong at cs.umn.edu
More information about the kaffe
mailing list