On Wed, 16 Mar 2022 17:47:15 GMT, Aleksei Efimov <aefi...@openjdk.org> wrote:
>> Thanks for noticing that Jaikiran! >> >> Both `ipv4_available()` and `ipv6_available()` are defined to return `jint` >> so the implementation in `Java_java_net_InetAddress_isIPv6Supported` is >> arguably the more correct (provided that the method being called returns 0 >> when the corresponding IP version is not available). >> >> The signature in the comment should be changed as you suggest though. >> >> Possibly we should consider having both methods use the same construct... > > Current version should be ok since variables returned by `ipv4_available()` > and `ipv6_available()` can only be initialized to `JNI_FALSE` or `JNI_TRUE`: > - `Java_java_net_InetAddress_isIPv4Available`[InetAddress.c] returns result > of `ipv4_available`[net_util.c] > - `ipv4_available`[net_util.c] returns `IPv4_available` variable value > - `IPv4_available` value is initalized with a result returned by > `IPv4_supported()`[net_util_md.c] > - `IPv4_supported()`[net_util_md.c] can return `JNI_TRUE` or `JNI_FALSE` only > (in both Unix and Windows implementations) > - Same stands true for `ipv6_available()`: only `JNI_TRUE` or `JNI_FALSE` > can be returned Thank you Aleksei for those details and the changes. ------------- PR: https://git.openjdk.java.net/jdk/pull/7842