RFR: 8272215: Add InetAddress methods for parsing IP address literals

Alan Bateman alanb at openjdk.org
Mon Oct 16 16:18:21 UTC 2023


On Sat, 7 Oct 2023 11:32:43 GMT, Mark Sheppard <msheppar at openjdk.org> wrote:

> The functionality can be fully provided by the overloaded (static) getByAddress in the base InetAddress class

I don't think I agree with this. The existing 2-arg getByAddress method takes a string that is a host name or string representation of an IP address. It can be argued that it was a mistake to allow it accept IP literal addresses but it can't be changed. Same thing with the UHE thrown by both getByAddress methods but that can't be changed either.

The new factory methods have a very clear purpose to create an InetAddress from the string representation of an IP literal address. The proposed name ofLiteral is readable/clear and consistent with the naming of other static factory methods added to the APIs in recent years.

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

PR Comment: https://git.openjdk.org/jdk/pull/15775#issuecomment-1751693706


More information about the net-dev mailing list