Bug in Method.invoke() / Patch

Godmar Back gback at cs.utah.edu
Tue Jul 31 22:17:38 PDT 2001



 I think that's better.  

Btw, in code like this:

> 
> To do that I used the following code snippet (patch attached):
> 
> 	        if( CLASS_IS_INTERFACE( clazz ) ) {
> 		  Hjava_lang_Class* objClazz = (*env)->GetObjectClass(env, obj);
> 		  errorInfo info;
> 		  Method* realmeth;
> 		  if( ! instanceof( clazz, objClazz ) ) {
> 		    SignalError("java.lang.IllegalArgumentException", "object is not an instance of declaring class");

you can use postExceptionMessage() instead of SignalError like this:

		    postExceptionMessage(
			&info, 
			JAVA_LANG(IllegalArgumentException),
			/* or something like that */
			"class `%s' does not implement interface `%s'",
			CLASS_CNAME(objClazz), CLASS_CNAME(clazz)
		    );
		    throwError(&info);

instead.		

	- Godmar



More information about the kaffe mailing list