RFR: 8315767: InetAddress: constructing objects from BSD literal addresses [v5]

Jaikiran Pai jpai at openjdk.org
Wed Apr 17 14:30:02 UTC 2024


On Wed, 17 Apr 2024 14:16:30 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

> > Should we be setting any expectations by specifying what InetAddress.getHostAddress() will return for an Inet4Address constructed using this new Inet4Address.ofPosixLiteral() method? In its current form I believe it will continue to return a decimal representation of the IP address. My guess is that we want it to continue behaving that way?
> 
> In the InetAddress class level API documentation we have:
> 
> ```
>  * <p> For methods that return a textual representation as output
>  * value, the first form, i.e. a dotted-quad string, is used.
> ```
> 
> Do you think it should be reiterated in the `@apiNote` of the `ofPosixLiteral` method?

The changes proposed in this PR introduce a new paragraph in the class level documentation just before the line which states the dotted-quad string. So I think it may not be clear enough whether dotted-quad string implies decimal values (`127.0.0.1`) or octal dotted-quad string (`0177.0.0.1`) or hexadecimal dotted-quad string (`0x7F.0.0.1`). So I think updating that sentence in class level documentation might help.

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

PR Comment: https://git.openjdk.org/jdk/pull/18493#issuecomment-2061393325


More information about the net-dev mailing list