RFR: 8282917: Remove InetAddressImplFactory from InetAddress [v2]

Aleksei Efimov aefimov at openjdk.java.net
Wed Mar 16 14:29:28 UTC 2022


On Wed, 16 Mar 2022 13:49:39 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> Aleksei Efimov has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Address review comments
>
> src/java.base/share/native/libnet/InetAddress.c line 88:
> 
>> 86:  * Class:     java_net_InetAddress
>> 87:  * Method:    isIPv6Supported
>> 88:  * Signature: ()I
> 
> Hello Aleksei, should this be `()Z` to represent the binary name of the boolean type https://docs.oracle.com/javase/specs/jvms/se17/html/jvms-4.html#jvms-4.3.2-200

Hi Jaikiran,
Yes, you're right - it should be `()Z`. The impl copied from `src/java.base/unix/native/libnet/InetAddressImplFactory.c` had incorrect header. Fixed in 49fdd576cade2e97639f827f9db6d0f1e31101e2

> src/java.base/share/native/libnet/InetAddress.c line 96:
> 
>> 94:     } else {
>> 95:         return JNI_FALSE;
>> 96:     }
> 
> I don't have knowledge of C or JNI, but the `Java_java_net_InetAddress_isIPv4Available` currently does:
> 
> 
> return ipv4_available();
> 
> So maybe a similar construct can be used here instead of if/else blocks? I'm guessing `ipv6_available()` will be returning values that are compatible with `JNI_TRUE/JNI_FALSE`.

I agree that it could be simplified to match `Java_java_net_InetAddress_isIPv4Available`. Changed in 49fdd576cade2e97639f827f9db6d0f1e31101e2

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

PR: https://git.openjdk.java.net/jdk/pull/7842


More information about the net-dev mailing list