jboolean handling in native JDK code - was : RE: 8211163: UNIX version of Java_java_io_Console_echo does not return a clean boolean
Andrew Haley
aph at redhat.com
Fri Sep 28 14:04:24 UTC 2018
On 09/28/2018 01:32 PM, Baesken, Matthias wrote:
> Shouldn't we better compare the pointer to NULL instead of just casting ?
Heavens, yes! You have found a nasty bug.
Note that the cast to intptr_t used here suppresses the compiler
warning which should have been a big clue that something was
wrong. Good catch.
8198895: Compilation errors in java.desktop with VS 2017
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Window.cpp Mon Mar 19 14:16:23 2018 -0700
@@ -3915,8 +3915,8 @@
rfs->component = selfGlobalRef;
rfs->isMouseEventCause = isMouseEventCause;
- return (jboolean)AwtToolkit::GetInstance().SyncCall(
- (void*(*)(void*))AwtWindow::_RequestWindowFocus, rfs);
+ return (jboolean)((intptr_t)AwtToolkit::GetInstance().SyncCall(
+ (void*(*)(void*))AwtWindow::_RequestWindowFocus, rfs));
// global refs and rfs are deleted in _RequestWindowFocus
CATCH_BAD_ALLOC_RET(JNI_FALSE);
--
Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
More information about the jdk-dev
mailing list