Remove @Inject from IndexCollection constructor

Ever since da0459d20c (Extract interfaces
for Index and IndexCollection, 2016-03-15), this is an abstract class so
annotating its constructor has no effect.

Annotate the constructors of its concrete subclasses instead.

Change-Id: I7eecdd794f26ebd34041f829617a25536161dc86
This commit is contained in:
Jonathan Nieder
2016-08-02 15:22:54 -07:00
parent 28ddc0979c
commit 0b854a721f
3 changed files with 13 additions and 5 deletions

View File

@@ -14,10 +14,8 @@
package com.google.gerrit.server.index;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
import com.google.gerrit.extensions.events.LifecycleListener;
import com.google.inject.Inject;
import java.util.Collection;
import java.util.Collections;
@@ -30,9 +28,7 @@ public abstract class IndexCollection<K, V, I extends Index<K, V>>
private final CopyOnWriteArrayList<I> writeIndexes;
private final AtomicReference<I> searchIndex;
@Inject
@VisibleForTesting
public IndexCollection() {
protected IndexCollection() {
this.writeIndexes = Lists.newCopyOnWriteArrayList();
this.searchIndex = new AtomicReference<>();
}

View File

@@ -14,12 +14,18 @@
package com.google.gerrit.server.index.account;
import com.google.common.annotations.VisibleForTesting;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.server.account.AccountState;
import com.google.gerrit.server.index.IndexCollection;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@Singleton
public class AccountIndexCollection extends
IndexCollection<Account.Id, AccountState, AccountIndex> {
@Inject
@VisibleForTesting
public AccountIndexCollection() {
}
}

View File

@@ -14,12 +14,18 @@
package com.google.gerrit.server.index.change;
import com.google.common.annotations.VisibleForTesting;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.server.index.IndexCollection;
import com.google.gerrit.server.query.change.ChangeData;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@Singleton
public class ChangeIndexCollection extends
IndexCollection<Change.Id, ChangeData, ChangeIndex> {
@Inject
@VisibleForTesting
public ChangeIndexCollection() {
}
}