RFR: 8244202: Implementation of JEP 418: Internet-Address Resolution SPI [v3]

Aleksei Efimov aefimov at openjdk.java.net
Tue Oct 19 13:34:50 UTC 2021


On Fri, 15 Oct 2021 17:19:26 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> Aleksei Efimov has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Add @since tags to new API classes
>>  - Add checks and test for empty stream resolver results
>
> test/lib/jdk/test/lib/net/IPSupport.java line 88:
> 
>> 86:             } catch (SocketException se2) {
>> 87:                 return false;
>> 88:             }
> 
> The implementation of this method now conflicts with its name. Maybe we should pass a `Class<? extends InetAddress>`  as parameter, and construct the loopback address from there. IIRC the issue with the original implementation was that it would say that IPv6 was not supported if IPv6 had only been disabled on the loopback interface - and that caused trouble because the native implementation of the built-in resolver had a different view of the situation - and saw that an IPv6 stack was available on the machine. Maybe this would deserve a comment too - so that future maintainers can figure out what we are trying to do here.

Thanks for a good suggestion: renamed to `isSupported`, changed parameter type to `Class<? extends InetAddress> addressType` and updated it to use `SocketChannel.open(ProtocolFamily pf)` [API](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/nio/channels/SocketChannel.html#open(java.net.ProtocolFamily)) added in `15` to check if the plafrom supports addresses of specified address type. Pushed as 95a21e57fbe8be147d23e6a6901ae307e8237cbb.
All new tests (especially `LookupPolicyMappingTest`) pass in environment with `IPv6` addresses disabled.

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

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


More information about the core-libs-dev mailing list