From 45351acfd6dee584a7df3f0de2196d6504701ec3 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 13 Jun 2017 17:10:25 +0200 Subject: [PATCH] Remove superfluous final in gerrit/server/patch/ Change-Id: I3d83aa5d8a32a35157afacf8387e5b082719817f --- .../gerrit/server/patch/AutoMerger.java | 2 +- .../gerrit/server/patch/DiffSummaryKey.java | 6 ++-- .../gerrit/server/patch/IntraLineDiff.java | 4 +-- .../google/gerrit/server/patch/PatchFile.java | 6 ++-- .../google/gerrit/server/patch/PatchList.java | 12 ++++---- .../gerrit/server/patch/PatchListEntry.java | 10 +++---- .../gerrit/server/patch/PatchListKey.java | 6 ++-- .../server/patch/PatchScriptBuilder.java | 28 +++++++++---------- .../server/patch/PatchScriptFactory.java | 14 +++++----- .../server/patch/PatchSetInfoFactory.java | 4 +-- .../com/google/gerrit/server/patch/Text.java | 4 +-- 11 files changed, 48 insertions(+), 48 deletions(-) diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/patch/AutoMerger.java b/gerrit-server/src/main/java/com/google/gerrit/server/patch/AutoMerger.java index 74a313219a..19568cf249 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/patch/AutoMerger.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/patch/AutoMerger.java @@ -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 { diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/patch/DiffSummaryKey.java b/gerrit-server/src/main/java/com/google/gerrit/server/patch/DiffSummaryKey.java index bfa7ec3de1..8ce4dd33fe 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/patch/DiffSummaryKey.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/patch/DiffSummaryKey.java @@ -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); diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/patch/IntraLineDiff.java b/gerrit-server/src/main/java/com/google/gerrit/server/patch/IntraLineDiff.java index 87fdd2ae43..ee8b88b7f4 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/patch/IntraLineDiff.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/patch/IntraLineDiff.java @@ -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]; diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchFile.java b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchFile.java index b4c2fbe23f..aff519abfa 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchFile.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchFile.java @@ -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) { diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchList.java b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchList.java index 020c354d3e..673cb64b99 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchList.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchList.java @@ -49,7 +49,7 @@ public class PatchList implements Serializable { private static final Comparator PATCH_CMP = new Comparator() { @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 toPatchList(final PatchSet.Id setId) { + public List toPatchList(PatchSet.Id setId) { final ArrayList 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); diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListEntry.java b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListEntry.java index c1e45bdf8b..46d41bcfa3 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListEntry.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListEntry.java @@ -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()) { diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListKey.java b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListKey.java index a459c98b67..6fbdd482c7 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListKey.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchListKey.java @@ -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); diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchScriptBuilder.java b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchScriptBuilder.java index 803ccec849..ad8ad6f54c 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchScriptBuilder.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchScriptBuilder.java @@ -56,7 +56,7 @@ class PatchScriptBuilder { private static final Comparator EDIT_SORT = new Comparator() { @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 history) + PatchListEntry content, CommentDetail comments, List history) throws IOException { reader = db.newObjectReader(); try { @@ -124,7 +124,7 @@ class PatchScriptBuilder { } private PatchScript build( - final PatchListEntry content, final CommentDetail comments, final List history) + PatchListEntry content, CommentDetail comments, List 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 empty, final Edit toAdd) { + private void safeAdd(List 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) { diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchScriptFactory.java b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchScriptFactory.java index 9e80f385bb..84a080afea 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchScriptFactory.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchScriptFactory.java @@ -114,9 +114,9 @@ public class PatchScriptFactory implements Callable { 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 { } } - 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 { 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 { diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchSetInfoFactory.java b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchSetInfoFactory.java index 3fc6ba675c..cd9c4c37f3 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchSetInfoFactory.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/patch/PatchSetInfoFactory.java @@ -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 toParentInfos(final RevCommit[] parents, final RevWalk walk) + private List toParentInfos(RevCommit[] parents, RevWalk walk) throws IOException, MissingObjectException { List pInfos = new ArrayList<>(parents.length); for (RevCommit parent : parents) { diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/patch/Text.java b/gerrit-server/src/main/java/com/google/gerrit/server/patch/Text.java index f0015916b5..9014171598 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/patch/Text.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/patch/Text.java @@ -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); }