> > Arthur, > > On 1 May 2019, at 23:53, Arthur Eubanks <aeuba...@google.com> wrote: > > Webrev: http://cr.openjdk.java.net/~aeubanks/8223214/webrev.00/ > Bug: https://bugs.openjdk.java.net/browse/JDK-8223214 > > > I think the changes are good. > > Minor comment: after this changes, the Inet6AddressImpl class-level > comment is a little misleading. Maybe it would benefit from a small > update. > > * If InetAddress.preferIPv6Address is true then anyLocalAddress(), > * loopbackAddress(), and localHost() will return IPv6 addresses, > * otherwise IPv4 addresses. > Updated the comment.
> > In your patch queue have you got any similar-ish changes relating to > `anyLocalAddress`? The reason I ask ( and it may not be an immediate > issue ) is that it is somewhat related, but kinda masked by code in the > native NET_InetAddressToSockaddr function, that maps the IPv4 wildcard > address to the IPv6 equivalent. > I don't see any other changes that are related to Inet6AddressImpl. > > This change reminds me that; InetAddress getLoopbackAddress and > anyLocalAddress remove the need by the developer to think about the > particular IP version in use, as the methods should return an > appropriate address for the platform and environment in use. But > sometimes you just want the IPv4 loopback or the IPv6 loopback, etc. > Should we add public API points for just this? > > Inet4Address::getIPv4LoopbackAddress > Inet6Address::getIPv6LoopbackAddress > Inet4Address::wildcardAddress > Inet6Address::wildcardAddress > I think that makes sense. We could also refactor some of these patches to use those rather than specifying "::1" or {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}. New webrev: http://cr.openjdk.java.net/~aeubanks/8223214/webrev.01/