RFR: 8356395: Spec needs to be clarified for InterfaceAddress.getBroadcast() method

Daniel Fuchs dfuchs at openjdk.org
Wed May 7 14:46:33 UTC 2025


On Wed, 7 May 2025 14:02:52 GMT, kieran-farrell <duke at openjdk.org> wrote:

> Spec currently suggests that only IPv6 addresses can return null for InterfaceAddress.getBroadcast(). Clarifying spec to state that certain IPv4 address such as the loopback address do not support broadcasting and can therefore also return null.

src/java.base/share/classes/java/net/InterfaceAddress.java line 67:

> 65:      * <p>
> 66:      * Certain IPv4 addresses, such as the loopback address, do not support
> 67:      * broadcasting and will also result in {@code null} being returned.

Suggestion:

     * Certain network interfaces, such as the loopback interface, do not support
     * broadcasting and will also return {@code null}.


Maybe the class level API documentation should also be updated something like:


 * This class represents a Network Interface address. In short it's an
 * IP address, a subnet mask as well as a broadcast address when the address is
 * IPv4 and the interface supports broadcasting.
 * An IP address and a network prefix length in the case
 * of IPv6 address.


It would be good to have @Michael-Mc-Mahon approve the wording.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25095#discussion_r2077800913


More information about the net-dev mailing list