Merge changes from topic 'checkstyle-cleanup'
* changes: Remove redundant 'private' modifier on constructors Remove redundant 'static' modifiers InitIndex: Add comment in empty if-block Declare variables on separate lines Change class modifier order to follow Java Language Spec Add missing whitespace around keywords, operators and braces
This commit is contained in:
@@ -44,7 +44,7 @@ public class Description {
|
||||
}
|
||||
}
|
||||
|
||||
public static enum FieldOrdering {
|
||||
public enum FieldOrdering {
|
||||
/** Default ordering places fields at end of the parent metric name. */
|
||||
AT_END,
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public class PrologEnvironment extends BufferingPrologControl {
|
||||
private static final Logger log =
|
||||
LoggerFactory.getLogger(PrologEnvironment.class);
|
||||
|
||||
public static interface Factory {
|
||||
public interface Factory {
|
||||
/**
|
||||
* Construct a new Prolog interpreter.
|
||||
*
|
||||
|
||||
@@ -44,7 +44,7 @@ public class WebLinks {
|
||||
|
||||
@Override
|
||||
public boolean apply(WebLinkInfo link) {
|
||||
if (link == null){
|
||||
if (link == null) {
|
||||
return false;
|
||||
} else if (Strings.isNullOrEmpty(link.name)
|
||||
|| Strings.isNullOrEmpty(link.url)) {
|
||||
|
||||
@@ -354,7 +354,7 @@ public class AccountManager {
|
||||
}
|
||||
try {
|
||||
update(db, who, extId);
|
||||
} catch(NameAlreadyUsedException | InvalidUserNameException e) {
|
||||
} catch (NameAlreadyUsedException | InvalidUserNameException e) {
|
||||
throw new AccountException("Account update failed", e);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ import com.google.inject.Singleton;
|
||||
@Singleton
|
||||
public class AccountsCollection implements
|
||||
RestCollection<TopLevelResource, AccountResource>,
|
||||
AcceptsCreate<TopLevelResource>{
|
||||
AcceptsCreate<TopLevelResource> {
|
||||
private final Provider<CurrentUser> self;
|
||||
private final AccountResolver resolver;
|
||||
private final AccountControl.Factory accountControlFactory;
|
||||
|
||||
@@ -39,7 +39,7 @@ import java.util.Map;
|
||||
|
||||
/** Access control management for server-wide capabilities. */
|
||||
public class CapabilityControl {
|
||||
public static interface Factory {
|
||||
public interface Factory {
|
||||
CapabilityControl create(CurrentUser user);
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public class CreateAccount implements RestModifyView<TopLevelResource, Input> {
|
||||
public List<String> groups;
|
||||
}
|
||||
|
||||
public static interface Factory {
|
||||
public interface Factory {
|
||||
CreateAccount create(String username);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ import org.slf4j.LoggerFactory;
|
||||
public class CreateEmail implements RestModifyView<AccountResource, EmailInput> {
|
||||
private static final Logger log = LoggerFactory.getLogger(CreateEmail.class);
|
||||
|
||||
public static interface Factory {
|
||||
public interface Factory {
|
||||
CreateEmail create(String email);
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ public class GroupCacheImpl implements GroupCache {
|
||||
Optional<AccountGroup> g = byId.get(groupId);
|
||||
return g.isPresent() ? g.get() : missing(groupId);
|
||||
} catch (ExecutionException e) {
|
||||
log.warn("Cannot load group "+groupId, e);
|
||||
log.warn("Cannot load group " + groupId, e);
|
||||
return missing(groupId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ public class StarredChanges implements
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public RestModifyView<AccountResource, EmptyInput> create(
|
||||
AccountResource parent, IdString id) throws UnprocessableEntityException{
|
||||
AccountResource parent, IdString id) throws UnprocessableEntityException {
|
||||
try {
|
||||
return createProvider.get()
|
||||
.setChange(changes.parse(TopLevelResource.INSTANCE, id));
|
||||
|
||||
@@ -31,7 +31,7 @@ public enum ArchiveFormat {
|
||||
private final ArchiveCommand.Format<?> format;
|
||||
private final String mimeType;
|
||||
|
||||
private ArchiveFormat(String mimeType, ArchiveCommand.Format<?> format) {
|
||||
ArchiveFormat(String mimeType, ArchiveCommand.Format<?> format) {
|
||||
this.format = format;
|
||||
this.mimeType = mimeType;
|
||||
ArchiveCommand.registerFormat(name(), format);
|
||||
|
||||
@@ -403,7 +403,7 @@ public class ChangeEdits implements
|
||||
rsrc.getChangeEdit(),
|
||||
rsrc.getPath(),
|
||||
input.content);
|
||||
} catch(InvalidChangeOperationException | IOException e) {
|
||||
} catch (InvalidChangeOperationException | IOException e) {
|
||||
throw new ResourceConflictException(e.getMessage());
|
||||
}
|
||||
return Response.none();
|
||||
@@ -434,7 +434,7 @@ public class ChangeEdits implements
|
||||
throws AuthException, ResourceConflictException {
|
||||
try {
|
||||
editModifier.deleteFile(rsrc.getChangeEdit(), rsrc.getPath());
|
||||
} catch(InvalidChangeOperationException | IOException e) {
|
||||
} catch (InvalidChangeOperationException | IOException e) {
|
||||
throw new ResourceConflictException(e.getMessage());
|
||||
}
|
||||
return Response.none();
|
||||
|
||||
@@ -77,7 +77,7 @@ import java.util.Set;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
public class ChangeInserter extends BatchUpdate.InsertChangeOp {
|
||||
public static interface Factory {
|
||||
public interface Factory {
|
||||
ChangeInserter create(Change.Id cid, RevCommit rc, String refName);
|
||||
}
|
||||
|
||||
@@ -406,7 +406,7 @@ public class ChangeInserter extends BatchUpdate.InsertChangeOp {
|
||||
List<LabelType> labels = changeControl.getLabelTypes().getLabelTypes();
|
||||
Map<String, Short> allApprovals = new HashMap<>();
|
||||
Map<String, Short> oldApprovals = new HashMap<>();
|
||||
for (LabelType lt : labels){
|
||||
for (LabelType lt : labels) {
|
||||
allApprovals.put(lt.getName(), (short) 0);
|
||||
oldApprovals.put(lt.getName(), null);
|
||||
}
|
||||
|
||||
@@ -288,8 +288,8 @@ public class ChangeKindCacheImpl implements ChangeKindCache {
|
||||
public static class ChangeKindWeigher implements Weigher<Key, ChangeKind> {
|
||||
@Override
|
||||
public int weigh(Key key, ChangeKind changeKind) {
|
||||
return 16 + 2*36 + 2*key.strategyName.length() // Size of Key, 64 bit JVM
|
||||
+ 2*changeKind.name().length(); // Size of ChangeKind, 64 bit JVM
|
||||
return 16 + 2 * 36 + 2 * key.strategyName.length() // Size of Key, 64 bit JVM
|
||||
+ 2 * changeKind.name().length(); // Size of ChangeKind, 64 bit JVM
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -164,8 +164,8 @@ public class GetDiff implements RestReadView<FileResource> {
|
||||
case INSERT:
|
||||
case REPLACE:
|
||||
List<Edit> internalEdit = edit instanceof ReplaceEdit
|
||||
? ((ReplaceEdit) edit).getInternalEdits()
|
||||
: null;
|
||||
? ((ReplaceEdit) edit).getInternalEdits()
|
||||
: null;
|
||||
content.addDiff(edit.getEndA(), edit.getEndB(), internalEdit);
|
||||
break;
|
||||
case EMPTY:
|
||||
@@ -403,7 +403,7 @@ public class GetDiff implements RestReadView<FileResource> {
|
||||
|
||||
private final DiffPreferencesInfo.Whitespace whitespace;
|
||||
|
||||
private IgnoreWhitespace(DiffPreferencesInfo.Whitespace whitespace) {
|
||||
IgnoreWhitespace(DiffPreferencesInfo.Whitespace whitespace) {
|
||||
this.whitespace = whitespace;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class PatchSetInserter extends BatchUpdate.Op {
|
||||
private static final Logger log =
|
||||
LoggerFactory.getLogger(PatchSetInserter.class);
|
||||
|
||||
public static interface Factory {
|
||||
public interface Factory {
|
||||
PatchSetInserter create(RefControl refControl, PatchSet.Id psId,
|
||||
RevCommit commit);
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class RebaseUtil {
|
||||
}
|
||||
|
||||
@AutoValue
|
||||
static abstract class Base {
|
||||
abstract static class Base {
|
||||
private static Base create(ChangeControl ctl, PatchSet ps) {
|
||||
if (ctl == null) {
|
||||
return null;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class ReviewerResource implements RestResource {
|
||||
public static final TypeLiteral<RestView<ReviewerResource>> REVIEWER_KIND =
|
||||
new TypeLiteral<RestView<ReviewerResource>>() {};
|
||||
|
||||
public static interface Factory {
|
||||
public interface Factory {
|
||||
ReviewerResource create(ChangeResource change, Account.Id id);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ import java.util.TreeMap;
|
||||
public class ListCaches implements RestReadView<ConfigResource> {
|
||||
private final DynamicMap<Cache<?, ?>> cacheMap;
|
||||
|
||||
public static enum OutputFormat {
|
||||
public enum OutputFormat {
|
||||
LIST, TEXT_LIST
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ public class PostCaches implements RestModifyView<ConfigResource, Input> {
|
||||
}
|
||||
}
|
||||
|
||||
public static enum Operation {
|
||||
public enum Operation {
|
||||
FLUSH_ALL, FLUSH
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ import java.util.TimeZone;
|
||||
@Singleton
|
||||
public class ChangeEditModifier {
|
||||
|
||||
private static enum TreeOperation {
|
||||
private enum TreeOperation {
|
||||
CHANGE_ENTRY,
|
||||
DELETE_ENTRY,
|
||||
RENAME_ENTRY,
|
||||
|
||||
@@ -147,7 +147,7 @@ public class ChangeEditUtil {
|
||||
int n = change.currentPatchSetId().get();
|
||||
String[] refNames = new String[n];
|
||||
for (int i = n; i > 0; i--) {
|
||||
refNames[i-1] = RefNames.refsEdit(
|
||||
refNames[i - 1] = RefNames.refsEdit(
|
||||
u.getAccountId(), change.getId(),
|
||||
new PatchSet.Id(change.getId(), i));
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ public class EventFactory {
|
||||
SubmitLabelAttribute la = new SubmitLabelAttribute();
|
||||
la.label = lbl.label;
|
||||
la.status = lbl.status.name();
|
||||
if(lbl.appliedBy != null) {
|
||||
if (lbl.appliedBy != null) {
|
||||
Account a = accountCache.get(lbl.appliedBy).getAccount();
|
||||
la.by = asAccountAttribute(a);
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public class BatchUpdate implements AutoCloseable {
|
||||
}
|
||||
|
||||
/** Order of execution of the various phases. */
|
||||
public static enum Order {
|
||||
public enum Order {
|
||||
/**
|
||||
* Update the repository and execute all ref updates before touching the
|
||||
* database.
|
||||
|
||||
@@ -53,7 +53,7 @@ public class DestinationList extends TabFile {
|
||||
|
||||
protected static Set<Branch.NameKey> toSet(List<Row> destRows) {
|
||||
Set<Branch.NameKey> dests = Sets.newHashSetWithExpectedSize(destRows.size());
|
||||
for(Row row : destRows) {
|
||||
for (Row row : destRows) {
|
||||
dests.add(new Branch.NameKey(new Project.NameKey(row.right), row.left));
|
||||
}
|
||||
return dests;
|
||||
|
||||
@@ -103,7 +103,7 @@ public class GroupCollector {
|
||||
return rsrc.getPatchSet().getGroups();
|
||||
}
|
||||
|
||||
private static interface Lookup {
|
||||
private interface Lookup {
|
||||
List<String> lookup(PatchSet.Id psId)
|
||||
throws OrmException, NoSuchChangeException;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class GroupList extends TabFile {
|
||||
List<Row> rows = parse(text, FILE_NAME, TRIM, TRIM, errors);
|
||||
Map<AccountGroup.UUID, GroupReference> groupsByUUID =
|
||||
new HashMap<>(rows.size());
|
||||
for(Row row : rows) {
|
||||
for (Row row : rows) {
|
||||
AccountGroup.UUID uuid = new AccountGroup.UUID(row.left);
|
||||
String name = row.right;
|
||||
GroupReference ref = new GroupReference(uuid, name);
|
||||
|
||||
@@ -333,7 +333,7 @@ public class LocalDiskRepositoryManager implements GitRepositoryManager,
|
||||
final String name = nameKey.get();
|
||||
|
||||
return name.length() == 0 // no empty paths
|
||||
|| name.charAt(name.length() -1) == '/' // no suffix
|
||||
|| name.charAt(name.length() - 1) == '/' // no suffix
|
||||
|| name.indexOf('\\') >= 0 // no windows/dos style paths
|
||||
|| name.charAt(0) == '/' // no absolute paths
|
||||
|| new File(name).isAbsolute() // no absolute paths
|
||||
|
||||
@@ -706,7 +706,7 @@ public class MergeOp implements AutoCloseable {
|
||||
}
|
||||
|
||||
@AutoValue
|
||||
static abstract class BranchBatch {
|
||||
abstract static class BranchBatch {
|
||||
@Nullable abstract SubmitType submitType();
|
||||
abstract List<ChangeData> changes();
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ public class MergeUtil {
|
||||
: MergeStrategy.RESOLVE;
|
||||
}
|
||||
|
||||
public static interface Factory {
|
||||
public interface Factory {
|
||||
MergeUtil create(ProjectState project);
|
||||
MergeUtil create(ProjectState project, boolean useContentMerge);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class NotifyConfig implements Comparable<NotifyConfig> {
|
||||
public static enum Header {
|
||||
public enum Header {
|
||||
TO, CC, BCC
|
||||
}
|
||||
|
||||
|
||||
@@ -380,7 +380,7 @@ public class ReplaceOp extends BatchUpdate.Op {
|
||||
hooks.doChangeMergedHook(change, account, newPatchSet, ctx.getDb(),
|
||||
commit.getName());
|
||||
}
|
||||
try{
|
||||
try {
|
||||
runHook(ctx);
|
||||
} catch (Exception e) {
|
||||
log.warn("ChangeHook.doCommentAddedHook delivery failed", e);
|
||||
@@ -403,7 +403,7 @@ public class ReplaceOp extends BatchUpdate.Op {
|
||||
List<LabelType> labels = changeControl.getLabelTypes().getLabelTypes();
|
||||
Map<String, Short> allApprovals = new HashMap<>();
|
||||
Map<String, Short> oldApprovals = new HashMap<>();
|
||||
for (LabelType lt : labels){
|
||||
for (LabelType lt : labels) {
|
||||
allApprovals.put(lt.getName(), (short) 0);
|
||||
oldApprovals.put(lt.getName(), null);
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ public class SubmoduleOp {
|
||||
ret.addAll(m.subscribedTo(branch));
|
||||
}
|
||||
}
|
||||
logDebug("Calculated superprojects for " + branch + " are "+ ret);
|
||||
logDebug("Calculated superprojects for " + branch + " are " + ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -262,7 +262,7 @@ public class WorkQueue {
|
||||
* <li>{@link #DONE}: finished executing, if not periodic.</li>
|
||||
* </ol>
|
||||
*/
|
||||
public static enum State {
|
||||
public enum State {
|
||||
// Ordered like this so ordinal matches the order we would
|
||||
// prefer to see tasks sorted in: done before running,
|
||||
// running before ready, ready before sleeping.
|
||||
|
||||
@@ -59,7 +59,7 @@ public enum CommitMergeStatus {
|
||||
|
||||
private String message;
|
||||
|
||||
private CommitMergeStatus(String message) {
|
||||
CommitMergeStatus(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public class CommitValidators {
|
||||
private static final Logger log = LoggerFactory
|
||||
.getLogger(CommitValidators.class);
|
||||
|
||||
public static enum Policy {
|
||||
public enum Policy {
|
||||
/** Use {@link #validateForGerritCommits}. */
|
||||
GERRIT,
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ import java.util.Locale;
|
||||
|
||||
@RequiresCapability(GlobalCapability.CREATE_GROUP)
|
||||
public class CreateGroup implements RestModifyView<TopLevelResource, GroupInput> {
|
||||
public static interface Factory {
|
||||
public interface Factory {
|
||||
CreateGroup create(@Assisted String name);
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public class GroupsCollection implements
|
||||
final CurrentUser user = self.get();
|
||||
if (user instanceof AnonymousUser) {
|
||||
throw new AuthException("Authentication required");
|
||||
} else if(!(user.isIdentifiedUser())) {
|
||||
} else if (!(user.isIdentifiedUser())) {
|
||||
throw new ResourceNotFoundException();
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public class GroupsCollection implements
|
||||
final CurrentUser user = self.get();
|
||||
if (user instanceof AnonymousUser) {
|
||||
throw new AuthException("Authentication required");
|
||||
} else if(!(user.isIdentifiedUser())) {
|
||||
} else if (!(user.isIdentifiedUser())) {
|
||||
throw new ResourceNotFoundException(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.google.inject.assistedinject.Assisted;
|
||||
|
||||
/** Send notice about a change being abandoned by its owner. */
|
||||
public class AbandonedSender extends ReplyToChangeSender {
|
||||
public static interface Factory extends
|
||||
public interface Factory extends
|
||||
ReplyToChangeSender.Factory<AbandonedSender> {
|
||||
@Override
|
||||
AbandonedSender create(Project.NameKey project, Change.Id change);
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.google.inject.assistedinject.Assisted;
|
||||
|
||||
/** Asks a user to review a change. */
|
||||
public class AddReviewerSender extends NewChangeSender {
|
||||
public static interface Factory {
|
||||
public interface Factory {
|
||||
AddReviewerSender create(Project.NameKey project, Change.Id id);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ public class CommentSender extends ReplyToChangeSender {
|
||||
private static final Logger log = LoggerFactory
|
||||
.getLogger(CommentSender.class);
|
||||
|
||||
public static interface Factory {
|
||||
public interface Factory {
|
||||
CommentSender create(Project.NameKey project, Change.Id id);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class CreateChangeSender extends NewChangeSender {
|
||||
private static final Logger log =
|
||||
LoggerFactory.getLogger(CreateChangeSender.class);
|
||||
|
||||
public static interface Factory {
|
||||
public interface Factory {
|
||||
CreateChangeSender create(Project.NameKey project, Change.Id id);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.google.inject.assistedinject.Assisted;
|
||||
|
||||
/** Send notice about a vote that was removed from a change. */
|
||||
public class DeleteVoteSender extends ReplyToChangeSender {
|
||||
public static interface Factory extends
|
||||
public interface Factory extends
|
||||
ReplyToChangeSender.Factory<DeleteVoteSender> {
|
||||
@Override
|
||||
DeleteVoteSender create(Project.NameKey project, Change.Id change);
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.google.inject.assistedinject.Assisted;
|
||||
|
||||
/** Send notice about a change failing to merged. */
|
||||
public class MergeFailSender extends ReplyToChangeSender {
|
||||
public static interface Factory {
|
||||
public interface Factory {
|
||||
MergeFailSender create(Project.NameKey project, Change.Id id);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ import com.google.inject.assistedinject.Assisted;
|
||||
|
||||
/** Send notice about a change successfully merged. */
|
||||
public class MergedSender extends ReplyToChangeSender {
|
||||
public static interface Factory {
|
||||
public interface Factory {
|
||||
MergedSender create(Project.NameKey project, Change.Id id);
|
||||
}
|
||||
|
||||
|
||||
@@ -303,7 +303,7 @@ public abstract class OutgoingEmail {
|
||||
} else if (email != null) {
|
||||
return email;
|
||||
|
||||
} else /* (name == null && email == null) */{
|
||||
} else /* (name == null && email == null) */ {
|
||||
return args.anonymousCowardName + " #" + accountId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.util.Set;
|
||||
|
||||
/** Send notice of new patch sets for reviewers. */
|
||||
public class ReplacePatchSetSender extends ReplyToChangeSender {
|
||||
public static interface Factory {
|
||||
public interface Factory {
|
||||
ReplacePatchSetSender create(Project.NameKey project, Change.Id id);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import com.google.gwtorm.server.OrmException;
|
||||
|
||||
/** Alert a user to a reply to a change, usually commentary made during review. */
|
||||
public abstract class ReplyToChangeSender extends ChangeEmail {
|
||||
public static interface Factory<T extends ReplyToChangeSender> {
|
||||
public interface Factory<T extends ReplyToChangeSender> {
|
||||
T create(Project.NameKey project, Change.Id id);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.google.inject.assistedinject.Assisted;
|
||||
|
||||
/** Send notice about a change being restored by its owner. */
|
||||
public class RestoredSender extends ReplyToChangeSender {
|
||||
public static interface Factory extends
|
||||
public interface Factory extends
|
||||
ReplyToChangeSender.Factory<RestoredSender> {
|
||||
@Override
|
||||
RestoredSender create(Project.NameKey project, Change.Id id);
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.google.inject.assistedinject.Assisted;
|
||||
|
||||
/** Send notice about a change being reverted. */
|
||||
public class RevertedSender extends ReplyToChangeSender {
|
||||
public static interface Factory {
|
||||
public interface Factory {
|
||||
RevertedSender create(Project.NameKey project, Change.Id id);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public class SmtpEmailSender implements EmailSender {
|
||||
}
|
||||
}
|
||||
|
||||
public static enum Encryption {
|
||||
public enum Encryption {
|
||||
NONE, SSL, TLS
|
||||
}
|
||||
|
||||
@@ -159,10 +159,10 @@ public class SmtpEmailSender implements EmailSender {
|
||||
setMissingHeader(hdrs, "Content-Transfer-Encoding", "8bit");
|
||||
setMissingHeader(hdrs, "Content-Disposition", "inline");
|
||||
setMissingHeader(hdrs, "User-Agent", "Gerrit/" + Version.getVersion());
|
||||
if(importance != null) {
|
||||
if (importance != null) {
|
||||
setMissingHeader(hdrs, "Importance", importance);
|
||||
}
|
||||
if(expiryDays > 0) {
|
||||
if (expiryDays > 0) {
|
||||
Date expiry = new Date(TimeUtil.nowMs() +
|
||||
expiryDays * 24 * 60 * 60 * 1000L );
|
||||
setMissingHeader(hdrs, "Expiry-Date",
|
||||
|
||||
@@ -75,7 +75,7 @@ public abstract class AbstractChangeNotes<T> {
|
||||
}
|
||||
|
||||
@AutoValue
|
||||
public static abstract class LoadHandle implements AutoCloseable {
|
||||
public abstract static class LoadHandle implements AutoCloseable {
|
||||
public static LoadHandle create(RevWalk walk, ObjectId id) {
|
||||
return new AutoValue_AbstractChangeNotes_LoadHandle(
|
||||
checkNotNull(walk), id != null ? id.copy() : null);
|
||||
|
||||
@@ -447,7 +447,8 @@ public class ChangeBundle {
|
||||
checkArgument(a.getClass() == b.getClass());
|
||||
Class<?> clazz = a.getClass();
|
||||
|
||||
Timestamp ta, tb;
|
||||
Timestamp ta;
|
||||
Timestamp tb;
|
||||
try {
|
||||
Field f = clazz.getDeclaredField(field);
|
||||
checkArgument(f.getAnnotation(Column.class) != null);
|
||||
|
||||
@@ -65,7 +65,7 @@ public class ChangeDraftUpdate extends AbstractChangeUpdate {
|
||||
}
|
||||
|
||||
@AutoValue
|
||||
static abstract class Key {
|
||||
abstract static class Key {
|
||||
abstract RevId revId();
|
||||
abstract PatchLineComment.Key key();
|
||||
}
|
||||
|
||||
@@ -369,7 +369,7 @@ public class ChangeNoteUtil {
|
||||
int commentLength =
|
||||
RawParseUtils.parseBase10(note, startOfLength, i);
|
||||
int endOfLine = RawParseUtils.nextLF(note, curr.value);
|
||||
if (i.value != endOfLine-1) {
|
||||
if (i.value != endOfLine - 1) {
|
||||
throw parseException(changeId, "could not parse %s", PATCH_SET);
|
||||
}
|
||||
curr.value = endOfLine;
|
||||
|
||||
@@ -479,7 +479,7 @@ class ChangeNotesParser implements AutoCloseable {
|
||||
|
||||
int ptr = size - 1;
|
||||
int changeMessageEnd = -1;
|
||||
while(ptr > changeMessageStart) {
|
||||
while (ptr > changeMessageStart) {
|
||||
ptr = RawParseUtils.prevLF(raw, ptr, '\r');
|
||||
if (ptr == -1) {
|
||||
break;
|
||||
|
||||
@@ -49,7 +49,7 @@ public enum ReviewerStateInternal {
|
||||
private final FooterKey footerKey;
|
||||
private final ReviewerState state;
|
||||
|
||||
private ReviewerStateInternal(FooterKey footerKey, ReviewerState state) {
|
||||
ReviewerStateInternal(FooterKey footerKey, ReviewerState state) {
|
||||
this.footerKey = footerKey;
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ import java.util.List;
|
||||
public class IntraLineDiff implements Serializable {
|
||||
static final long serialVersionUID = IntraLineDiffKey.serialVersionUID;
|
||||
|
||||
public static enum Status implements CodedEnum {
|
||||
public enum Status implements CodedEnum {
|
||||
EDIT_LIST('e'), DISABLED('D'), TIMEOUT('T'), ERROR('E');
|
||||
|
||||
private final char code;
|
||||
|
||||
@@ -40,7 +40,7 @@ import java.util.regex.Pattern;
|
||||
class IntraLineLoader implements Callable<IntraLineDiff> {
|
||||
static final Logger log = LoggerFactory.getLogger(IntraLineLoader.class);
|
||||
|
||||
static interface Factory {
|
||||
interface Factory {
|
||||
IntraLineLoader create(IntraLineDiffKey key, IntraLineDiffArgs args);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@ public class IntraLineWeigher implements
|
||||
Weigher<IntraLineDiffKey, IntraLineDiff> {
|
||||
@Override
|
||||
public int weigh(IntraLineDiffKey key, IntraLineDiff value) {
|
||||
return 16 + 8*8 + 2*36 // Size of IntraLineDiffKey, 64 bit JVM
|
||||
+ 16 + 2*8 + 16+8+4+20 // Size of IntraLineDiff, 64 bit JVM
|
||||
+ (8 + 16 + 4*4) * value.getEdits().size();
|
||||
return 16 + 8 * 8 + 2 * 36 // Size of IntraLineDiffKey, 64 bit JVM
|
||||
+ 16 + 2 * 8 + 16 + 8 + 4 + 20 // Size of IntraLineDiff, 64 bit JVM
|
||||
+ (8 + 16 + 4 * 4) * value.getEdits().size();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,17 +130,17 @@ public class PatchListEntry {
|
||||
}
|
||||
|
||||
int weigh() {
|
||||
int size = 16 + 6*8 + 2*4 + 20 + 16+8+4+20;
|
||||
int size = 16 + 6 * 8 + 2 * 4 + 20 + 16 + 8 + 4 + 20;
|
||||
size += stringSize(oldName);
|
||||
size += stringSize(newName);
|
||||
size += header.length;
|
||||
size += (8 + 16 + 4*4) * edits.size();
|
||||
size += (8 + 16 + 4 * 4) * edits.size();
|
||||
return size;
|
||||
}
|
||||
|
||||
private static int stringSize(String str) {
|
||||
if (str != null) {
|
||||
return 16 + 3*4 + 16 + str.length() * 2;
|
||||
return 16 + 3 * 4 + 16 + str.length() * 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@ import com.google.common.cache.Weigher;
|
||||
public class PatchListWeigher implements Weigher<PatchListKey, PatchList> {
|
||||
@Override
|
||||
public int weigh(PatchListKey key, PatchList value) {
|
||||
int size = 16 + 4*8 + 2*36 // Size of PatchListKey, 64 bit JVM
|
||||
+ 16 + 3*8 + 3*4 + 20; // Size of PatchList, 64 bit JVM
|
||||
int size = 16 + 4 * 8 + 2 * 36 // Size of PatchListKey, 64 bit JVM
|
||||
+ 16 + 3 * 8 + 3 * 4 + 20; // Size of PatchList, 64 bit JVM
|
||||
for (PatchListEntry e : value.getPatches()) {
|
||||
size += e.weigh();
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ package com.google.gerrit.server.plugins;
|
||||
public interface HttpModuleGenerator extends ModuleGenerator {
|
||||
void export(String javascript);
|
||||
|
||||
static class NOP extends ModuleGenerator.NOP
|
||||
class NOP extends ModuleGenerator.NOP
|
||||
implements HttpModuleGenerator {
|
||||
@Override
|
||||
public void export(String javascript) {
|
||||
|
||||
@@ -27,7 +27,7 @@ public interface ModuleGenerator {
|
||||
|
||||
Module create() throws InvalidPluginException;
|
||||
|
||||
static class NOP implements ModuleGenerator {
|
||||
class NOP implements ModuleGenerator {
|
||||
|
||||
@Override
|
||||
public void setPluginName(String name) {
|
||||
|
||||
@@ -32,7 +32,7 @@ import java.util.jar.Attributes;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
public abstract class Plugin {
|
||||
public static enum ApiType {
|
||||
public enum ApiType {
|
||||
EXTENSION, PLUGIN, JS
|
||||
}
|
||||
|
||||
|
||||
@@ -472,7 +472,7 @@ public class PluginGuiceEnvironment {
|
||||
private static <T> void replace(Plugin newPlugin,
|
||||
ReloadableRegistrationHandle<T> h, Binding<T> b) {
|
||||
RegistrationHandle n = h.replace(b.getKey(), b.getProvider());
|
||||
if (n != null){
|
||||
if (n != null) {
|
||||
newPlugin.add(n);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -623,7 +623,7 @@ public class PluginLoader implements LifecycleListener {
|
||||
for (String name : pluginPaths.keys()) {
|
||||
for (Path pluginPath : pluginPaths.asMap().get(name)) {
|
||||
if (!pluginPath.getFileName().toString().endsWith(".disabled")) {
|
||||
assert(!activePlugins.containsKey(name));
|
||||
assert !activePlugins.containsKey(name);
|
||||
activePlugins.put(name, pluginPath);
|
||||
}
|
||||
}
|
||||
@@ -656,7 +656,7 @@ public class PluginLoader implements LifecycleListener {
|
||||
continue;
|
||||
}
|
||||
Path winner = Iterables.getFirst(enabled, null);
|
||||
assert(winner != null);
|
||||
assert winner != null;
|
||||
// Disable all loser plugins by renaming their file names to
|
||||
// "file.disabled" and replace the disabled files in the multimap.
|
||||
Collection<Path> elementsToRemove = Lists.newArrayList();
|
||||
|
||||
@@ -100,7 +100,7 @@ public class ServerPlugin extends Plugin {
|
||||
this.sysModule = load(sysName, classLoader);
|
||||
this.sshModule = load(sshName, classLoader);
|
||||
this.httpModule = load(httpName, classLoader);
|
||||
} catch(ClassNotFoundException e) {
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new InvalidPluginException("Unable to load plugin Guice Modules", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class CreateBranch implements RestModifyView<ProjectResource, Input> {
|
||||
public String revision;
|
||||
}
|
||||
|
||||
public static interface Factory {
|
||||
public interface Factory {
|
||||
CreateBranch create(String ref);
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ import java.util.List;
|
||||
|
||||
@RequiresCapability(GlobalCapability.CREATE_PROJECT)
|
||||
public class CreateProject implements RestModifyView<TopLevelResource, ProjectInput> {
|
||||
public static interface Factory {
|
||||
public interface Factory {
|
||||
CreateProject create(String name);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.IOException;
|
||||
|
||||
@Singleton
|
||||
public class DeleteBranch implements RestModifyView<BranchResource, Input>{
|
||||
public class DeleteBranch implements RestModifyView<BranchResource, Input> {
|
||||
private static final Logger log = LoggerFactory.getLogger(DeleteBranch.class);
|
||||
private static final int MAX_LOCK_FAILURE_CALLS = 10;
|
||||
private static final long SLEEP_ON_LOCK_FAILURE_MS = 15;
|
||||
|
||||
@@ -76,7 +76,7 @@ import java.util.TreeSet;
|
||||
public class ListProjects implements RestReadView<TopLevelResource> {
|
||||
private static final Logger log = LoggerFactory.getLogger(ListProjects.class);
|
||||
|
||||
public static enum FilterType {
|
||||
public enum FilterType {
|
||||
CODE {
|
||||
@Override
|
||||
boolean matches(Repository git) throws IOException {
|
||||
|
||||
@@ -90,7 +90,7 @@ public class SetHead implements RestModifyView<ProjectResource, Input> {
|
||||
final RefUpdate u = repo.updateRef(Constants.HEAD, true);
|
||||
u.setRefLogIdent(identifiedUser.get().newRefLogIdent());
|
||||
RefUpdate.Result res = u.link(newHead);
|
||||
switch(res) {
|
||||
switch (res) {
|
||||
case NO_CHANGE:
|
||||
case RENAMED:
|
||||
case FORCED:
|
||||
|
||||
@@ -69,7 +69,7 @@ public class OutputStreamQuery {
|
||||
private static final DateTimeFormatter dtf =
|
||||
DateTimeFormat.forPattern("yyyy-MM-dd HH:mm:ss zzz");
|
||||
|
||||
public static enum OutputFormat {
|
||||
public enum OutputFormat {
|
||||
TEXT, JSON
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ public class DataSourceProvider implements Provider<DataSource>,
|
||||
}
|
||||
}
|
||||
|
||||
public static enum Context {
|
||||
public enum Context {
|
||||
SINGLE_USER, MULTI_USER
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ public class Schema_115 extends SchemaVersion {
|
||||
RevWalk rw = new RevWalk(git)) {
|
||||
BatchRefUpdate bru = git.getRefDatabase().newBatchUpdate();
|
||||
for (Map.Entry<Account.Id, DiffPreferencesInfo> e : imports.entrySet()) {
|
||||
try(MetaDataUpdate md = new MetaDataUpdate(GitReferenceUpdated.DISABLED,
|
||||
try (MetaDataUpdate md = new MetaDataUpdate(GitReferenceUpdated.DISABLED,
|
||||
allUsersName, git, bru)) {
|
||||
md.getCommitBuilder().setAuthor(serverUser);
|
||||
md.getCommitBuilder().setCommitter(serverUser);
|
||||
|
||||
@@ -149,7 +149,7 @@ public class Schema_119 extends SchemaVersion {
|
||||
BatchRefUpdate bru = git.getRefDatabase().newBatchUpdate();
|
||||
for (Map.Entry<Account.Id, GeneralPreferencesInfo> e
|
||||
: imports.entrySet()) {
|
||||
try(MetaDataUpdate md = new MetaDataUpdate(GitReferenceUpdated.DISABLED,
|
||||
try (MetaDataUpdate md = new MetaDataUpdate(GitReferenceUpdated.DISABLED,
|
||||
allUsersName, git, bru)) {
|
||||
md.getCommitBuilder().setAuthor(serverUser);
|
||||
md.getCommitBuilder().setCommitter(serverUser);
|
||||
|
||||
@@ -55,7 +55,7 @@ public class Schema_120 extends SchemaVersion {
|
||||
try (Repository git = mgr.openRepository(subbranch.getParentKey());
|
||||
RevWalk rw = new RevWalk(git)) {
|
||||
BatchRefUpdate bru = git.getRefDatabase().newBatchUpdate();
|
||||
try(MetaDataUpdate md = new MetaDataUpdate(GitReferenceUpdated.DISABLED,
|
||||
try (MetaDataUpdate md = new MetaDataUpdate(GitReferenceUpdated.DISABLED,
|
||||
subbranch.getParentKey(), git, bru)) {
|
||||
md.setMessage("Added superproject subscription during upgrade");
|
||||
ProjectConfig pc = ProjectConfig.read(md);
|
||||
|
||||
@@ -135,7 +135,7 @@ public class ToolsCatalog {
|
||||
|
||||
/** A file served out of the tools root directory. */
|
||||
public static class Entry {
|
||||
public static enum Type {
|
||||
public enum Type {
|
||||
DIR, FILE
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public final class MostSpecificComparator implements
|
||||
cmp = -1;
|
||||
} else if (!p1_finite && p2_finite) {
|
||||
cmp = 1;
|
||||
} else /* if (f1 == f2) */{
|
||||
} else /* if (f1 == f2) */ {
|
||||
cmp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import java.util.SortedSet;
|
||||
|
||||
public class TreeFormatter {
|
||||
|
||||
public static interface TreeNode {
|
||||
public interface TreeNode {
|
||||
String getDisplayName();
|
||||
boolean isVisible();
|
||||
SortedSet<? extends TreeNode> getChildren();
|
||||
|
||||
@@ -48,13 +48,13 @@ public class PRED_commit_stats_3 extends Predicate.P3 {
|
||||
Term a3 = arg3.dereference();
|
||||
|
||||
PatchList pl = StoredValues.PATCH_LIST.get(engine);
|
||||
if(!a1.unify(new IntegerTerm(pl.getPatches().size() -1),engine.trail)) { //Account for /COMMIT_MSG.
|
||||
if (!a1.unify(new IntegerTerm(pl.getPatches().size() - 1),engine.trail)) { //Account for /COMMIT_MSG.
|
||||
return engine.fail();
|
||||
}
|
||||
if(!a2.unify(new IntegerTerm(pl.getInsertions()),engine.trail)) {
|
||||
if (!a2.unify(new IntegerTerm(pl.getInsertions()),engine.trail)) {
|
||||
return engine.fail();
|
||||
}
|
||||
if(!a3.unify(new IntegerTerm(pl.getDeletions()),engine.trail)) {
|
||||
if (!a3.unify(new IntegerTerm(pl.getDeletions()),engine.trail)) {
|
||||
return engine.fail();
|
||||
}
|
||||
return cont;
|
||||
|
||||
Reference in New Issue
Block a user