You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Having two separated SIDs, that are equal, meaning:
sid1.equals(sid2) == true
And
sid2.equals(sid1) == true
Then, SID::hashCode does not generate the same hash for the two of them, despite being equal.
sid2.hashCode() != sid1.hashCode().
This breaks Java's contract for hashCode:
If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result
SID::hashCode implementation, within the SID library:
public int hashCode() {
int hash = 5;
hash = 97 * hash + Arrays.hashCode(this.identifierAuthority);
hash = 97 * hash + Objects.hashCode(this.subAuthorities);
return hash;
}
The problematic line is: Objects.hashCode(this.subAuthorities), which uses the default hashCode on each element which is the same for objects that are deep-equals.
The text was updated successfully, but these errors were encountered:
In Java:
Having two separated SIDs, that are equal, meaning:
sid1.equals(sid2) == true
And
sid2.equals(sid1) == true
Then, SID::hashCode does not generate the same hash for the two of them, despite being equal.
sid2.hashCode() != sid1.hashCode().
This breaks Java's contract for hashCode:
If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result
SID::hashCode implementation, within the SID library:
The problematic line is: Objects.hashCode(this.subAuthorities), which uses the default hashCode on each element which is the same for objects that are deep-equals.
The text was updated successfully, but these errors were encountered: