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

Aleksei Efimov aefimov at openjdk.org
Tue Oct 10 15:08:24 UTC 2023


On Mon, 9 Oct 2023 07:00:08 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

> Hello Aleksei, it's good to see the addition of these new APIs. On the naming front, I like the 

Hello Jaikiran

> The proposed changes also have text which talks about "ambiguous" address literals. The term ambiguous seems new in the InetAddress (and sub-classes). The package-info.java too doesn't have previous references to it.

What ambiguous IPv4 address literals mean in the code and in [the release notes](https://www.oracle.com/java/technologies/javase/18all-relnotes.html#JDK-8277608): it is a set of addresses which can't be parsed in dotted-decimal forms listed in the Inet4Address#format class-level javadoc section, but can be parsed in BSD forms (decimal, octal, or hexadecimal) defined in [`inet_addr` of IEEE Std 1003.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_addr.html).

> Should we add some details on what addresses are considered ambiguous (and how/if such addresses are treated by existing APIs)?

The release note states that the `InetAddress` accepts IPv4 address literals in decimal quad notation. The new `ofLiteral` API also states that only dotted-decimal forms are supported, `ambigous` term is not mentioned in any public javadoc, and given that the related system property is a jdk-specific system property I would like to avoid introducing this term as part of this PR. 

> do you think we should add a more formal reference to the BSD formatting of IP address

I think a more formal reference to BSD forms might be needed if they are recognizable by InetAddress APIs. As of today, this is not the case.

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

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


More information about the net-dev mailing list