Don't inject AllUsersNameProvider

This provider provides the name as a singleton based on the config.
Injecting the AllUsersName directly implicitly calls the Provider at
injection time, so injecting the Provider just means unnecessary code
to get() at call sites.

While we're in there, make AllUsersNameProvider an actual @Singleton.

Change-Id: I44a859fa229983df115542f7ad97c57d29396996
This commit is contained in:
Dave Borowitz
2016-02-18 14:48:20 -05:00
parent 4b69634e21
commit bebb1790a2
7 changed files with 30 additions and 34 deletions

View File

@@ -23,7 +23,6 @@ import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.client.RefNames;
import com.google.gerrit.reviewdb.client.RevId;
import com.google.gerrit.server.config.AllUsersName;
import com.google.gerrit.server.config.AllUsersNameProvider;
import com.google.gerrit.server.git.GitRepositoryManager;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@@ -51,10 +50,10 @@ public class DraftCommentNotes extends AbstractChangeNotes<DraftCommentNotes> {
@Inject
public Factory(GitRepositoryManager repoManager,
NotesMigration migration,
AllUsersNameProvider allUsers) {
AllUsersName allUsers) {
this.repoManager = repoManager;
this.migration = migration;
this.draftsProject = allUsers.get();
this.draftsProject = allUsers;
}
public DraftCommentNotes create(Change.Id changeId, Account.Id accountId) {