RFR: 8272215: Add InetAddress methods for parsing IP address literals
Mark Sheppard
msheppar at openjdk.org
Mon Oct 16 16:18:21 UTC 2023
On Sat, 7 Oct 2023 12:01:25 GMT, Alan Bateman <alanb 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 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 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.
For me, it is not consistent with the well esatblished InetAddress API (getByName, getByAddress), in which case the ofLiteral style looks like a bit of a wart. Adding an overloaded getByAddress method is a logical OO design approach. You seem to be intent on adding this "ofXXX" style methods. So we'll just have to agree to disagree on this.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/15775#issuecomment-1751713257
More information about the net-dev
mailing list