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:
@@ -325,12 +325,12 @@ public class IdentifiedUser extends CurrentUser {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getEmailAddresses() {
|
public ImmutableSet<String> getEmailAddresses() {
|
||||||
if (!loadedAllEmails) {
|
if (!loadedAllEmails) {
|
||||||
validEmails.addAll(realm.getEmailAddresses(this));
|
validEmails.addAll(realm.getEmailAddresses(this));
|
||||||
loadedAllEmails = true;
|
loadedAllEmails = true;
|
||||||
}
|
}
|
||||||
return validEmails;
|
return ImmutableSet.copyOf(validEmails);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|||||||
Reference in New Issue
Block a user