IdentifiedUser#getEmailAddresses: Return ImmutableSet

This prevents that callers acidentally make modifications to set of
emails that is kept by IdentifiedUser.

Change-Id: I19d7c6f0ce040b6815266776de3753a4bf9ace0c
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2018-01-23 13:24:53 +01:00
parent ae44a34a03
commit c47bc45be4

View File

@@ -325,12 +325,12 @@ public class IdentifiedUser extends CurrentUser {
return false;
}
public Set<String> getEmailAddresses() {
public ImmutableSet<String> getEmailAddresses() {
if (!loadedAllEmails) {
validEmails.addAll(realm.getEmailAddresses(this));
loadedAllEmails = true;
}
return validEmails;
return ImmutableSet.copyOf(validEmails);
}
public String getName() {