Implement SafeString.hashCode()
SafeString had equals defined but not hashCode(), this
violates the contract required for these methods, and as
such, would result in undefined behaviour if SafeString
objects were used in a hashing data structure.
@@ -24,4 +24,9 @@ public class SafeString {
public boolean equals(Object o) {
return o instanceof SafeString && this.content.equals(((SafeString) o).content);
}
+
+ @Override
+ public int hashCode() {
+ return (content == null) ? 0 : content.hashCode();
+ }
}
