Bug in Method.invoke() / Patch
Godmar Back
kaffe@rufus.w3.org
Tue, 31 Jul 2001 23:17:38 -0600 (MDT)
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