<AWT Dev> [9] Review request: new macro for conversion to jboolean

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Mon Mar 17 15:01:57 UTC 2014

This review request is for the new macro, which simplify conversion to 
jboolean. It will be useful for fixing parfait warnings.

We have a lot of places, where we cast some type to jboolean:

BOOL = retVal;
return (jboolean) retVal;

WARNING: Expecting value of JNI primitive type jboolean: mismatched 
value retVal with size 32 bits, retVal used for conversion to int8 in return

+++ b/src/share/native/common/jni_util.h    Mon Mar 17 18:28:48 2014 +0400
@@ -277,6 +277,7 @@

  #define IS_NULL(obj) ((obj) == NULL)
  #define JNU_IsNull(env,obj) ((obj) == NULL)
+#define IS_TRUE(obj) ((obj) ? JNI_TRUE : JNI_FALSE)

I am not sure about the name, probably someone have a better suggestion?

The fix is for jdk9/dev.

Best regards, Sergey.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20140317/31833aba/attachment.html>

More information about the awt-dev mailing list