RFR: 8131136: java/awt/font/JNICheck/JNICheck.sh issue warning on core-libs code

Daniel Jeliński djelinski at openjdk.org
Thu Jun 12 12:46:29 UTC 2025


On Wed, 11 Jun 2025 19:00:45 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

>> src/java.base/share/native/libnet/net_util.c line 77:
>> 
>>> 75:     CHECK_NULL_RETURN(s, JNI_VERSION_1_2);
>>> 76:     preferIPv4Stack = (*env)->CallStaticBooleanMethod(env, iCls, mid, s);
>>> 77:     JNU_CHECK_EXCEPTION_RETURN(env, JNI_VERSION_1_2);
>> 
>> The exception check is technically not necessary because no other JNI methods are called before the function exits, but it wasn't always the case.
>
> If this check is not needed, then why are we adding it?

just so we don't forget to add it when we modify the enclosing function. The call to `CallStaticBooleanMethod` is located pretty far from the end of the function, and can be easy to miss.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25754#discussion_r2142645794


More information about the client-libs-dev mailing list