[vcs-log] users with different e-mails are not equal

This commit is contained in:
Julia Beliaeva
2016-03-26 19:55:33 +03:00
parent c9fb5f5975
commit bb19363cce
@@ -23,8 +23,10 @@ import org.jetbrains.annotations.Nullable;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.Objects;
/**
* Note: users are considered equal if they have the same name, even if the e-mail is different.
* Note: users are considered equal if they have the same name and email. Emails are converted to lower case in constructor.
*/
public class VcsUserImpl implements VcsUser {
@NotNull private static final Pattern NAME_WITH_DOT = Pattern.compile("(\\w*)\\.(\\w*)");
@@ -35,7 +37,7 @@ public class VcsUserImpl implements VcsUser {
public VcsUserImpl(@NotNull String name, @NotNull String email) {
myName = name;
myEmail = email;
myEmail = email.toLowerCase();
}
@NotNull
@@ -58,13 +60,14 @@ public class VcsUserImpl implements VcsUser {
VcsUserImpl user = (VcsUserImpl)o;
if (!myName.equals(user.myName)) return false;
if (!myEmail.equals(user.myEmail)) return false;
return true;
}
@Override
public int hashCode() {
return myName.hashCode();
return Objects.hash(myName, myEmail);
}
@Override