Pavlin Radoslavov

Changed the semantics of IpAddress.equals() to (eventually) return true

if both objects are instanceof IpAddress.
I.e., comparing IpAddress and Ip4Address objects could return true
if the underlying value is same.

Applied the same change to IpPrefix.equals() as well.

Change-Id: Ie0644565501d3ecce2a8603117b994d033d5b82f
...@@ -312,7 +312,7 @@ public class IpAddress implements Comparable<IpAddress> { ...@@ -312,7 +312,7 @@ public class IpAddress implements Comparable<IpAddress> {
312 if (this == obj) { 312 if (this == obj) {
313 return true; 313 return true;
314 } 314 }
315 - if ((obj == null) || (getClass() != obj.getClass())) { 315 + if ((obj == null) || (!(obj instanceof IpAddress))) {
316 return false; 316 return false;
317 } 317 }
318 IpAddress other = (IpAddress) obj; 318 IpAddress other = (IpAddress) obj;
......
...@@ -221,7 +221,7 @@ public class IpPrefix { ...@@ -221,7 +221,7 @@ public class IpPrefix {
221 if (this == obj) { 221 if (this == obj) {
222 return true; 222 return true;
223 } 223 }
224 - if ((obj == null) || (getClass() != obj.getClass())) { 224 + if ((obj == null) || (!(obj instanceof IpPrefix))) {
225 return false; 225 return false;
226 } 226 }
227 IpPrefix other = (IpPrefix) obj; 227 IpPrefix other = (IpPrefix) obj;
......