From 3b4448637fbb9d74e0c9d44048ba76bb7c1214ce Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Mon, 20 Feb 2017 13:17:27 +0900 Subject: Enable and fix warnings about redundant specification of type arguments Since the introduction of generic type parameter inference in Java 7, it's not necessary to explicitly specify the type of generic parameters. Enable the warning in Eclipse, and fix all occurrences. Change-Id: I9158caf1beca5e4980b6240ac401f3868520aad0 Signed-off-by: David Pursehouse --- org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Add.java | 2 +- org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java | 6 +++--- org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java | 2 +- .../src/org/eclipse/jgit/pgm/Checkout.java | 2 +- .../src/org/eclipse/jgit/pgm/CommandCatalog.java | 4 ++-- org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java | 2 +- org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java | 12 ++++++------ .../src/org/eclipse/jgit/pgm/DiffTree.java | 2 +- org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java | 4 ++-- .../src/org/eclipse/jgit/pgm/LsRemote.java | 2 +- org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java | 2 +- org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java | 2 +- .../src/org/eclipse/jgit/pgm/MergeBase.java | 2 +- org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java | 2 +- .../src/org/eclipse/jgit/pgm/RevParse.java | 2 +- .../src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java | 4 ++-- org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java | 2 +- org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java | 14 +++++++------- .../src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java | 6 +++--- .../src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java | 10 +++++----- .../src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java | 14 +++++++------- .../src/org/eclipse/jgit/pgm/opt/CmdLineParser.java | 2 +- .../org/eclipse/jgit/pgm/opt/PathTreeFilterHandler.java | 2 +- 23 files changed, 51 insertions(+), 51 deletions(-) (limited to 'org.eclipse.jgit.pgm/src/org/eclipse/jgit') diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Add.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Add.java index c36c485197..3c13590307 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Add.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Add.java @@ -58,7 +58,7 @@ class Add extends TextBuiltin { private boolean update = false; @Argument(required = true, metaVar = "metaVar_filepattern", usage = "usage_filesToAddContentFrom") - private List filepatterns = new ArrayList(); + private List filepatterns = new ArrayList<>(); @Override protected void run() throws Exception { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java index 0f541715ab..419325405f 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java @@ -114,7 +114,7 @@ class Blame extends TextBuiltin { private String rangeString; @Option(name = "--reverse", metaVar = "metaVar_blameReverse", usage = "usage_blameReverse") - private List reverseRange = new ArrayList(2); + private List reverseRange = new ArrayList<>(2); @Argument(index = 0, required = false, metaVar = "metaVar_revision") private String revision; @@ -124,7 +124,7 @@ class Blame extends TextBuiltin { private ObjectReader reader; - private final Map abbreviatedCommits = new HashMap(); + private final Map abbreviatedCommits = new HashMap<>(); private SimpleDateFormat dateFmt; @@ -163,7 +163,7 @@ class Blame extends TextBuiltin { if (!reverseRange.isEmpty()) { RevCommit rangeStart = null; - List rangeEnd = new ArrayList(2); + List rangeEnd = new ArrayList<>(2); for (RevCommit c : reverseRange) { if (c.has(RevFlag.UNINTERESTING)) rangeStart = c; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java index 5f3740cbba..f6e3810a86 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java @@ -149,7 +149,7 @@ class Branch extends TextBuiltin { @Argument(metaVar = "metaVar_name") private String branch; - private final Map printRefs = new LinkedHashMap(); + private final Map printRefs = new LinkedHashMap<>(); /** Only set for verbose branch listing at-the-moment */ private RevWalk rw; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java index 0c3b720fb6..c2f3c4675a 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java @@ -78,7 +78,7 @@ class Checkout extends TextBuiltin { private String name; @Option(name = "--", metaVar = "metaVar_paths", multiValued = true, handler = RestOfArgumentsHandler.class) - private List paths = new ArrayList(); + private List paths = new ArrayList<>(); @Override protected void run() throws Exception { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java index 99ba3b4b48..cf4c6e3339 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java @@ -100,7 +100,7 @@ public class CommandCatalog { * @return all common commands, sorted by command name. */ public static CommandRef[] common() { - final ArrayList common = new ArrayList(); + final ArrayList common = new ArrayList<>(); for (final CommandRef c : INSTANCE.commands.values()) if (c.isCommon()) common.add(c); @@ -124,7 +124,7 @@ public class CommandCatalog { private CommandCatalog() { ldr = Thread.currentThread().getContextClassLoader(); - commands = new HashMap(); + commands = new HashMap<>(); final Enumeration catalogs = catalogs(); while (catalogs.hasMoreElements()) diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java index 2cfbd86fa3..befc4ec272 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java @@ -75,7 +75,7 @@ class Commit extends TextBuiltin { private boolean amend; @Argument(metaVar = "metaVar_commitPaths", usage = "usage_CommitPaths") - private List paths = new ArrayList(); + private List paths = new ArrayList<>(); @Override protected void run() throws NoHeadException, NoMessageException, diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java index a7bdde9f66..1008593be3 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java @@ -87,16 +87,16 @@ class Daemon extends TextBuiltin { int timeout = -1; @Option(name = "--enable", metaVar = "metaVar_service", usage = "usage_enableTheServiceInAllRepositories", multiValued = true) - final List enable = new ArrayList(); + final List enable = new ArrayList<>(); @Option(name = "--disable", metaVar = "metaVar_service", usage = "usage_disableTheServiceInAllRepositories", multiValued = true) - final List disable = new ArrayList(); + final List disable = new ArrayList<>(); @Option(name = "--allow-override", metaVar = "metaVar_service", usage = "usage_configureTheServiceInDaemonServicename", multiValued = true) - final List canOverride = new ArrayList(); + final List canOverride = new ArrayList<>(); @Option(name = "--forbid-override", metaVar = "metaVar_service", usage = "usage_configureTheServiceInDaemonServicename", multiValued = true) - final List forbidOverride = new ArrayList(); + final List forbidOverride = new ArrayList<>(); @Option(name = "--export-all", usage = "usage_exportWithoutGitDaemonExportOk") boolean exportAll; @@ -109,7 +109,7 @@ class Daemon extends TextBuiltin { } @Argument(required = true, metaVar = "metaVar_directory", usage = "usage_directoriesToExport") - final List directory = new ArrayList(); + final List directory = new ArrayList<>(); @Override protected boolean requiresRepository() { @@ -139,7 +139,7 @@ class Daemon extends TextBuiltin { if (1 < threads) packConfig.setExecutor(Executors.newFixedThreadPool(threads)); - final FileResolver resolver = new FileResolver(); + final FileResolver resolver = new FileResolver<>(); for (final File f : directory) { outw.println(MessageFormat.format(CLIText.get().exporting, f.getAbsolutePath())); resolver.exportDirectory(f); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java index 95c2132435..56b62418c0 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java @@ -67,7 +67,7 @@ class DiffTree extends TextBuiltin { } @Argument(index = 1, metaVar = "metaVar_treeish", required = true) - private final List trees = new ArrayList(); + private final List trees = new ArrayList<>(); @Option(name = "--", metaVar = "metaVar_path", multiValued = true, handler = PathTreeFilterHandler.class) private TreeFilter pathFilter = TreeFilter.ALL; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java index 82c401ff86..1108ddd10b 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java @@ -94,7 +94,7 @@ class Log extends RevWalkTextBuiltin { @Option(name = "--no-standard-notes", usage = "usage_noShowStandardNotes") private boolean noStandardNotes; - private List additionalNoteRefs = new ArrayList(); + private List additionalNoteRefs = new ArrayList<>(); @Option(name = "--show-notes", usage = "usage_showNotes", metaVar = "metaVar_ref") void addAdditionalNoteRef(String notesRef) { @@ -204,7 +204,7 @@ class Log extends RevWalkTextBuiltin { if (!noStandardNotes || !additionalNoteRefs.isEmpty()) { createWalk(); - noteMaps = new LinkedHashMap(); + noteMaps = new LinkedHashMap<>(); if (!noStandardNotes) { addNoteMap(Constants.R_NOTES_COMMITS); } diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java index f35d4fdba8..7a5f3d8116 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java @@ -74,7 +74,7 @@ class LsRemote extends TextBuiltin { protected void run() throws Exception { LsRemoteCommand command = Git.lsRemoteRepository().setRemote(remote) .setTimeout(timeout).setHeads(heads).setTags(tags); - TreeSet refs = new TreeSet(new Comparator() { + TreeSet refs = new TreeSet<>(new Comparator() { @Override public int compare(Ref r1, Ref r2) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java index 872ea67774..02d61e53e2 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java @@ -68,7 +68,7 @@ class LsTree extends TextBuiltin { @Argument(index = 1) @Option(name = "--", metaVar = "metaVar_paths", multiValued = true, handler = StopOptionHandler.class) - private List paths = new ArrayList(); + private List paths = new ArrayList<>(); @Override protected void run() throws Exception { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java index 7d111ffccb..3addecb2f9 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java @@ -91,7 +91,7 @@ public class Main { private TextBuiltin subcommand; @Argument(index = 1, metaVar = "metaVar_arg") - private List arguments = new ArrayList(); + private List arguments = new ArrayList<>(); PrintWriter writer; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeBase.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeBase.java index 9dcd5129b6..f8bae1d8be 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeBase.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeBase.java @@ -63,7 +63,7 @@ class MergeBase extends TextBuiltin { } @Argument(index = 1, metaVar = "metaVar_commitish", required = true) - private final List commits = new ArrayList(); + private final List commits = new ArrayList<>(); @Override protected void run() throws Exception { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java index 98af186b2f..1b805d16fc 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java @@ -77,7 +77,7 @@ class Push extends TextBuiltin { private String remote = Constants.DEFAULT_REMOTE_NAME; @Argument(index = 1, metaVar = "metaVar_refspec") - private final List refSpecs = new ArrayList(); + private final List refSpecs = new ArrayList<>(); @Option(name = "--all") private boolean all; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java index 6833ad3c05..a66b7fa639 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java @@ -68,7 +68,7 @@ class RevParse extends TextBuiltin { boolean verify; @Argument(index = 0, metaVar = "metaVar_commitish") - private final List commits = new ArrayList(); + private final List commits = new ArrayList<>(); @Override protected void run() throws Exception { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java index 1543586802..74135e4bae 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java @@ -124,12 +124,12 @@ abstract class RevWalkTextBuiltin extends TextBuiltin { private String followPath; @Argument(index = 0, metaVar = "metaVar_commitish") - private final List commits = new ArrayList(); + private final List commits = new ArrayList<>(); @Option(name = "--", metaVar = "metaVar_path", multiValued = true, handler = PathTreeFilterHandler.class) protected TreeFilter pathFilter = TreeFilter.ALL; - private final List revLimiter = new ArrayList(); + private final List revLimiter = new ArrayList<>(); @Option(name = "--author") void addAuthorRevFilter(final String who) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java index f4f864b397..79c3f094e8 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java @@ -58,7 +58,7 @@ class Rm extends TextBuiltin { @Argument(metaVar = "metaVar_path", usage = "usage_path", multiValued = true, required = true) @Option(name = "--", handler = StopOptionHandler.class) - private List paths = new ArrayList(); + private List paths = new ArrayList<>(); @Override diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java index 43b292e39c..b7f5e58285 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java @@ -117,7 +117,7 @@ class Status extends TextBuiltin { Map conflicting = status.getConflictingStageState(); // build a sorted list of all paths except untracked and ignored - TreeSet sorted = new TreeSet(); + TreeSet sorted = new TreeSet<>(); sorted.addAll(added); sorted.addAll(changed); sorted.addAll(removed); @@ -185,7 +185,7 @@ class Status extends TextBuiltin { // untracked are always at the end of the list if ("all".equals(untrackedFilesMode)) { //$NON-NLS-1$ - TreeSet untracked = new TreeSet( + TreeSet untracked = new TreeSet<>( status.getUntracked()); for (String path : untracked) printPorcelainLine('?', '?', path); @@ -221,7 +221,7 @@ class Status extends TextBuiltin { Collection untracked = status.getUntracked(); Map unmergedStates = status .getConflictingStageState(); - Collection toBeCommitted = new ArrayList(added); + Collection toBeCommitted = new ArrayList<>(added); toBeCommitted.addAll(changed); toBeCommitted.addAll(removed); int nbToBeCommitted = toBeCommitted.size(); @@ -232,7 +232,7 @@ class Status extends TextBuiltin { toBeCommitted, added, changed, removed); firstHeader = false; } - Collection notStagedForCommit = new ArrayList(modified); + Collection notStagedForCommit = new ArrayList<>(modified); notStagedForCommit.addAll(missing); int nbNotStagedForCommit = notStagedForCommit.size(); if (nbNotStagedForCommit > 0) { @@ -274,7 +274,7 @@ class Status extends TextBuiltin { protected int printList(Collection list) throws IOException { if (!list.isEmpty()) { - List sortedList = new ArrayList(list); + List sortedList = new ArrayList<>(list); java.util.Collections.sort(sortedList); for (String filename : sortedList) { outw.println(CLIText.formatLine(String.format( @@ -291,7 +291,7 @@ class Status extends TextBuiltin { Collection set2, @SuppressWarnings("unused") Collection set3) throws IOException { - List sortedList = new ArrayList(list); + List sortedList = new ArrayList<>(list); java.util.Collections.sort(sortedList); for (String filename : sortedList) { String prefix; @@ -311,7 +311,7 @@ class Status extends TextBuiltin { private void printUnmerged(Map unmergedStates) throws IOException { - List paths = new ArrayList(unmergedStates.keySet()); + List paths = new ArrayList<>(unmergedStates.keySet()); Collections.sort(paths); for (String path : paths) { StageState state = unmergedStates.get(path); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java index f8dd461877..44ec3f413c 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java @@ -115,13 +115,13 @@ class DiffAlgorithms extends TextBuiltin { // @Option(name = "--algorithm", multiValued = true, metaVar = "NAME", usage = "Enable algorithm(s)") - List algorithms = new ArrayList(); + List algorithms = new ArrayList<>(); @Option(name = "--text-limit", metaVar = "LIMIT", usage = "Maximum size in KiB to scan per file revision") int textLimit = 15 * 1024; // 15 MiB as later we do * 1024. @Option(name = "--repository", aliases = { "-r" }, multiValued = true, metaVar = "GIT_DIR", usage = "Repository to scan") - List gitDirs = new ArrayList(); + List gitDirs = new ArrayList<>(); @Option(name = "--count", metaVar = "LIMIT", usage = "Number of file revisions to be compared") int count = 0; // unlimited @@ -324,7 +324,7 @@ class DiffAlgorithms extends TextBuiltin { } private List init() { - List all = new ArrayList(); + List all = new ArrayList<>(); try { for (Field f : DiffAlgorithms.class.getDeclaredFields()) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java index 8cfcba9113..da602d0b89 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java @@ -112,7 +112,7 @@ class RebuildCommitGraph extends TextBuiltin { private final ProgressMonitor pm = new TextProgressMonitor(errw); - private Map rewrites = new HashMap(); + private Map rewrites = new HashMap<>(); @Override protected void run() throws Exception { @@ -137,8 +137,8 @@ class RebuildCommitGraph extends TextBuiltin { } private void recreateCommitGraph() throws IOException { - final Map toRewrite = new HashMap(); - List queue = new ArrayList(); + final Map toRewrite = new HashMap<>(); + List queue = new ArrayList<>(); try (RevWalk rw = new RevWalk(db); final BufferedReader br = new BufferedReader( new InputStreamReader(new FileInputStream(graph), @@ -176,7 +176,7 @@ class RebuildCommitGraph extends TextBuiltin { while (!queue.isEmpty()) { final ListIterator itr = queue .listIterator(queue.size()); - queue = new ArrayList(); + queue = new ArrayList<>(); REWRITE: while (itr.hasPrevious()) { final ToRewrite t = itr.previous(); final ObjectId[] newParents = new ObjectId[t.oldParents.length]; @@ -278,7 +278,7 @@ class RebuildCommitGraph extends TextBuiltin { } private Map computeNewRefs() throws IOException { - final Map refs = new HashMap(); + final Map refs = new HashMap<>(); try (RevWalk rw = new RevWalk(db); BufferedReader br = new BufferedReader( new InputStreamReader(new FileInputStream(refList), diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java index 28d92aeca1..0eb4e05c55 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java @@ -251,16 +251,16 @@ class TextHashFunctions extends TextBuiltin { // @Option(name = "--hash", multiValued = true, metaVar = "NAME", usage = "Enable hash function(s)") - List hashFunctions = new ArrayList(); + List hashFunctions = new ArrayList<>(); @Option(name = "--fold", multiValued = true, metaVar = "NAME", usage = "Enable fold function(s)") - List foldFunctions = new ArrayList(); + List foldFunctions = new ArrayList<>(); @Option(name = "--text-limit", metaVar = "LIMIT", usage = "Maximum size in KiB to scan") int textLimit = 15 * 1024; // 15 MiB as later we do * 1024. @Option(name = "--repository", aliases = { "-r" }, multiValued = true, metaVar = "GIT_DIR", usage = "Repository to scan") - List gitDirs = new ArrayList(); + List gitDirs = new ArrayList<>(); @Override protected boolean requiresRepository() { @@ -327,7 +327,7 @@ class TextHashFunctions extends TextBuiltin { RawText txt = new RawText(raw); int[] lines = new int[txt.size()]; int cnt = 0; - HashSet u = new HashSet(); + HashSet u = new HashSet<>(); for (int i = 0; i < txt.size(); i++) { if (u.add(new Line(txt, i))) lines[cnt++] = i; @@ -386,8 +386,8 @@ class TextHashFunctions extends TextBuiltin { } private List init() { - List hashes = new ArrayList(); - List folds = new ArrayList(); + List hashes = new ArrayList<>(); + List folds = new ArrayList<>(); try { for (Field f : TextHashFunctions.class.getDeclaredFields()) { @@ -410,7 +410,7 @@ class TextHashFunctions extends TextBuiltin { throw new RuntimeException("Cannot determine names", e); //$NON-NLS-1$ } - List all = new ArrayList(); + List all = new ArrayList<>(); for (Hash cmp : hashes) { if (include(cmp.name, hashFunctions)) { for (Fold f : folds) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java index b531ba65a4..020b62580f 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java @@ -141,7 +141,7 @@ public class CmdLineParser extends org.kohsuke.args4j.CmdLineParser { @Override public void parseArgument(final String... args) throws CmdLineException { - final ArrayList tmp = new ArrayList(args.length); + final ArrayList tmp = new ArrayList<>(args.length); for (int argi = 0; argi < args.length; argi++) { final String str = args[argi]; if (str.equals("--")) { //$NON-NLS-1$ diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/PathTreeFilterHandler.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/PathTreeFilterHandler.java index e468023448..b873c3dc2c 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/PathTreeFilterHandler.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/PathTreeFilterHandler.java @@ -81,7 +81,7 @@ public class PathTreeFilterHandler extends OptionHandler { @Override public int parseArguments(final Parameters params) throws CmdLineException { - final List filters = new ArrayList(); + final List filters = new ArrayList<>(); for (int idx = 0;; idx++) { final String path; try { -- cgit v1.2.3