Skip to content

Commit

Permalink
Revert equality change of BXmlType
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadow-Devil committed Oct 14, 2024
1 parent d147f76 commit a266621
Showing 1 changed file with 4 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import io.ballerina.runtime.internal.values.XmlSequence;
import io.ballerina.runtime.internal.values.XmlValue;

import java.util.Objects;
import java.util.Optional;

/**
Expand Down Expand Up @@ -99,24 +98,16 @@ public boolean isAnydata() {
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof BXmlType bXmlType)) {
public boolean equals(Object obj) {
if (!(this == obj && obj instanceof BXmlType other)) {
return false;
}

if (constraint == bXmlType.constraint) {
if (constraint == other.constraint) {
return true;
}

return readonly == bXmlType.readonly && Objects.equals(constraint, bXmlType.constraint);
}

@Override
public int hashCode() {
return Objects.hash(super.hashCode(), constraint, readonly);
return this.readonly == other.readonly && constraint.equals(other.constraint);
}

@Override
Expand Down

0 comments on commit a266621

Please sign in to comment.