Fix for the env->klass field value in _Jv_JNIMethod::call

Mark Wielaard mark@klomp.org
Sun Jul 30 12:24:00 GMT 2006


Hi Ivan,

On Sun, 2006-07-30 at 10:23 +0700, Ivan Dubrov wrote: 
> While debugging the issue with the Subclipse not working under the GCJ
> (look at the message
> http://svn.haxx.se/subusers/archive-2006-07/0210.shtml for example) I
> found the following problem. When native method is called, the
> env->klass value is always NULL. It looks like that JNIEnv is reused in
> the "_Jv_GetJNIEnvNewFrame" function and the env->klass value is not
> updated during the call.

Nice catch!

> Perhaps, it is OK in most cases, except the cases with complex
> classloaders logic.

It is probably never correct. We were most likely just lucky that no JNI
library ever tried to load classes not found through the system class
loader. So we probably should just update env->klass inside
_Jv_GetJNIEnvNewFrame itself, just like we reset the pending exception.
_Jv_GetJNIEnvNewFrame already gets the defining class as argument.

Thanks,

Mark



More information about the Java-patches mailing list