Fix Java code clarity and Error Prone warnings.

Change-Id: I04e66fc6ebdc227f8058d969a0f46aa1de46c0c5
This commit is contained in:
Youssef Elghareeb
2020-09-22 10:45:52 +02:00
parent 4dc29c8b11
commit f073e81de9
7 changed files with 15 additions and 21 deletions

View File

@@ -339,7 +339,7 @@ public interface ChangeApi {
* @return comments as a list; comments have the {@code revision} field set to indicate their
* patch set.
* @throws RestApiException
* @deprecate Callers should use {@link #commentsRequest()} instead
* @deprecated Callers should use {@link #commentsRequest()} instead
*/
@Deprecated
default List<CommentInfo> commentsAsList() throws RestApiException {
@@ -351,7 +351,6 @@ public interface ChangeApi {
*
* @return A {@link CommentsRequest} entity that can be used to retrieve the comments using the
* {@link CommentsRequest#get()} or {@link CommentsRequest#getAsList()}.
* @throws RestApiException
*/
CommentsRequest commentsRequest() throws RestApiException;
@@ -429,7 +428,6 @@ public interface ChangeApi {
*
* @return comments as a list; comments have the {@code revision} field set to indicate their
* patch set.
* @throws RestApiException
*/
public abstract List<CommentInfo> getAsList() throws RestApiException;

View File

@@ -55,7 +55,7 @@ public class CommentContextLoader {
}
@Inject
public CommentContextLoader(GitRepositoryManager repoManager, @Assisted Project.NameKey project) {
CommentContextLoader(GitRepositoryManager repoManager, @Assisted Project.NameKey project) {
this.repoManager = repoManager;
this.project = project;
this.candidates = new HashMap<>();

View File

@@ -26,7 +26,6 @@ import com.google.gerrit.extensions.restapi.AuthException;
import com.google.gerrit.extensions.restapi.Response;
import com.google.gerrit.extensions.restapi.RestReadView;
import com.google.gerrit.server.ChangeMessagesUtil;
import com.google.gerrit.server.CommentContextLoader;
import com.google.gerrit.server.CommentsUtil;
import com.google.gerrit.server.change.ChangeResource;
import com.google.gerrit.server.permissions.PermissionBackendException;
@@ -42,7 +41,6 @@ public class ListChangeComments implements RestReadView<ChangeResource> {
private final ChangeData.Factory changeDataFactory;
private final Provider<CommentJson> commentJson;
private final CommentsUtil commentsUtil;
private final CommentContextLoader.Factory commentContextFactory;
private boolean includeContext;
@@ -62,13 +60,11 @@ public class ListChangeComments implements RestReadView<ChangeResource> {
ChangeData.Factory changeDataFactory,
Provider<CommentJson> commentJson,
CommentsUtil commentsUtil,
ChangeMessagesUtil changeMessagesUtil,
CommentContextLoader.Factory commentContextFactory) {
ChangeMessagesUtil changeMessagesUtil) {
this.changeDataFactory = changeDataFactory;
this.commentJson = commentJson;
this.commentsUtil = commentsUtil;
this.changeMessagesUtil = changeMessagesUtil;
this.commentContextFactory = commentContextFactory;
}
@Override

View File

@@ -23,7 +23,7 @@ import java.util.Set;
import org.eclipse.jgit.lib.Config;
/**
* Wrap a (@link {@link SubscriptionGraph.Factory} to honor the gerrit configuration.
* Wrap a {@link SubscriptionGraph.Factory} to honor the gerrit configuration.
*
* <p>If superproject subscriptions are disabled in the conf, return an empty graph.
*/

View File

@@ -227,7 +227,6 @@ public class MergeOp implements AutoCloseable {
private final Provider<InternalChangeQuery> queryProvider;
private final SubmitStrategyFactory submitStrategyFactory;
private final SubscriptionGraph.Factory subscriptionGraphFactory;
private final SubmoduleOp.Factory subOpFactory;
private final SubmoduleCommits.Factory submoduleCommitsFactory;
private final Provider<MergeOpRepoManager> ormProvider;
private final NotifyResolver notifyResolver;
@@ -260,7 +259,6 @@ public class MergeOp implements AutoCloseable {
SubmitStrategyFactory submitStrategyFactory,
SubmoduleCommits.Factory submoduleCommitsFactory,
SubscriptionGraph.Factory subscriptionGraphFactory,
SubmoduleOp.Factory subOpFactory,
Provider<MergeOpRepoManager> ormProvider,
NotifyResolver notifyResolver,
TopicMetrics topicMetrics,
@@ -275,7 +273,6 @@ public class MergeOp implements AutoCloseable {
this.submitStrategyFactory = submitStrategyFactory;
this.submoduleCommitsFactory = submoduleCommitsFactory;
this.subscriptionGraphFactory = subscriptionGraphFactory;
this.subOpFactory = subOpFactory;
this.ormProvider = ormProvider;
this.notifyResolver = notifyResolver;
this.retryHelper = retryHelper;
@@ -754,7 +751,7 @@ public class MergeOp implements AutoCloseable {
@Nullable
abstract SubmitType submitType();
abstract Set<CodeReviewCommit> commits();
abstract ImmutableSet<CodeReviewCommit> commits();
}
private BranchBatch validateChangeList(OpenRepo or, Collection<ChangeData> submitted) {
@@ -869,7 +866,7 @@ public class MergeOp implements AutoCloseable {
toSubmit.add(commit);
}
logger.atFine().log("Submitting on this run: %s", toSubmit);
return new AutoValue_MergeOp_BranchBatch(submitType, toSubmit);
return new AutoValue_MergeOp_BranchBatch(submitType, ImmutableSet.copyOf(toSubmit));
}
private SetMultimap<ObjectId, PatchSet.Id> getRevisions(OpenRepo or, Collection<ChangeData> cds) {