On Tue, 16 Dec 2025 14:18:00 GMT, Jaikiran Pai <[email protected]> wrote:

> It's a bit odd that this 
> `sun.net.util.IPAddressUtil.isIPv6LiteralAddress("[::1]")` returns false 
> where as `InetAddress.ofLiteral("[::1]")` returns a valid `InetAddress`. But 
> `IPAddressUtil` is an internal implementation util, so that's what the 
> expectation maybe of that implementation. The change to this test looks OK to 
> me.

FWIW `InetAddress.ofLiteral` accepts the enclosing "[]" because that's what 
`InetAddress.getByName` does.
And as you noted `sun.net.util.IPAddressUtil.isIPv6LiteralAddress` is an 
internal API - it parses the literal according to the IPv6 literal syntax 
(which doesn't include the "[]")

    jshell> InetAddress.getByName("[::1]")
    $1 ==> /0:0:0:0:0:0:0:1

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

PR Comment: https://git.openjdk.org/jdk/pull/28825#issuecomment-3661050387

Reply via email to