Adapt the use of @Inject and @AssistedInject
This change adapts our use of @Inject and @AssistedInject to be in-line with what the Guice documentation governs [0, 1]. Specifically, @Inject should be used even if the constructor has @Assisted parameters as long as it is the only injected constructor in that class. @AssistedInject should be used if there are multiple constructors with @Assisted parameters. [0] https://google.github.io/guice/api-docs/4.1/javadoc/index.html?com/google/inject/assistedinject/FactoryModuleBuilder.html [1] https://google.github.io/guice/api-docs/4.1/javadoc/com/google/inject/assistedinject/AssistedInject.html Change-Id: I725df1e294d0758f4c27f8b86ec26c21adeb3d8f
This commit is contained in:
@@ -17,8 +17,8 @@ package com.google.gerrit.gpg;
|
||||
import com.google.gerrit.server.IdentifiedUser;
|
||||
import com.google.gerrit.server.config.AllUsersName;
|
||||
import com.google.gerrit.server.git.GitRepositoryManager;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.google.inject.assistedinject.AssistedInject;
|
||||
import java.io.IOException;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
|
||||
@@ -30,7 +30,7 @@ public class GerritPushCertificateChecker extends PushCertificateChecker {
|
||||
private final GitRepositoryManager repoManager;
|
||||
private final AllUsersName allUsers;
|
||||
|
||||
@AssistedInject
|
||||
@Inject
|
||||
GerritPushCertificateChecker(
|
||||
GerritPublicKeyChecker.Factory keyCheckerFactory,
|
||||
GitRepositoryManager repoManager,
|
||||
|
||||
@@ -21,8 +21,8 @@ import com.google.gerrit.gpg.server.DeleteGpgKey;
|
||||
import com.google.gerrit.gpg.server.GpgKey;
|
||||
import com.google.gerrit.gpg.server.GpgKeys;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.google.inject.assistedinject.AssistedInject;
|
||||
import java.io.IOException;
|
||||
import org.bouncycastle.openpgp.PGPException;
|
||||
import org.eclipse.jgit.errors.ConfigInvalidException;
|
||||
@@ -36,7 +36,7 @@ public class GpgKeyApiImpl implements GpgKeyApi {
|
||||
private final DeleteGpgKey delete;
|
||||
private final GpgKey rsrc;
|
||||
|
||||
@AssistedInject
|
||||
@Inject
|
||||
GpgKeyApiImpl(GpgKeys.Get get, DeleteGpgKey delete, @Assisted GpgKey rsrc) {
|
||||
this.get = get;
|
||||
this.delete = delete;
|
||||
|
||||
Reference in New Issue
Block a user