RFR: 8304717: Declaration aliasing between boolean and jboolean is wrong [v3]

Julian Waters jwaters at openjdk.org
Fri Mar 31 05:57:04 UTC 2023


On Fri, 24 Mar 2023 03:02:47 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Julian Waters has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Explicit conversion to jboolean
>
> src/java.prefs/macosx/native/libprefs/MacOSXPreferencesFile.m line 685:
> 
>> 683:     CFStringRef topKey;
>> 684:     CFMutableDictionaryRef topValue;
>> 685:     Boolean beforeAdd = false;
> 
> The return value from `CFDictionaryContainsKey` is a Boolean and is assigned to this variable. So I think these changes are the wrong way round. Keep this as a Boolean but convert the return value to jboolean:
> 
> return beforeAdd ? JNI_TRUE : JNI_FALSE;

Argh, looks like Apple and Objective-C still use the ancient Boolean types from Carbon for the CoreFoundation APIs. Sigh...

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13139#discussion_r1154042130


More information about the core-libs-dev mailing list