RFR: 8329596: Add test for virtual threads invoking synchronized native methods

David Holmes dholmes at openjdk.org
Fri Apr 5 05:43:08 UTC 2024


On Fri, 5 Apr 2024 05:17:44 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> test/jdk/java/lang/Thread/virtual/libSynchronizedNative.c line 29:
>> 
>>> 27: Java_SynchronizedNative_runWithSynchronizedNative(JNIEnv *env, jobject obj, jobject task) {
>>> 28:     jclass clazz = (*env)->GetObjectClass(env, obj);
>>> 29:     jmethodID mid = (*env)->GetMethodID(env, clazz, "run", "(Ljava/lang/Runnable;)V");
>> 
>> Does this generate a warning with `-Xcheck:jni` due to exceptions not being checked for?
>
>> Does this generate a warning with `-Xcheck:jni` due to exceptions not being checked for?
> 
> I run with`TEST_OPTS_JAVA_OPTIONS=-Xcheck:jni` and don't see any warnings. Are you asking about the usage of GetObjectClass (which is not documented to throw) or GetMethodID (the check for the jmethodID of NULL is at L30). Or maybe you are saying that GetMethodID can return a jmethodID with a pending exception?

Sorry I was thinking `GetObjectClass` could throw, but it can't.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/18600#discussion_r1552955426


More information about the core-libs-dev mailing list