diff options
author | Han-Wen Nienhuys <hanwen@google.com> | 2018-05-16 16:34:16 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2018-05-18 17:59:45 +0200 |
commit | f3ec7cf3f0436a79e252251a31dbc62694555897 (patch) | |
tree | 49a647fa520bb5a1016425df26357947f8dab95c /org.eclipse.jgit.test/exttst/org | |
parent | 667e30678a6bad26f4d4d412e996b293e52e5b87 (diff) | |
download | jgit-f3ec7cf3f0436a79e252251a31dbc62694555897.tar.gz jgit-f3ec7cf3f0436a79e252251a31dbc62694555897.zip |
Remove further unnecessary 'final' keywords
Remove it from
* package private functions.
* try blocks
* for loops
this was done with the following python script:
$ cat f.py
import sys
import re
import os
def replaceFinal(m):
return m.group(1) + "(" + m.group(2).replace('final ', '') + ")"
methodDecl = re.compile(r"^([\t ]*[a-zA-Z_ ]+)\(([^)]*)\)")
def subst(fn):
input = open(fn)
os.rename(fn, fn + "~")
dest = open(fn, 'w')
for l in input:
l = methodDecl.sub(replaceFinal, l)
dest.write(l)
dest.close()
for root, dirs, files in os.walk(".", topdown=False):
for f in files:
if not f.endswith('.java'):
continue
full = os.path.join(root, f)
print full
subst(full)
Change-Id: If533a75a417594fc893e7c669d2c1f0f6caeb7ca
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
Diffstat (limited to 'org.eclipse.jgit.test/exttst/org')
-rw-r--r-- | org.eclipse.jgit.test/exttst/org/eclipse/jgit/patch/EGitPatchHistoryTest.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/org.eclipse.jgit.test/exttst/org/eclipse/jgit/patch/EGitPatchHistoryTest.java b/org.eclipse.jgit.test/exttst/org/eclipse/jgit/patch/EGitPatchHistoryTest.java index f26952ea76..79d8d0e10b 100644 --- a/org.eclipse.jgit.test/exttst/org/eclipse/jgit/patch/EGitPatchHistoryTest.java +++ b/org.eclipse.jgit.test/exttst/org/eclipse/jgit/patch/EGitPatchHistoryTest.java @@ -85,7 +85,7 @@ public class EGitPatchHistoryTest { int errors; - PatchReader(final HashMap<String, HashMap<String, StatInfo>> s) + PatchReader(HashMap<String, HashMap<String, StatInfo>> s) throws IOException { super(new String[] { "-p" }); stats = s; @@ -103,7 +103,7 @@ public class EGitPatchHistoryTest { p.parse(buf, 0, buf.length - 1); assertEquals("File count " + cid, files.size(), p.getFiles().size()); if (!p.getErrors().isEmpty()) { - for (final FormatError e : p.getErrors()) { + for (FormatError e : p.getErrors()) { System.out.println("error " + e.getMessage()); System.out.println(" at " + e.getLineText()); } @@ -111,7 +111,7 @@ public class EGitPatchHistoryTest { fail("Unexpected error in " + cid); } - for (final FileHeader fh : p.getFiles()) { + for (FileHeader fh : p.getFiles()) { final String fileName; if (fh.getChangeType() != FileHeader.ChangeType.DELETE) fileName = fh.getNewPath(); @@ -121,7 +121,7 @@ public class EGitPatchHistoryTest { final String nid = fileName + " in " + cid; assertNotNull("No " + nid, s); int added = 0, deleted = 0; - for (final HunkHeader h : fh.getHunks()) { + for (HunkHeader h : fh.getHunks()) { added += h.getOldImage().getLinesAdded(); deleted += h.getOldImage().getLinesDeleted(); } @@ -188,7 +188,7 @@ public class EGitPatchHistoryTest { static abstract class CommitReader { private Process proc; - CommitReader(final String[] args) throws IOException { + CommitReader(String[] args) throws IOException { final String[] realArgs = new String[3 + args.length + 1]; realArgs[0] = "git"; realArgs[1] = "log"; |