8248703: Clarify the behavior of java.net.NetworkInterface::equals

The API documentation of NetworkInterface::equals is clarified to warn about the possibility that two NetworkInterface representing the same underlying interface objects might not compare equal if the IP addresses bound to the interfaces are being dynamically updated by the system.

Reviewed-by: alanb, chegar
This commit is contained in:
Daniel Fuchs 2020-07-03 16:50:16 +01:00
parent 734a6c94d3
commit 82cc03fa89

View file

@ -576,7 +576,13 @@ public final class NetworkInterface {
* as this object.
* <p>
* Two instances of {@code NetworkInterface} represent the same
* NetworkInterface if both name and addrs are the same for both.
* NetworkInterface if both the name and the set of {@code InetAddress}es
* bound to the interfaces are equal.
*
* @apiNote two {@code NetworkInterface} objects referring to the same
* underlying interface may not compare equal if the addresses
* of the underlying interface are being dynamically updated by
* the system.
*
* @param obj the object to compare against.
* @return {@code true} if the objects are the same;