Merge changes I3d83aa5d,Ifa9d80d2,I65222959,I7f576ea0,I2edaf059

* changes:
  Remove superfluous final in gerrit/server/patch/
  Remove superfluous final from server/query/change
  Remove superfluous final from server/query/
  Remove superfluous final from gerrit/httpd/
  Remove unneeded final modifiers from gerrit-server/src/main/java/com/google/gerrit/server/git/*.
This commit is contained in:
Edwin Kempin 2017-06-14 06:42:54 +00:00 committed by Gerrit Code Review
commit 22d4074dec
70 changed files with 228 additions and 228 deletions

View File

@ -97,7 +97,7 @@ public abstract class AllRequestFilter implements Filter {
}
@Override
public void doFilter(ServletRequest req, ServletResponse res, final FilterChain last)
public void doFilter(ServletRequest req, ServletResponse res, FilterChain last)
throws IOException, ServletException {
final Iterator<AllRequestFilter> itr = filters.iterator();
new FilterChain() {

View File

@ -56,12 +56,12 @@ public abstract class CacheBasedWebSession implements WebSession {
private CurrentUser user;
protected CacheBasedWebSession(
final HttpServletRequest request,
final HttpServletResponse response,
final WebSessionManager manager,
final AuthConfig authConfig,
final Provider<AnonymousUser> anonymousProvider,
final IdentifiedUser.RequestFactory identified) {
HttpServletRequest request,
HttpServletResponse response,
WebSessionManager manager,
AuthConfig authConfig,
Provider<AnonymousUser> anonymousProvider,
IdentifiedUser.RequestFactory identified) {
this.request = request;
this.response = response;
this.manager = manager;
@ -91,7 +91,7 @@ public abstract class CacheBasedWebSession implements WebSession {
private String readCookie() {
final Cookie[] all = request.getCookies();
if (all != null) {
for (final Cookie c : all) {
for (Cookie c : all) {
if (ACCOUNT_COOKIE.equals(c.getName())) {
final String v = c.getValue();
return v != null && !"".equals(v) ? v : null;
@ -229,7 +229,7 @@ public abstract class CacheBasedWebSession implements WebSession {
response.addCookie(outCookie);
}
private static boolean isSecure(final HttpServletRequest req) {
private static boolean isSecure(HttpServletRequest req) {
return req.isSecure() || "https".equals(req.getScheme());
}
}

View File

@ -32,14 +32,14 @@ class CookieBase64 {
enc[o] = '.';
}
private static int fill(final char[] out, int o, final char f, final int l) {
private static int fill(char[] out, int o, char f, int l) {
for (char c = f; c <= l; c++) {
out[o++] = c;
}
return o;
}
static String encode(final byte[] in) {
static String encode(byte[] in) {
final StringBuilder out = new StringBuilder(in.length * 4 / 3);
final int len2 = in.length - 2;
int d = 0;
@ -53,7 +53,7 @@ class CookieBase64 {
}
private static void encode3to4(
final StringBuilder out, final byte[] in, final int inOffset, final int numSigBytes) {
StringBuilder out, byte[] in, int inOffset, int numSigBytes) {
// 1 2 3
// 01234567890123456789012345678901 Bit position
// --------000000001111111122222222 Array position from threeBytes

View File

@ -41,7 +41,7 @@ public class GetUserFilter implements Filter {
private final boolean enabled;
@Inject
Module(@GerritServerConfig final Config cfg) {
Module(@GerritServerConfig Config cfg) {
enabled = cfg.getBoolean("http", "addUserAsRequestAttribute", true);
}
@ -56,7 +56,7 @@ public class GetUserFilter implements Filter {
private final Provider<CurrentUser> userProvider;
@Inject
GetUserFilter(final Provider<CurrentUser> userProvider) {
GetUserFilter(Provider<CurrentUser> userProvider) {
this.userProvider = userProvider;
}

View File

@ -28,12 +28,12 @@ public class HttpCanonicalWebUrlProvider extends CanonicalWebUrlProvider {
private Provider<HttpServletRequest> requestProvider;
@Inject
HttpCanonicalWebUrlProvider(@GerritServerConfig final Config config) {
HttpCanonicalWebUrlProvider(@GerritServerConfig Config config) {
super(config);
}
@Inject(optional = true)
public void setHttpServletRequest(final Provider<HttpServletRequest> hsr) {
public void setHttpServletRequest(Provider<HttpServletRequest> hsr) {
requestProvider = hsr;
}

View File

@ -42,17 +42,17 @@ public class HttpLogoutServlet extends HttpServlet {
@Inject
protected HttpLogoutServlet(
final AuthConfig authConfig,
final DynamicItem<WebSession> webSession,
@CanonicalWebUrl @Nullable final Provider<String> urlProvider,
final AuditService audit) {
AuthConfig authConfig,
DynamicItem<WebSession> webSession,
@CanonicalWebUrl @Nullable Provider<String> urlProvider,
AuditService audit) {
this.webSession = webSession;
this.urlProvider = urlProvider;
this.logoutUrl = authConfig.getLogoutURL();
this.audit = audit;
}
protected void doLogout(final HttpServletRequest req, final HttpServletResponse rsp)
protected void doLogout(HttpServletRequest req, HttpServletResponse rsp)
throws IOException {
webSession.get().logout();
if (logoutUrl != null) {
@ -73,7 +73,7 @@ public class HttpLogoutServlet extends HttpServlet {
}
@Override
protected void doGet(final HttpServletRequest req, final HttpServletResponse rsp)
protected void doGet(HttpServletRequest req, HttpServletResponse rsp)
throws IOException {
final String sid = webSession.get().getSessionId();

View File

@ -29,7 +29,7 @@ class HttpRemotePeerProvider implements Provider<SocketAddress> {
private final HttpServletRequest req;
@Inject
HttpRemotePeerProvider(final HttpServletRequest r) {
HttpRemotePeerProvider(HttpServletRequest r) {
req = r;
}

View File

@ -48,9 +48,9 @@ public class RequestContextFilter implements Filter {
@Inject
RequestContextFilter(
final Provider<RequestCleanup> r,
final Provider<HttpRequestContext> c,
final ThreadLocalRequestContext l) {
Provider<RequestCleanup> r,
Provider<HttpRequestContext> c,
ThreadLocalRequestContext l) {
cleanup = r;
requestContext = c;
local = l;
@ -64,7 +64,7 @@ public class RequestContextFilter implements Filter {
@Override
public void doFilter(
final ServletRequest request, final ServletResponse response, final FilterChain chain)
ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
RequestContext old = local.setContext(requestContext.get());
try {

View File

@ -52,7 +52,7 @@ public class RequireSslFilter implements Filter {
private final Provider<String> urlProvider;
@Inject
RequireSslFilter(@CanonicalWebUrl @Nullable final Provider<String> urlProvider) {
RequireSslFilter(@CanonicalWebUrl @Nullable Provider<String> urlProvider) {
this.urlProvider = urlProvider;
}
@ -64,7 +64,7 @@ public class RequireSslFilter implements Filter {
@Override
public void doFilter(
final ServletRequest request, final ServletResponse response, final FilterChain chain)
ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
final HttpServletRequest req = (HttpServletRequest) request;
final HttpServletResponse rsp = (HttpServletResponse) response;
@ -91,11 +91,11 @@ public class RequireSslFilter implements Filter {
}
}
private static boolean isSecure(final HttpServletRequest req) {
private static boolean isSecure(HttpServletRequest req) {
return "https".equals(req.getScheme()) || req.isSecure();
}
private static boolean isLocalHost(final HttpServletRequest req) {
private static boolean isLocalHost(HttpServletRequest req) {
return "localhost".equals(req.getServerName()) || "127.0.0.1".equals(req.getServerName());
}
}

View File

@ -265,7 +265,7 @@ class UrlModule extends ServletModule {
}
static void toGerrit(
final String target, final HttpServletRequest req, final HttpServletResponse rsp)
String target, HttpServletRequest req, HttpServletResponse rsp)
throws IOException {
final StringBuilder url = new StringBuilder();
url.append(req.getContextPath());

View File

@ -55,7 +55,7 @@ public class WebSessionManager {
private final Cache<String, Val> self;
@Inject
WebSessionManager(@GerritServerConfig Config cfg, @Assisted final Cache<String, Val> cache) {
WebSessionManager(@GerritServerConfig Config cfg, @Assisted Cache<String, Val> cache) {
prng = new SecureRandom();
self = cache;
@ -76,11 +76,11 @@ public class WebSessionManager {
}
}
Key createKey(final Account.Id who) {
Key createKey(Account.Id who) {
return new Key(newUniqueToken(who));
}
private String newUniqueToken(final Account.Id who) {
private String newUniqueToken(Account.Id who) {
try {
final int nonceLen = 20;
final ByteArrayOutputStream buf;
@ -135,7 +135,7 @@ public class WebSessionManager {
return val;
}
int getCookieAge(final Val val) {
int getCookieAge(Val val) {
if (val.isPersistentCookie()) {
// Client may store the cookie until we would remove it from our
// own cache, after which it will certainly be invalid.
@ -150,7 +150,7 @@ public class WebSessionManager {
return -1;
}
Val get(final Key key) {
Val get(Key key) {
Val val = self.getIfPresent(key.token);
if (val != null && val.expiresAt <= nowMs()) {
self.invalidate(key.token);
@ -159,14 +159,14 @@ public class WebSessionManager {
return val;
}
void destroy(final Key key) {
void destroy(Key key) {
self.invalidate(key.token);
}
static final class Key {
private transient String token;
Key(final String t) {
Key(String t) {
token = t;
}
@ -241,7 +241,7 @@ public class WebSessionManager {
return persistentCookie;
}
private void writeObject(final ObjectOutputStream out) throws IOException {
private void writeObject(ObjectOutputStream out) throws IOException {
writeVarInt32(out, 1);
writeVarInt32(out, accountId.get());
@ -272,7 +272,7 @@ public class WebSessionManager {
writeVarInt32(out, 0);
}
private void readObject(final ObjectInputStream in) throws IOException {
private void readObject(ObjectInputStream in) throws IOException {
PARSE:
for (; ; ) {
final int tag = readVarInt32(in);

View File

@ -63,7 +63,7 @@ public class AsyncReceiveCommits implements PreReceiveHook {
@Provides
@Singleton
@Named(TIMEOUT_NAME)
long getTimeoutMillis(@GerritServerConfig final Config cfg) {
long getTimeoutMillis(@GerritServerConfig Config cfg) {
return ConfigUtil.getTimeUnit(
cfg, "receive", null, "timeout", TimeUnit.MINUTES.toMillis(4), TimeUnit.MILLISECONDS);
}
@ -72,7 +72,7 @@ public class AsyncReceiveCommits implements PreReceiveHook {
private class Worker implements ProjectRunnable {
private final Collection<ReceiveCommand> commands;
private Worker(final Collection<ReceiveCommand> commands) {
private Worker(Collection<ReceiveCommand> commands) {
this.commands = commands;
}
@ -132,12 +132,12 @@ public class AsyncReceiveCommits implements PreReceiveHook {
@Inject
AsyncReceiveCommits(
final ReceiveCommits.Factory factory,
@ReceiveCommitsExecutor final Executor executor,
final RequestScopePropagator scopePropagator,
@Named(TIMEOUT_NAME) final long timeoutMillis,
@Assisted final ProjectControl projectControl,
@Assisted final Repository repo) {
ReceiveCommits.Factory factory,
@ReceiveCommitsExecutor Executor executor,
RequestScopePropagator scopePropagator,
@Named(TIMEOUT_NAME) long timeoutMillis,
@Assisted ProjectControl projectControl,
@Assisted Repository repo) {
this.executor = executor;
this.scopePropagator = scopePropagator;
rc = factory.create(projectControl, repo);
@ -148,7 +148,7 @@ public class AsyncReceiveCommits implements PreReceiveHook {
}
@Override
public void onPreReceive(final ReceivePack rp, final Collection<ReceiveCommand> commands) {
public void onPreReceive(ReceivePack rp, Collection<ReceiveCommand> commands) {
try {
progress.waitFor(
executor.submit(scopePropagator.wrap(new Worker(commands))),
@ -163,7 +163,7 @@ public class AsyncReceiveCommits implements PreReceiveHook {
rc.addError("internal error while processing changes");
// ReceiveCommits has tried its best to catch errors, so anything at this
// point is very bad.
for (final ReceiveCommand c : commands) {
for (ReceiveCommand c : commands) {
if (c.getResult() == Result.NOT_ATTEMPTED) {
c.setResult(Result.REJECTED_OTHER_REASON, "internal error");
}

View File

@ -75,10 +75,10 @@ public class BanCommit {
@Inject
BanCommit(
final Provider<IdentifiedUser> currentUser,
final GitRepositoryManager repoManager,
@GerritPersonIdent final PersonIdent gerritIdent,
final NotesBranchUtil.Factory notesBranchUtilFactory) {
Provider<IdentifiedUser> currentUser,
GitRepositoryManager repoManager,
@GerritPersonIdent PersonIdent gerritIdent,
NotesBranchUtil.Factory notesBranchUtilFactory) {
this.currentUser = currentUser;
this.repoManager = repoManager;
this.notesBranchUtilFactory = notesBranchUtilFactory;
@ -86,7 +86,7 @@ public class BanCommit {
}
public BanCommitResult ban(
final ProjectControl projectControl, final List<ObjectId> commitsToBan, final String reason)
ProjectControl projectControl, List<ObjectId> commitsToBan, String reason)
throws PermissionDeniedException, IOException, ConcurrentRefUpdateException {
if (!projectControl.isOwner()) {
throw new PermissionDeniedException("Not project owner: not permitted to ban commits");
@ -100,7 +100,7 @@ public class BanCommit {
RevWalk revWalk = new RevWalk(repo);
ObjectInserter inserter = repo.newObjectInserter()) {
ObjectId noteId = null;
for (final ObjectId commitToBan : commitsToBan) {
for (ObjectId commitToBan : commitsToBan) {
try {
revWalk.parseCommit(commitToBan);
} catch (MissingObjectException e) {
@ -147,7 +147,7 @@ public class BanCommit {
}
private static String buildCommitMessage(
final List<ObjectId> bannedCommits, final String reason) {
List<ObjectId> bannedCommits, String reason) {
final StringBuilder commitMsg = new StringBuilder();
commitMsg.append("Banning ");
commitMsg.append(bannedCommits.size());
@ -161,7 +161,7 @@ public class BanCommit {
}
commitMsg.append("The following commits are banned:\n");
final StringBuilder commitList = new StringBuilder();
for (final ObjectId c : bannedCommits) {
for (ObjectId c : bannedCommits) {
if (commitList.length() > 0) {
commitList.append(",\n");
}

View File

@ -23,15 +23,15 @@ public class BanCommitResult {
private final List<ObjectId> alreadyBannedCommits = new ArrayList<>(4);
private final List<ObjectId> ignoredObjectIds = new ArrayList<>(4);
public void commitBanned(final ObjectId commitId) {
public void commitBanned(ObjectId commitId) {
newlyBannedCommits.add(commitId);
}
public void commitAlreadyBanned(final ObjectId commitId) {
public void commitAlreadyBanned(ObjectId commitId) {
alreadyBannedCommits.add(commitId);
}
public void notACommit(final ObjectId id) {
public void notACommit(ObjectId id) {
ignoredObjectIds.add(id);
}

View File

@ -84,7 +84,7 @@ public class CodeReviewCommit extends RevCommit {
}
@Override
public void markUninteresting(final RevCommit c)
public void markUninteresting(RevCommit c)
throws MissingObjectException, IncorrectObjectTypeException, IOException {
checkArgument(c instanceof CodeReviewCommit);
super.markUninteresting(c);
@ -120,7 +120,7 @@ public class CodeReviewCommit extends RevCommit {
*/
private CommitMergeStatus statusCode;
public CodeReviewCommit(final AnyObjectId id) {
public CodeReviewCommit(AnyObjectId id) {
super(id);
}
@ -144,7 +144,7 @@ public class CodeReviewCommit extends RevCommit {
this.patchsetId = patchsetId;
}
public void copyFrom(final CodeReviewCommit src) {
public void copyFrom(CodeReviewCommit src) {
control = src.control;
patchsetId = src.patchsetId;
statusCode = src.statusCode;

View File

@ -20,7 +20,7 @@ import java.util.concurrent.TimeUnit;
public abstract class DefaultQueueOp implements Runnable {
private final WorkQueue workQueue;
protected DefaultQueueOp(final WorkQueue wq) {
protected DefaultQueueOp(WorkQueue wq) {
workQueue = wq;
}

View File

@ -112,7 +112,7 @@ public class GarbageCollection {
return result;
}
private void fire(final Project.NameKey p, final Properties statistics) {
private void fire(Project.NameKey p, Properties statistics) {
if (!listeners.iterator().hasNext()) {
return;
}

View File

@ -26,7 +26,7 @@ public class LargeObjectException extends Exception {
private static final long serialVersionUID = 1L;
public LargeObjectException(
final String message, final org.eclipse.jgit.errors.LargeObjectException cause) {
String message, org.eclipse.jgit.errors.LargeObjectException cause) {
super(message, cause);
}
}

View File

@ -66,7 +66,7 @@ public class LocalDiskRepositoryManager implements GitRepositoryManager {
private final Config serverConfig;
@Inject
Lifecycle(@GerritServerConfig final Config cfg) {
Lifecycle(@GerritServerConfig Config cfg) {
this.serverConfig = cfg;
}
@ -242,7 +242,7 @@ public class LocalDiskRepositoryManager implements GitRepositoryManager {
}
}
private void onCreateProject(final Project.NameKey newProjectName) {
private void onCreateProject(Project.NameKey newProjectName) {
namesUpdateLock.lock();
try {
SortedSet<Project.NameKey> n = new TreeSet<>(names);
@ -253,7 +253,7 @@ public class LocalDiskRepositoryManager implements GitRepositoryManager {
}
}
private boolean isUnreasonableName(final Project.NameKey nameKey) {
private boolean isUnreasonableName(Project.NameKey nameKey) {
final String name = nameKey.get();
return name.length() == 0 // no empty paths

View File

@ -82,7 +82,7 @@ public class MergeSorter {
return heads;
}
private static <T> T removeOne(final Collection<T> c) {
private static <T> T removeOne(Collection<T> c) {
final Iterator<T> i = c.iterator();
final T r = i.next();
i.remove();

View File

@ -192,7 +192,7 @@ public class MergeUtil {
}
public CodeReviewCommit getFirstFastForward(
final CodeReviewCommit mergeTip, final RevWalk rw, final List<CodeReviewCommit> toMerge)
CodeReviewCommit mergeTip, RevWalk rw, List<CodeReviewCommit> toMerge)
throws IntegrationException {
for (final Iterator<CodeReviewCommit> i = toMerge.iterator(); i.hasNext(); ) {
try {
@ -457,7 +457,7 @@ public class MergeUtil {
}
private static boolean contains(List<FooterLine> footers, FooterKey key, String val) {
for (final FooterLine line : footers) {
for (FooterLine line : footers) {
if (line.matches(key) && val.equals(line.getValue())) {
return true;
}
@ -466,7 +466,7 @@ public class MergeUtil {
}
private static boolean isSignedOffBy(List<FooterLine> footers, String email) {
for (final FooterLine line : footers) {
for (FooterLine line : footers) {
if (line.matches(FooterKey.SIGNED_OFF_BY) && email.equals(line.getEmailAddress())) {
return true;
}
@ -475,10 +475,10 @@ public class MergeUtil {
}
public boolean canMerge(
final MergeSorter mergeSorter,
final Repository repo,
final CodeReviewCommit mergeTip,
final CodeReviewCommit toMerge)
MergeSorter mergeSorter,
Repository repo,
CodeReviewCommit mergeTip,
CodeReviewCommit toMerge)
throws IntegrationException {
if (hasMissingDependencies(mergeSorter, toMerge)) {
return false;
@ -563,7 +563,7 @@ public class MergeUtil {
}
public boolean hasMissingDependencies(
final MergeSorter mergeSorter, final CodeReviewCommit toMerge) throws IntegrationException {
MergeSorter mergeSorter, CodeReviewCommit toMerge) throws IntegrationException {
try {
return !mergeSorter.sort(Collections.singleton(toMerge)).contains(toMerge);
} catch (IOException e) {
@ -656,7 +656,7 @@ public class MergeUtil {
if (merged.size() > 1) {
msgbuf.append("\n\n* changes:\n");
for (final CodeReviewCommit c : merged) {
for (CodeReviewCommit c : merged) {
rw.parseBody(c);
msgbuf.append(" ");
msgbuf.append(c.getShortMessage());
@ -758,10 +758,10 @@ public class MergeUtil {
}
public void markCleanMerges(
final RevWalk rw,
final RevFlag canMergeFlag,
final CodeReviewCommit mergeTip,
final Set<RevCommit> alreadyAccepted)
RevWalk rw,
RevFlag canMergeFlag,
CodeReviewCommit mergeTip,
Set<RevCommit> alreadyAccepted)
throws IntegrationException {
if (mergeTip == null) {
// If mergeTip is null here, branchTip was null, indicating a new branch

View File

@ -166,7 +166,7 @@ public class MergedByPushOp implements BatchUpdateOp {
}
@Override
public void postUpdate(final Context ctx) {
public void postUpdate(Context ctx) {
if (!correctBranch) {
return;
}

View File

@ -63,7 +63,7 @@ public class MultiProgressMonitor {
private int count;
private int lastPercent;
Task(final String subTaskName, final int totalWork) {
Task(String subTaskName, int totalWork) {
this.name = subTaskName;
this.total = totalWork;
}
@ -76,7 +76,7 @@ public class MultiProgressMonitor {
* @param completed number of work units completed.
*/
@Override
public void update(final int completed) {
public void update(int completed) {
boolean w = false;
synchronized (MultiProgressMonitor.this) {
count += completed;
@ -141,7 +141,7 @@ public class MultiProgressMonitor {
* @param out stream for writing progress messages.
* @param taskName name of the overall task.
*/
public MultiProgressMonitor(final OutputStream out, final String taskName) {
public MultiProgressMonitor(OutputStream out, String taskName) {
this(out, taskName, 500, TimeUnit.MILLISECONDS);
}
@ -154,8 +154,8 @@ public class MultiProgressMonitor {
* @param maxIntervalUnit time unit for progress interval.
*/
public MultiProgressMonitor(
final OutputStream out,
final String taskName,
OutputStream out,
String taskName,
long maxIntervalTime,
TimeUnit maxIntervalUnit) {
this.out = out;
@ -168,7 +168,7 @@ public class MultiProgressMonitor {
*
* @see #waitFor(Future, long, TimeUnit)
*/
public void waitFor(final Future<?> workerFuture) throws ExecutionException {
public void waitFor(Future<?> workerFuture) throws ExecutionException {
waitFor(workerFuture, 0, null);
}
@ -187,7 +187,7 @@ public class MultiProgressMonitor {
* cancelled, or timed out waiting for a worker to call {@link #end()}.
*/
public void waitFor(
final Future<?> workerFuture, final long timeoutTime, final TimeUnit timeoutUnit)
Future<?> workerFuture, long timeoutTime, TimeUnit timeoutUnit)
throws ExecutionException {
long overallStart = System.nanoTime();
long deadline;
@ -268,7 +268,7 @@ public class MultiProgressMonitor {
* @param subTaskWork total work units in sub-task, or {@link #UNKNOWN}.
* @return sub-task handle.
*/
public Task beginSubTask(final String subTask, final int subTaskWork) {
public Task beginSubTask(String subTask, int subTaskWork) {
Task task = new Task(subTask, subTaskWork);
tasks.add(task);
return task;

View File

@ -70,8 +70,8 @@ public class NotesBranchUtil {
@Inject
public NotesBranchUtil(
@GerritPersonIdent final PersonIdent gerritIdent,
final GitReferenceUpdated gitRefUpdated,
@GerritPersonIdent PersonIdent gerritIdent,
GitReferenceUpdated gitRefUpdated,
@Assisted Project.NameKey project,
@Assisted Repository db,
@Assisted ObjectInserter inserter) {

View File

@ -91,7 +91,7 @@ public class PerThreadRequestScope {
public static final Scope REQUEST =
new Scope() {
@Override
public <T> Provider<T> scope(final Key<T> key, final Provider<T> creator) {
public <T> Provider<T> scope(Key<T> key, Provider<T> creator) {
return new Provider<T>() {
@Override
public T get() {

View File

@ -1116,7 +1116,7 @@ public class ProjectConfig extends VersionedMetaData implements ValidationError.
return true;
}
public static final String validMaxObjectSizeLimit(String value) throws ConfigInvalidException {
public static String validMaxObjectSizeLimit(String value) throws ConfigInvalidException {
if (value == null) {
return null;
}

View File

@ -131,7 +131,7 @@ public class RebaseSorter {
}
}
private static <T> T removeOne(final Collection<T> c) {
private static <T> T removeOne(Collection<T> c) {
final Iterator<T> i = c.iterator();
final T r = i.next();
i.remove();

View File

@ -1319,7 +1319,7 @@ public class ReceiveCommits {
metaVar = "MESSAGE",
usage = "Comment message to apply to the review"
)
void addMessage(final String token) {
void addMessage(String token) {
// git push does not allow spaces in refs.
message = token.replace("_", " ");
}
@ -2792,7 +2792,7 @@ public class ReceiveCommits {
return true;
}
private void autoCloseChanges(final ReceiveCommand cmd) {
private void autoCloseChanges(ReceiveCommand cmd) {
logDebug("Starting auto-closing of changes");
String refName = cmd.getRefName();
checkState(
@ -2857,7 +2857,7 @@ public class ReceiveCommits {
}
}
for (final ReplaceRequest req : replaceAndClose) {
for (ReplaceRequest req : replaceAndClose) {
Change.Id id = req.notes.getChangeId();
if (!req.validate(true)) {
logDebug("Not closing {} because validation failed", id);

View File

@ -28,7 +28,7 @@ public class RepositoryCaseMismatchException extends RepositoryNotFoundException
private static final long serialVersionUID = 1L;
/** @param projectName name of the project that cannot be created */
public RepositoryCaseMismatchException(final Project.NameKey projectName) {
public RepositoryCaseMismatchException(Project.NameKey projectName) {
super("Name occupied in other case. Project " + projectName.get() + " cannot be created.");
}
}

View File

@ -385,7 +385,7 @@ public class SubmoduleOp {
}
/** Create a separate gitlink commit */
public CodeReviewCommit composeGitlinksCommit(final Branch.NameKey subscriber)
public CodeReviewCommit composeGitlinksCommit(Branch.NameKey subscriber)
throws IOException, SubmoduleException {
OpenRepo or;
try {
@ -444,7 +444,7 @@ public class SubmoduleOp {
/** Amend an existing commit with gitlink updates */
public CodeReviewCommit composeGitlinksCommit(
final Branch.NameKey subscriber, CodeReviewCommit currentCommit)
Branch.NameKey subscriber, CodeReviewCommit currentCommit)
throws IOException, SubmoduleException {
OpenRepo or;
try {
@ -485,7 +485,7 @@ public class SubmoduleOp {
}
private RevCommit updateSubmodule(
DirCache dc, DirCacheEditor ed, StringBuilder msgbuf, final SubmoduleSubscription s)
DirCache dc, DirCacheEditor ed, StringBuilder msgbuf, SubmoduleSubscription s)
throws SubmoduleException, IOException {
OpenRepo subOr;
try {

View File

@ -31,7 +31,7 @@ public class TransferConfig {
private final String maxObjectSizeLimitFormatted;
@Inject
TransferConfig(@GerritServerConfig final Config cfg) {
TransferConfig(@GerritServerConfig Config cfg) {
timeout =
(int)
ConfigUtil.getTimeUnit(

View File

@ -45,7 +45,7 @@ public class ValidationError {
void error(ValidationError error);
}
public static Sink createLoggerSink(final String message, final Logger log) {
public static Sink createLoggerSink(String message, Logger log) {
return new ValidationError.Sink() {
@Override
public void error(ValidationError error) {

View File

@ -238,7 +238,7 @@ public abstract class VersionedMetaData {
* @param update helper info about the update.
* @throws IOException if the update failed.
*/
public BatchMetaDataUpdate openUpdate(final MetaDataUpdate update) throws IOException {
public BatchMetaDataUpdate openUpdate(MetaDataUpdate update) throws IOException {
final Repository db = update.getRepository();
reader = db.newObjectReader();

View File

@ -52,7 +52,7 @@ public class WorkQueue {
private final WorkQueue workQueue;
@Inject
Lifecycle(final WorkQueue workQeueue) {
Lifecycle(WorkQueue workQeueue) {
this.workQueue = workQeueue;
}
@ -118,7 +118,7 @@ public class WorkQueue {
/** Get all of the tasks currently scheduled in any work queue. */
public List<Task<?>> getTasks() {
final List<Task<?>> r = new ArrayList<>();
for (final Executor e : queues) {
for (Executor e : queues) {
e.addAllTo(r);
}
return r;
@ -135,9 +135,9 @@ public class WorkQueue {
}
/** Locate a task by its unique id, null if no task matches. */
public Task<?> getTask(final int id) {
public Task<?> getTask(int id) {
Task<?> result = null;
for (final Executor e : queues) {
for (Executor e : queues) {
final Task<?> t = e.getTask(id);
if (t != null) {
if (result != null) {
@ -160,7 +160,7 @@ public class WorkQueue {
}
private void stop() {
for (final Executor p : queues) {
for (Executor p : queues) {
p.shutdown();
boolean isTerminated;
do {
@ -179,7 +179,7 @@ public class WorkQueue {
private final ConcurrentHashMap<Integer, Task<?>> all;
private final String queueName;
Executor(int corePoolSize, final String prefix) {
Executor(int corePoolSize, String prefix) {
super(
corePoolSize,
new ThreadFactory() {
@ -187,7 +187,7 @@ public class WorkQueue {
private final AtomicInteger tid = new AtomicInteger(1);
@Override
public Thread newThread(final Runnable task) {
public Thread newThread(Runnable task) {
final Thread t = parent.newThread(task);
t.setName(prefix + "-" + tid.getAndIncrement());
t.setUncaughtExceptionHandler(LOG_UNCAUGHT_EXCEPTION);
@ -212,7 +212,7 @@ public class WorkQueue {
@Override
protected <V> RunnableScheduledFuture<V> decorateTask(
final Runnable runnable, RunnableScheduledFuture<V> r) {
Runnable runnable, RunnableScheduledFuture<V> r) {
r = super.decorateTask(runnable, r);
for (; ; ) {
final int id = idGenerator.next();
@ -233,19 +233,19 @@ public class WorkQueue {
@Override
protected <V> RunnableScheduledFuture<V> decorateTask(
final Callable<V> callable, final RunnableScheduledFuture<V> task) {
Callable<V> callable, RunnableScheduledFuture<V> task) {
throw new UnsupportedOperationException("Callable not implemented");
}
void remove(final Task<?> task) {
void remove(Task<?> task) {
all.remove(task.getTaskId(), task);
}
Task<?> getTask(final int id) {
Task<?> getTask(int id) {
return all.get(id);
}
void addAllTo(final List<Task<?>> list) {
void addAllTo(List<Task<?>> list) {
list.addAll(all.values()); // iterator is thread safe
}

View File

@ -77,7 +77,7 @@ public class AutoMerger {
public RevCommit merge(
Repository repo,
RevWalk rw,
final ObjectInserter ins,
ObjectInserter ins,
RevCommit merge,
ThreeWayMergeStrategy mergeStrategy)
throws IOException {

View File

@ -61,7 +61,7 @@ public class DiffSummaryKey implements Serializable {
}
@Override
public boolean equals(final Object o) {
public boolean equals(Object o) {
if (o instanceof DiffSummaryKey) {
DiffSummaryKey k = (DiffSummaryKey) o;
return Objects.equals(oldId, k.oldId)
@ -89,7 +89,7 @@ public class DiffSummaryKey implements Serializable {
return n.toString();
}
private void writeObject(final ObjectOutputStream out) throws IOException {
private void writeObject(ObjectOutputStream out) throws IOException {
writeCanBeNull(out, oldId);
out.writeInt(parentNum == null ? 0 : parentNum);
writeNotNull(out, newId);
@ -100,7 +100,7 @@ public class DiffSummaryKey implements Serializable {
out.writeChar(c);
}
private void readObject(final ObjectInputStream in) throws IOException {
private void readObject(ObjectInputStream in) throws IOException {
oldId = readCanBeNull(in);
int n = in.readInt();
parentNum = n == 0 ? null : Integer.valueOf(n);

View File

@ -78,7 +78,7 @@ public class IntraLineDiff implements Serializable {
return deepCopyEdits(edits);
}
private void writeObject(final ObjectOutputStream out) throws IOException {
private void writeObject(ObjectOutputStream out) throws IOException {
writeEnum(out, status);
writeVarInt32(out, edits.size());
for (Edit e : edits) {
@ -96,7 +96,7 @@ public class IntraLineDiff implements Serializable {
}
}
private void readObject(final ObjectInputStream in) throws IOException {
private void readObject(ObjectInputStream in) throws IOException {
status = readEnum(in, Status.values());
int editCount = readVarInt32(in);
Edit[] editArray = new Edit[editCount];

View File

@ -96,7 +96,7 @@ public class PatchFile {
* @throws IOException the patch or complete file content cannot be read.
* @throws NoSuchEntityException
*/
public String getLine(final int file, final int line) throws IOException, NoSuchEntityException {
public String getLine(int file, int line) throws IOException, NoSuchEntityException {
switch (file) {
case 0:
if (a == null) {
@ -123,7 +123,7 @@ public class PatchFile {
* @throws IOException the patch or complete file content cannot be read.
* @throws NoSuchEntityException the file is not exist.
*/
public int getLineCount(final int file) throws IOException, NoSuchEntityException {
public int getLineCount(int file) throws IOException, NoSuchEntityException {
switch (file) {
case 0:
if (a == null) {
@ -142,7 +142,7 @@ public class PatchFile {
}
}
private Text load(final ObjectId tree, final String path)
private Text load(ObjectId tree, String path)
throws MissingObjectException, IncorrectObjectTypeException, CorruptObjectException,
IOException {
if (path == null) {

View File

@ -49,7 +49,7 @@ public class PatchList implements Serializable {
private static final Comparator<PatchListEntry> PATCH_CMP =
new Comparator<PatchListEntry>() {
@Override
public int compare(final PatchListEntry a, final PatchListEntry b) {
public int compare(PatchListEntry a, PatchListEntry b) {
return comparePaths(a.getNewName(), b.getNewName());
}
};
@ -151,7 +151,7 @@ public class PatchList implements Serializable {
* specified, but is a current legacy artifact of how the cache is keyed versus how the
* database is keyed.
*/
public List<Patch> toPatchList(final PatchSet.Id setId) {
public List<Patch> toPatchList(PatchSet.Id setId) {
final ArrayList<Patch> r = new ArrayList<>(patches.length);
for (final PatchListEntry e : patches) {
r.add(e.toPatch(setId));
@ -160,17 +160,17 @@ public class PatchList implements Serializable {
}
/** Find an entry by name, returning an empty entry if not present. */
public PatchListEntry get(final String fileName) {
public PatchListEntry get(String fileName) {
final int index = search(fileName);
return 0 <= index ? patches[index] : PatchListEntry.empty(fileName);
}
private int search(final String fileName) {
private int search(String fileName) {
PatchListEntry want = PatchListEntry.empty(fileName);
return Arrays.binarySearch(patches, 0, patches.length, want, PATCH_CMP);
}
private void writeObject(final ObjectOutputStream output) throws IOException {
private void writeObject(ObjectOutputStream output) throws IOException {
final ByteArrayOutputStream buf = new ByteArrayOutputStream();
try (DeflaterOutputStream out = new DeflaterOutputStream(buf)) {
writeCanBeNull(out, oldId);
@ -187,7 +187,7 @@ public class PatchList implements Serializable {
writeBytes(output, buf.toByteArray());
}
private void readObject(final ObjectInputStream input) throws IOException {
private void readObject(ObjectInputStream input) throws IOException {
final ByteArrayInputStream buf = new ByteArrayInputStream(readBytes(input));
try (InflaterInputStream in = new InflaterInputStream(buf)) {
oldId = readCanBeNull(in);

View File

@ -223,7 +223,7 @@ public class PatchListEntry {
return headerLines;
}
Patch toPatch(final PatchSet.Id setId) {
Patch toPatch(PatchSet.Id setId) {
final Patch p = new Patch(new Patch.Key(setId, getNewName()));
p.setChangeType(getChangeType());
p.setPatchType(getPatchType());
@ -299,7 +299,7 @@ public class PatchListEntry {
return edits;
}
private static byte[] compact(final FileHeader h) {
private static byte[] compact(FileHeader h) {
final int end = end(h);
if (h.getStartOffset() == 0 && end == h.getBuffer().length) {
return h.getBuffer();
@ -310,7 +310,7 @@ public class PatchListEntry {
return buf;
}
private static int end(final FileHeader h) {
private static int end(FileHeader h) {
if (h instanceof CombinedFileHeader) {
return h.getEndOffset();
}
@ -320,7 +320,7 @@ public class PatchListEntry {
return h.getEndOffset();
}
private static ChangeType toChangeType(final FileHeader hdr) {
private static ChangeType toChangeType(FileHeader hdr) {
switch (hdr.getChangeType()) {
case ADD:
return Patch.ChangeType.ADDED;
@ -337,7 +337,7 @@ public class PatchListEntry {
}
}
private static PatchType toPatchType(final FileHeader hdr) {
private static PatchType toPatchType(FileHeader hdr) {
PatchType pt;
switch (hdr.getPatchType()) {

View File

@ -123,7 +123,7 @@ public class PatchListKey implements Serializable {
}
@Override
public boolean equals(final Object o) {
public boolean equals(Object o) {
if (o instanceof PatchListKey) {
PatchListKey k = (PatchListKey) o;
return Objects.equals(oldId, k.oldId)
@ -151,7 +151,7 @@ public class PatchListKey implements Serializable {
return n.toString();
}
private void writeObject(final ObjectOutputStream out) throws IOException {
private void writeObject(ObjectOutputStream out) throws IOException {
writeCanBeNull(out, oldId);
out.writeInt(parentNum == null ? 0 : parentNum);
writeNotNull(out, newId);
@ -162,7 +162,7 @@ public class PatchListKey implements Serializable {
out.writeChar(c);
}
private void readObject(final ObjectInputStream in) throws IOException {
private void readObject(ObjectInputStream in) throws IOException {
oldId = readCanBeNull(in);
int n = in.readInt();
parentNum = n == 0 ? null : Integer.valueOf(n);

View File

@ -56,7 +56,7 @@ class PatchScriptBuilder {
private static final Comparator<Edit> EDIT_SORT =
new Comparator<Edit>() {
@Override
public int compare(final Edit o1, final Edit o2) {
public int compare(Edit o1, Edit o2) {
return o1.getBeginA() - o2.getBeginA();
}
};
@ -91,11 +91,11 @@ class PatchScriptBuilder {
this.projectKey = projectKey;
}
void setChange(final Change c) {
void setChange(Change c) {
this.change = c;
}
void setDiffPrefs(final DiffPreferencesInfo dp) {
void setDiffPrefs(DiffPreferencesInfo dp) {
diffPrefs = dp;
context = diffPrefs.context;
@ -106,14 +106,14 @@ class PatchScriptBuilder {
}
}
void setTrees(final ComparisonType ct, final ObjectId a, final ObjectId b) {
void setTrees(ComparisonType ct, ObjectId a, ObjectId b) {
comparisonType = ct;
aId = a;
bId = b;
}
PatchScript toPatchScript(
final PatchListEntry content, final CommentDetail comments, final List<Patch> history)
PatchListEntry content, CommentDetail comments, List<Patch> history)
throws IOException {
reader = db.newObjectReader();
try {
@ -124,7 +124,7 @@ class PatchScriptBuilder {
}
private PatchScript build(
final PatchListEntry content, final CommentDetail comments, final List<Patch> history)
PatchListEntry content, CommentDetail comments, List<Patch> history)
throws IOException {
boolean intralineDifferenceIsPossible = true;
boolean intralineFailure = false;
@ -247,7 +247,7 @@ class PatchScriptBuilder {
}
}
private static String oldName(final PatchListEntry entry) {
private static String oldName(PatchListEntry entry) {
switch (entry.getChangeType()) {
case ADDED:
return null;
@ -262,7 +262,7 @@ class PatchScriptBuilder {
}
}
private static String newName(final PatchListEntry entry) {
private static String newName(PatchListEntry entry) {
switch (entry.getChangeType()) {
case DELETED:
return null;
@ -276,7 +276,7 @@ class PatchScriptBuilder {
}
}
private void ensureCommentsVisible(final CommentDetail comments) {
private void ensureCommentsVisible(CommentDetail comments) {
if (comments.getCommentsA().isEmpty() && comments.getCommentsB().isEmpty()) {
// No comments, no additional dummy edits are required.
//
@ -324,7 +324,7 @@ class PatchScriptBuilder {
Collections.sort(edits, EDIT_SORT);
}
private void safeAdd(final List<Edit> empty, final Edit toAdd) {
private void safeAdd(List<Edit> empty, Edit toAdd) {
final int a = toAdd.getBeginA();
final int b = toAdd.getBeginB();
for (final Edit e : edits) {
@ -338,7 +338,7 @@ class PatchScriptBuilder {
empty.add(toAdd);
}
private int mapA2B(final int a) {
private int mapA2B(int a) {
if (edits.isEmpty()) {
// Magic special case of an unmodified file.
//
@ -364,7 +364,7 @@ class PatchScriptBuilder {
return last.getEndB() + (a - last.getEndA());
}
private int mapB2A(final int b) {
private int mapB2A(int b) {
if (edits.isEmpty()) {
// Magic special case of an unmodified file.
//
@ -443,7 +443,7 @@ class PatchScriptBuilder {
dst.addLine(line, src.getString(line));
}
void resolve(final Side other, final ObjectId within) throws IOException {
void resolve(Side other, ObjectId within) throws IOException {
try {
final boolean reuse;
if (Patch.COMMIT_MSG.equals(path)) {
@ -547,7 +547,7 @@ class PatchScriptBuilder {
}
}
private TreeWalk find(final ObjectId within)
private TreeWalk find(ObjectId within)
throws MissingObjectException, IncorrectObjectTypeException, CorruptObjectException,
IOException {
if (path == null || within == null) {

View File

@ -114,9 +114,9 @@ public class PatchScriptFactory implements Callable<PatchScript> {
CommentsUtil commentsUtil,
ChangeEditUtil editReader,
@Assisted ChangeControl control,
@Assisted final String fileName,
@Assisted("patchSetA") @Nullable final PatchSet.Id patchSetA,
@Assisted("patchSetB") final PatchSet.Id patchSetB,
@Assisted String fileName,
@Assisted("patchSetA") @Nullable PatchSet.Id patchSetA,
@Assisted("patchSetB") PatchSet.Id patchSetB,
@Assisted DiffPreferencesInfo diffPrefs) {
this.repoManager = grm;
this.psUtil = psUtil;
@ -233,18 +233,18 @@ public class PatchScriptFactory implements Callable<PatchScript> {
}
}
private PatchListKey keyFor(final Whitespace whitespace) {
private PatchListKey keyFor(Whitespace whitespace) {
if (parentNum < 0) {
return new PatchListKey(aId, bId, whitespace);
}
return PatchListKey.againstParentNum(parentNum + 1, bId, whitespace);
}
private PatchList listFor(final PatchListKey key) throws PatchListNotAvailableException {
private PatchList listFor(PatchListKey key) throws PatchListNotAvailableException {
return patchListCache.get(key, project);
}
private PatchScriptBuilder newBuilder(final PatchList list, Repository git) {
private PatchScriptBuilder newBuilder(PatchList list, Repository git) {
final PatchScriptBuilder b = builderFactory.get();
b.setRepository(git, project);
b.setChange(change);
@ -277,7 +277,7 @@ public class PatchScriptFactory implements Callable<PatchScript> {
throw new NoSuchChangeException(change.getId());
}
private void validatePatchSetId(final PatchSet.Id psId) throws NoSuchChangeException {
private void validatePatchSetId(PatchSet.Id psId) throws NoSuchChangeException {
if (psId == null) { // OK, means use base;
} else if (changeId.equals(psId.getParentKey())) { // OK, same change;
} else {

View File

@ -90,7 +90,7 @@ public class PatchSetInfoFactory {
}
// TODO: The same method exists in EventFactory, find a common place for it
private UserIdentity toUserIdentity(final PersonIdent who) {
private UserIdentity toUserIdentity(PersonIdent who) {
final UserIdentity u = new UserIdentity();
u.setName(who.getName());
u.setEmail(who.getEmailAddress());
@ -108,7 +108,7 @@ public class PatchSetInfoFactory {
return u;
}
private List<PatchSetInfo.ParentInfo> toParentInfos(final RevCommit[] parents, final RevWalk walk)
private List<PatchSetInfo.ParentInfo> toParentInfos(RevCommit[] parents, RevWalk walk)
throws IOException, MissingObjectException {
List<PatchSetInfo.ParentInfo> pInfos = new ArrayList<>(parents.length);
for (RevCommit parent : parents) {

View File

@ -168,7 +168,7 @@ public class Text extends RawText {
private Charset charset;
public Text(final byte[] r) {
public Text(byte[] r) {
super(r);
}
@ -181,7 +181,7 @@ public class Text extends RawText {
}
@Override
protected String decode(final int s, int e) {
protected String decode(int s, int e) {
if (charset == null) {
charset = charset(content, null);
}

View File

@ -29,11 +29,11 @@ public class AndPredicate<T> extends Predicate<T> implements Matchable<T> {
private final int cost;
@SafeVarargs
protected AndPredicate(final Predicate<T>... that) {
protected AndPredicate(Predicate<T>... that) {
this(Arrays.asList(that));
}
protected AndPredicate(final Collection<? extends Predicate<T>> that) {
protected AndPredicate(Collection<? extends Predicate<T>> that) {
List<Predicate<T>> t = new ArrayList<>(that.size());
int c = 0;
for (Predicate<T> p : that) {
@ -62,12 +62,12 @@ public class AndPredicate<T> extends Predicate<T> implements Matchable<T> {
}
@Override
public final Predicate<T> getChild(final int i) {
public final Predicate<T> getChild(int i) {
return children.get(i);
}
@Override
public Predicate<T> copy(final Collection<? extends Predicate<T>> children) {
public Predicate<T> copy(Collection<? extends Predicate<T>> children) {
return new AndPredicate<>(children);
}
@ -82,7 +82,7 @@ public class AndPredicate<T> extends Predicate<T> implements Matchable<T> {
}
@Override
public boolean match(final T object) throws OrmException {
public boolean match(T object) throws OrmException {
for (Predicate<T> c : children) {
checkState(
c.isMatchable(),
@ -107,7 +107,7 @@ public class AndPredicate<T> extends Predicate<T> implements Matchable<T> {
}
@Override
public boolean equals(final Object other) {
public boolean equals(Object other) {
if (other == null) {
return false;
}

View File

@ -18,12 +18,12 @@ package com.google.gerrit.server.query;
public abstract class IntPredicate<T> extends OperatorPredicate<T> {
private final int intValue;
public IntPredicate(final String name, final String value) {
public IntPredicate(String name, String value) {
super(name, value);
this.intValue = Integer.parseInt(value);
}
public IntPredicate(final String name, final int intValue) {
public IntPredicate(String name, int intValue) {
super(name, String.valueOf(intValue));
this.intValue = intValue;
}
@ -38,7 +38,7 @@ public abstract class IntPredicate<T> extends OperatorPredicate<T> {
}
@Override
public boolean equals(final Object other) {
public boolean equals(Object other) {
if (other == null) {
return false;
}

View File

@ -25,7 +25,7 @@ import java.util.List;
public class NotPredicate<T> extends Predicate<T> implements Matchable<T> {
private final Predicate<T> that;
protected NotPredicate(final Predicate<T> that) {
protected NotPredicate(Predicate<T> that) {
if (that instanceof NotPredicate) {
throw new IllegalArgumentException("Double negation unsupported");
}
@ -43,7 +43,7 @@ public class NotPredicate<T> extends Predicate<T> implements Matchable<T> {
}
@Override
public final Predicate<T> getChild(final int i) {
public final Predicate<T> getChild(int i) {
if (i != 0) {
throw new ArrayIndexOutOfBoundsException(i);
}
@ -51,7 +51,7 @@ public class NotPredicate<T> extends Predicate<T> implements Matchable<T> {
}
@Override
public Predicate<T> copy(final Collection<? extends Predicate<T>> children) {
public Predicate<T> copy(Collection<? extends Predicate<T>> children) {
if (children.size() != 1) {
throw new IllegalArgumentException("Expected exactly one child");
}
@ -64,7 +64,7 @@ public class NotPredicate<T> extends Predicate<T> implements Matchable<T> {
}
@Override
public boolean match(final T object) throws OrmException {
public boolean match(T object) throws OrmException {
checkState(
that.isMatchable(),
"match invoked, but child predicate %s doesn't implement %s",
@ -84,7 +84,7 @@ public class NotPredicate<T> extends Predicate<T> implements Matchable<T> {
}
@Override
public boolean equals(final Object other) {
public boolean equals(Object other) {
if (other == null) {
return false;
}

View File

@ -21,7 +21,7 @@ public abstract class OperatorPredicate<T> extends Predicate<T> {
protected final String name;
protected final String value;
public OperatorPredicate(final String name, final String value) {
public OperatorPredicate(String name, String value) {
this.name = name;
this.value = value;
}
@ -35,7 +35,7 @@ public abstract class OperatorPredicate<T> extends Predicate<T> {
}
@Override
public Predicate<T> copy(final Collection<? extends Predicate<T>> children) {
public Predicate<T> copy(Collection<? extends Predicate<T>> children) {
if (!children.isEmpty()) {
throw new IllegalArgumentException("Expected 0 children");
}
@ -48,7 +48,7 @@ public abstract class OperatorPredicate<T> extends Predicate<T> {
}
@Override
public boolean equals(final Object other) {
public boolean equals(Object other) {
if (other == null) {
return false;
}

View File

@ -29,11 +29,11 @@ public class OrPredicate<T> extends Predicate<T> implements Matchable<T> {
private final int cost;
@SafeVarargs
protected OrPredicate(final Predicate<T>... that) {
protected OrPredicate(Predicate<T>... that) {
this(Arrays.asList(that));
}
protected OrPredicate(final Collection<? extends Predicate<T>> that) {
protected OrPredicate(Collection<? extends Predicate<T>> that) {
List<Predicate<T>> t = new ArrayList<>(that.size());
int c = 0;
for (Predicate<T> p : that) {
@ -62,12 +62,12 @@ public class OrPredicate<T> extends Predicate<T> implements Matchable<T> {
}
@Override
public final Predicate<T> getChild(final int i) {
public final Predicate<T> getChild(int i) {
return children.get(i);
}
@Override
public Predicate<T> copy(final Collection<? extends Predicate<T>> children) {
public Predicate<T> copy(Collection<? extends Predicate<T>> children) {
return new OrPredicate<>(children);
}
@ -82,8 +82,8 @@ public class OrPredicate<T> extends Predicate<T> implements Matchable<T> {
}
@Override
public boolean match(final T object) throws OrmException {
for (final Predicate<T> c : children) {
public boolean match(T object) throws OrmException {
for (Predicate<T> c : children) {
checkState(
c.isMatchable(),
"match invoked, but child predicate %s doesn't implement %s",
@ -107,7 +107,7 @@ public class OrPredicate<T> extends Predicate<T> implements Matchable<T> {
}
@Override
public boolean equals(final Object other) {
public boolean equals(Object other) {
if (other == null) {
return false;
}

View File

@ -48,7 +48,7 @@ public abstract class Predicate<T> {
/** Combine the passed predicates into a single AND node. */
@SafeVarargs
public static <T> Predicate<T> and(final Predicate<T>... that) {
public static <T> Predicate<T> and(Predicate<T>... that) {
if (that.length == 1) {
return that[0];
}
@ -56,7 +56,7 @@ public abstract class Predicate<T> {
}
/** Combine the passed predicates into a single AND node. */
public static <T> Predicate<T> and(final Collection<? extends Predicate<T>> that) {
public static <T> Predicate<T> and(Collection<? extends Predicate<T>> that) {
if (that.size() == 1) {
return Iterables.getOnlyElement(that);
}
@ -65,7 +65,7 @@ public abstract class Predicate<T> {
/** Combine the passed predicates into a single OR node. */
@SafeVarargs
public static <T> Predicate<T> or(final Predicate<T>... that) {
public static <T> Predicate<T> or(Predicate<T>... that) {
if (that.length == 1) {
return that[0];
}
@ -73,7 +73,7 @@ public abstract class Predicate<T> {
}
/** Combine the passed predicates into a single OR node. */
public static <T> Predicate<T> or(final Collection<? extends Predicate<T>> that) {
public static <T> Predicate<T> or(Collection<? extends Predicate<T>> that) {
if (that.size() == 1) {
return Iterables.getOnlyElement(that);
}
@ -81,7 +81,7 @@ public abstract class Predicate<T> {
}
/** Invert the passed node. */
public static <T> Predicate<T> not(final Predicate<T> that) {
public static <T> Predicate<T> not(Predicate<T> that) {
if (that instanceof NotPredicate) {
// Negate of a negate is the original predicate.
//
@ -101,7 +101,7 @@ public abstract class Predicate<T> {
}
/** Same as {@code getChildren().get(i)} */
public Predicate<T> getChild(final int i) {
public Predicate<T> getChild(int i) {
return getChildren().get(i);
}

View File

@ -48,7 +48,7 @@ import org.antlr.runtime.tree.Tree;
*
* <pre>
* &#064;Operator
* public Predicate is(final String value) {
* public Predicate is(String value) {
* if (&quot;starred&quot;.equals(value)) {
* return new StarredPredicate();
* }
@ -180,7 +180,7 @@ public abstract class QueryBuilder<T> {
* This may be due to a syntax error, may be due to an operator not being supported, or due to
* an invalid value being passed to a recognized operator.
*/
public Predicate<T> parse(final String query) throws QueryParseException {
public Predicate<T> parse(String query) throws QueryParseException {
if (Strings.isNullOrEmpty(query)) {
throw new QueryParseException("query is empty");
}
@ -196,7 +196,7 @@ public abstract class QueryBuilder<T> {
* parser. This may be due to a syntax error, may be due to an operator not being supported,
* or due to an invalid value being passed to a recognized operator.
*/
public List<Predicate<T>> parse(final List<String> queries) throws QueryParseException {
public List<Predicate<T>> parse(List<String> queries) throws QueryParseException {
List<Predicate<T>> predicates = new ArrayList<>(queries.size());
for (String query : queries) {
predicates.add(parse(query));
@ -204,7 +204,7 @@ public abstract class QueryBuilder<T> {
return predicates;
}
private Predicate<T> toPredicate(final Tree r)
private Predicate<T> toPredicate(Tree r)
throws QueryParseException, IllegalArgumentException {
switch (r.getType()) {
case AND:
@ -225,7 +225,7 @@ public abstract class QueryBuilder<T> {
}
}
private Predicate<T> operator(final String name, final Tree val) throws QueryParseException {
private Predicate<T> operator(String name, Tree val) throws QueryParseException {
switch (val.getType()) {
// Expand multiple values, "foo:(a b c)", as though they were written
// out with the longer form, "foo:a foo:b foo:c".
@ -257,7 +257,7 @@ public abstract class QueryBuilder<T> {
}
@SuppressWarnings("unchecked")
private Predicate<T> operator(final String name, final String value) throws QueryParseException {
private Predicate<T> operator(String name, String value) throws QueryParseException {
@SuppressWarnings("rawtypes")
OperatorFactory f = opFactories.get(name);
if (f == null) {
@ -266,7 +266,7 @@ public abstract class QueryBuilder<T> {
return f.create(this, value);
}
private Predicate<T> defaultField(final Tree r) throws QueryParseException {
private Predicate<T> defaultField(Tree r) throws QueryParseException {
switch (r.getType()) {
case SINGLE_WORD:
case EXACT_PHRASE:
@ -291,11 +291,11 @@ public abstract class QueryBuilder<T> {
* @return predicate representing this value.
* @throws QueryParseException the parser does not recognize this value.
*/
protected Predicate<T> defaultField(final String value) throws QueryParseException {
protected Predicate<T> defaultField(String value) throws QueryParseException {
throw error("Unsupported query:" + value);
}
private List<Predicate<T>> children(final Tree r)
private List<Predicate<T>> children(Tree r)
throws QueryParseException, IllegalArgumentException {
List<Predicate<T>> p = new ArrayList<>(r.getChildCount());
for (int i = 0; i < r.getChildCount(); i++) {
@ -304,7 +304,7 @@ public abstract class QueryBuilder<T> {
return p;
}
private Tree onlyChildOf(final Tree r) throws QueryParseException {
private Tree onlyChildOf(Tree r) throws QueryParseException {
if (r.getChildCount() != 1) {
throw error("Expected exactly one child: " + r);
}
@ -329,7 +329,7 @@ public abstract class QueryBuilder<T> {
private final String name;
private final Method method;
ReflectionFactory(final String name, final Method method) {
ReflectionFactory(String name, Method method) {
this.name = name;
this.method = method;
}

View File

@ -46,7 +46,7 @@ public class AgePredicate extends TimestampRangeChangePredicate {
}
@Override
public boolean match(final ChangeData object) throws OrmException {
public boolean match(ChangeData object) throws OrmException {
Change change = object.change();
return change != null && change.getLastUpdatedOn().getTime() <= cut;
}

View File

@ -27,7 +27,7 @@ public class AssigneePredicate extends ChangeIndexPredicate {
}
@Override
public boolean match(final ChangeData object) throws OrmException {
public boolean match(ChangeData object) throws OrmException {
if (id.get() == ChangeField.NO_ASSIGNEE) {
Account.Id assignee = object.change().getAssignee();
return assignee == null;

View File

@ -43,7 +43,7 @@ public class ChangeIsVisibleToPredicate extends IsVisibleToPredicate<ChangeData>
}
@Override
public boolean match(final ChangeData cd) throws OrmException {
public boolean match(ChangeData cd) throws OrmException {
if (cd.fastIsVisibleTo(user)) {
return true;
}

View File

@ -96,7 +96,7 @@ public final class ChangeStatusPredicate extends ChangeIndexPredicate {
}
@Override
public boolean match(final ChangeData object) throws OrmException {
public boolean match(ChangeData object) throws OrmException {
Change change = object.change();
return change != null && status.equals(change.getStatus());
}

View File

@ -35,7 +35,7 @@ public class CommitPredicate extends ChangeIndexPredicate {
}
@Override
public boolean match(final ChangeData object) throws OrmException {
public boolean match(ChangeData object) throws OrmException {
String id = getValue().toLowerCase();
for (PatchSet p : object.patchSets()) {
if (equals(p, id)) {

View File

@ -28,7 +28,7 @@ public class DestinationPredicate extends ChangeOperatorPredicate {
}
@Override
public boolean match(final ChangeData object) throws OrmException {
public boolean match(ChangeData object) throws OrmException {
Change change = object.change();
if (change == null) {
return false;

View File

@ -25,7 +25,7 @@ public class ExactTopicPredicate extends ChangeIndexPredicate {
}
@Override
public boolean match(final ChangeData object) throws OrmException {
public boolean match(ChangeData object) throws OrmException {
Change change = object.change();
if (change == null) {
return false;

View File

@ -33,7 +33,7 @@ public class FuzzyTopicPredicate extends ChangeIndexPredicate {
}
@Override
public boolean match(final ChangeData cd) throws OrmException {
public boolean match(ChangeData cd) throws OrmException {
Change change = cd.change();
if (change == null) {
return false;

View File

@ -24,7 +24,7 @@ public class HashtagPredicate extends ChangeIndexPredicate {
}
@Override
public boolean match(final ChangeData object) throws OrmException {
public boolean match(ChangeData object) throws OrmException {
for (String hashtag : object.notes().load().getHashtags()) {
if (hashtag.equalsIgnoreCase(getValue())) {
return true;

View File

@ -169,7 +169,7 @@ public class InternalChangeQuery extends InternalQuery<ChangeData> {
}
private Iterable<ChangeData> byCommitsOnBranchNotMergedFromDatabase(
Repository repo, final ReviewDb db, final Branch.NameKey branch, Collection<String> hashes)
Repository repo, ReviewDb db, Branch.NameKey branch, Collection<String> hashes)
throws OrmException, IOException {
Set<Change.Id> changeIds = Sets.newHashSetWithExpectedSize(hashes.size());
String lastPrefix = null;

View File

@ -28,7 +28,7 @@ public class LegacyChangeIdPredicate extends ChangeIndexPredicate {
}
@Override
public boolean match(final ChangeData object) {
public boolean match(ChangeData object) {
return id.equals(object.getId());
}

View File

@ -32,7 +32,7 @@ public class OwnerPredicate extends ChangeIndexPredicate {
}
@Override
public boolean match(final ChangeData object) throws OrmException {
public boolean match(ChangeData object) throws OrmException {
Change change = object.change();
return change != null && id.equals(change.getOwner());
}

View File

@ -29,7 +29,7 @@ public class ProjectPredicate extends ChangeIndexPredicate {
}
@Override
public boolean match(final ChangeData object) throws OrmException {
public boolean match(ChangeData object) throws OrmException {
Change change = object.change();
if (change == null) {
return false;

View File

@ -24,7 +24,7 @@ public class RefPredicate extends ChangeIndexPredicate {
}
@Override
public boolean match(final ChangeData object) throws OrmException {
public boolean match(ChangeData object) throws OrmException {
Change change = object.change();
if (change == null) {
return false;

View File

@ -39,7 +39,7 @@ public class RegexProjectPredicate extends ChangeRegexPredicate {
}
@Override
public boolean match(final ChangeData object) throws OrmException {
public boolean match(ChangeData object) throws OrmException {
Change change = object.change();
if (change == null) {
return false;

View File

@ -38,7 +38,7 @@ public class RegexRefPredicate extends ChangeRegexPredicate {
}
@Override
public boolean match(final ChangeData object) throws OrmException {
public boolean match(ChangeData object) throws OrmException {
Change change = object.change();
if (change == null) {
return false;

View File

@ -39,7 +39,7 @@ public class RegexTopicPredicate extends ChangeRegexPredicate {
}
@Override
public boolean match(final ChangeData object) throws OrmException {
public boolean match(ChangeData object) throws OrmException {
Change change = object.change();
if (change == null || change.getTopic() == null) {
return false;

View File

@ -34,7 +34,7 @@ public class ReviewerinPredicate extends ChangeOperatorPredicate {
}
@Override
public boolean match(final ChangeData object) throws OrmException {
public boolean match(ChangeData object) throws OrmException {
for (Account.Id accountId : object.reviewers().all()) {
IdentifiedUser reviewer = userFactory.create(accountId);
if (reviewer.getEffectiveGroups().contains(uuid)) {