java.net.InetAddress uses a system-wide resolver to determine the host name from a IP address. The resolver is an (user configurable) implementation of java.net.spi.InetAddressResolver.
The API javadoc of InetAddress.getHostName() uses the term "host name" when/if resolving the host name from the address. On the other hand the API javadoc of InetAddress.getCanonicalHostName() uses the term "fully qualified domain name" when resolving the name from the address. The implementation of both these methods ultimately end up calling the same InetAddressResolver.lookupByAddress() API which in its javadoc uses the term "host name".
It would be good to review the InetAddressResolver.lookupByAddress and set up any expectations on whether implementations of that interface are expected to return fully qualified domain name.
This came up during the review of https://github.com/openjdk/jdk/pull/15134
The API javadoc of InetAddress.getHostName() uses the term "host name" when/if resolving the host name from the address. On the other hand the API javadoc of InetAddress.getCanonicalHostName() uses the term "fully qualified domain name" when resolving the name from the address. The implementation of both these methods ultimately end up calling the same InetAddressResolver.lookupByAddress() API which in its javadoc uses the term "host name".
It would be good to review the InetAddressResolver.lookupByAddress and set up any expectations on whether implementations of that interface are expected to return fully qualified domain name.
This came up during the review of https://github.com/openjdk/jdk/pull/15134