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

David Holmes dholmes at openjdk.org
Fri Mar 24 03:07:37 UTC 2023


On Thu, 23 Mar 2023 22:23:00 GMT, Julian Waters <jwaters at openjdk.org> wrote:

>> A couple of spots wrongly refer to boolean and jboolean as the same thing. While this does still compile thanks to a happy accident and implicit conversions, they are not the same at all, and should be fixed before a future compiler error happens if their declarations are touched
>
> Julian Waters has updated the pull request incrementally with one additional commit since the last revision:
> 
>   MacOSXPreferencesFile.m

One change has an issue but the others seem fine. You really need reviewers from each component area though.

Thanks.

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;

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

Changes requested by dholmes (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/13139#pullrequestreview-1355937817
PR Review Comment: https://git.openjdk.org/jdk/pull/13139#discussion_r1147071367


More information about the core-libs-dev mailing list