JniEnv
attached to the calling threadA null pointer is returned if the calling thread is not attached to the JVM.
# `JniEnv` attached to the calling thread
#
# A null pointer is returned if the calling thread is not attached to the JVM.
fun env: JniEnv import jni_error `{
JNIEnv *env;
int res = (*self)->GetEnv(self, (void **)&env, JNI_VERSION_1_6);
if (res == JNI_EDETACHED) {
JavaVM_jni_error(NULL, "Requesting JNIEnv from an unattached thread", res);
return NULL;
}
else if (res != JNI_OK) {
JavaVM_jni_error(NULL, "Could not get JNIEnv from Java VM", res);
return NULL;
}
return env;
`}
lib/jvm/jvm.nit:171,2--186,3