Let's say I have the following Java code:
public class Test { public static int foo() { throw new RuntimeException(); } }
which loads its own library in the usual way. The native library registers and caches the JVM or something else, and then, later, this function is executed:
JNIEnv* sEnv; // initialised somewhere properly void throwMeARiver() { jclass c = sEnv->FindClass("Test"); jmethodID m = sEnv->GetStaticMethodID(c, "foo", "()I"); jint i = sEnv->CallStaticIntMethod(c, m); printf("Got %d\n", (int)i); }
Obviously, sEnv-> CheckException () will now return JNI_TRUE, but what comes of the native function? In Java, throwing an exception, the JVM stops the method until it finds the appropriate handler, so the return value of foo () will be undefined. Am I also undefined?
I can not find any specifications or anything that says otherwise, so presumably i / is / undefined. In this case, there is no โnormalโ CallStaticIntMethod range, unlike most JNI functions.
I'm trying to do this now, but I basically ask for it to see if there is any specific behavior somewhere.
source share