diff --git a/src/share/native/common/jni_util.h b/src/share/native/common/jni_util.h index b8d23cd1c21341a2175694c4f59925c8c9d7d1ee..0242d71f497fd3b29369ff9338c6a0a813373cf1 100644 --- a/src/share/native/common/jni_util.h +++ b/src/share/native/common/jni_util.h @@ -297,6 +297,21 @@ JNU_NotifyAll(JNIEnv *env, jobject object); } \ } while (0) \ +#ifdef __cplusplus +#define JNU_CHECK_EXCEPTION(env) \ + do { \ + if ((env)->ExceptionCheck()) { \ + return; \ + } \ + } while (0) \ + +#define JNU_CHECK_EXCEPTION_RETURN(env, y) \ + do { \ + if ((env)->ExceptionCheck()) { \ + return (y); \ + } \ + } while (0) +#else #define JNU_CHECK_EXCEPTION(env) \ do { \ if ((*env)->ExceptionCheck(env)) { \ @@ -310,7 +325,7 @@ JNU_NotifyAll(JNIEnv *env, jobject object); return (y); \ } \ } while (0) - +#endif /* __cplusplus */ /************************************************************************ * Debugging utilities */