On Wed, 16 Mar 2022 14:34:49 GMT, Daniel Fuchs <dfu...@openjdk.org> wrote:
>> I agree that it could be simplified to match >> `Java_java_net_InetAddress_isIPv4Available`. Changed in >> 49fdd576cade2e97639f827f9db6d0f1e31101e2 > > 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 ------------- PR: https://git.openjdk.java.net/jdk/pull/7842