Satish K
Committed by Gerrit Code Review

Symmertry issue on overridden equals method - fix

Change-Id: If19d09a31e02b6c1957fd07e052e7f295e4f0c7b
......@@ -87,7 +87,9 @@ public class OchPort extends DefaultPort {
if (this == obj) {
return true;
}
if (obj instanceof OchPort) {
// Subclass is considered as a change of identity, hence equals() will return false if class type don't match
if (obj != null && getClass() == obj.getClass()) {
final OchPort other = (OchPort) obj;
return Objects.equals(this.element().id(), other.element().id()) &&
Objects.equals(this.number(), other.number()) &&
......
......@@ -71,7 +71,7 @@ public class OduCltPort extends DefaultPort {
if (this == obj) {
return true;
}
if (obj instanceof OduCltPort) {
if (obj != null && getClass() == obj.getClass()) {
final OduCltPort other = (OduCltPort) obj;
return Objects.equals(this.element().id(), other.element().id()) &&
Objects.equals(this.number(), other.number()) &&
......
......@@ -102,7 +102,7 @@ public class OmsPort extends DefaultPort {
if (this == obj) {
return true;
}
if (obj instanceof OmsPort) {
if (obj != null && getClass() == obj.getClass()) {
final OmsPort other = (OmsPort) obj;
return Objects.equals(this.element().id(), other.element().id()) &&
Objects.equals(this.number(), other.number()) &&
......