RFR: 8272215: Add InetAddress methods for parsing IP address literals [v2]

Alan Bateman alanb at openjdk.org
Mon Oct 9 06:33:09 UTC 2023


On Sat, 7 Oct 2023 13:27:45 GMT, Mark Sheppard <msheppar at openjdk.org> wrote:

> The sentence should have read "The functionality can be fully provided by adding an overloaded (static) getByAddress in the base InetAddress class, only."
> 
> I wasn't suggesting that the current API was providing the requested functionality. you may have misinterpreted what I'm saying. The requested functionality can be provided by an overloaded getByAddress method to the InetAddress , and that is sufficient. As such, there is no need for additional method in the Inet4Address or Inet6Address

The existing naming in InetAddress comes with baggage. The getByXXX method suggests lookup, they throw UHE. The getByAddress methods take a byte[], the input is bytes. The String parameter for the 2-arg getByAddress is intended to be a host name. I don't think the new static factory methods should be burdened with all this baggage so move to a methods that are clear/obvious/readable seems a much better route. We can bikeshed over specific name but the ofXXX convention is something that many areas of the platform has adopted in recent years.

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

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


More information about the net-dev mailing list