diff options
author | David Pursehouse <david.pursehouse@gmail.com> | 2017-02-20 13:17:27 +0900 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2017-02-20 22:47:23 +0100 |
commit | 3b4448637fbb9d74e0c9d44048ba76bb7c1214ce (patch) | |
tree | 85bbb116d5b0336cb365a3f5a4d6c074afe80cc6 /org.eclipse.jgit.pgm/src/org | |
parent | 43eb8511f5d8225c0b4e2f899db2126334e5facf (diff) | |
download | jgit-3b4448637fbb9d74e0c9d44048ba76bb7c1214ce.tar.gz jgit-3b4448637fbb9d74e0c9d44048ba76bb7c1214ce.zip |
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 <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.pgm/src/org')
23 files changed, 51 insertions, 51 deletions
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<String> filepatterns = new ArrayList<String>(); + private List<String> 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<RevCommit> reverseRange = new ArrayList<RevCommit>(2); + private List<RevCommit> 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<RevCommit, String> abbreviatedCommits = new HashMap<RevCommit, String>(); + private final Map<RevCommit, String> abbreviatedCommits = new HashMap<>(); private SimpleDateFormat dateFmt; @@ -163,7 +163,7 @@ class Blame extends TextBuiltin { if (!reverseRange.isEmpty()) { RevCommit rangeStart = null; - List<RevCommit> rangeEnd = new ArrayList<RevCommit>(2); + List<RevCommit> 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<String, Ref> printRefs = new LinkedHashMap<String, Ref>(); + private final Map<String, Ref> 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<String> paths = new ArrayList<String>(); + private List<String> 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<CommandRef> common = new ArrayList<CommandRef>(); + final ArrayList<CommandRef> 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<String, CommandRef>(); + commands = new HashMap<>(); final Enumeration<URL> 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<String> paths = new ArrayList<String>(); + private List<String> 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<String> enable = new ArrayList<String>(); + final List<String> enable = new ArrayList<>(); @Option(name = "--disable", metaVar = "metaVar_service", usage = "usage_disableTheServiceInAllRepositories", multiValued = true) - final List<String> disable = new ArrayList<String>(); + final List<String> disable = new ArrayList<>(); @Option(name = "--allow-override", metaVar = "metaVar_service", usage = "usage_configureTheServiceInDaemonServicename", multiValued = true) - final List<String> canOverride = new ArrayList<String>(); + final List<String> canOverride = new ArrayList<>(); @Option(name = "--forbid-override", metaVar = "metaVar_service", usage = "usage_configureTheServiceInDaemonServicename", multiValued = true) - final List<String> forbidOverride = new ArrayList<String>(); + final List<String> 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<File> directory = new ArrayList<File>(); + final List<File> 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<DaemonClient> resolver = new FileResolver<DaemonClient>(); + final FileResolver<DaemonClient> 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<AbstractTreeIterator> trees = new ArrayList<AbstractTreeIterator>(); + private final List<AbstractTreeIterator> 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<String> additionalNoteRefs = new ArrayList<String>(); + private List<String> 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<String, NoteMap>(); + 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<Ref> refs = new TreeSet<Ref>(new Comparator<Ref>() { + TreeSet<Ref> refs = new TreeSet<>(new Comparator<Ref>() { @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<String> paths = new ArrayList<String>(); + private List<String> 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<String> arguments = new ArrayList<String>(); + private List<String> 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<RevCommit> commits = new ArrayList<RevCommit>(); + private final List<RevCommit> 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<RefSpec> refSpecs = new ArrayList<RefSpec>(); + private final List<RefSpec> 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<ObjectId> commits = new ArrayList<ObjectId>(); + private final List<ObjectId> 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<RevCommit> commits = new ArrayList<RevCommit>(); + private final List<RevCommit> commits = new ArrayList<>(); @Option(name = "--", metaVar = "metaVar_path", multiValued = true, handler = PathTreeFilterHandler.class) protected TreeFilter pathFilter = TreeFilter.ALL; - private final List<RevFilter> revLimiter = new ArrayList<RevFilter>(); + private final List<RevFilter> 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<String> paths = new ArrayList<String>(); + private List<String> 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<String, StageState> conflicting = status.getConflictingStageState(); // build a sorted list of all paths except untracked and ignored - TreeSet<String> sorted = new TreeSet<String>(); + TreeSet<String> 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<String> untracked = new TreeSet<String>( + TreeSet<String> untracked = new TreeSet<>( status.getUntracked()); for (String path : untracked) printPorcelainLine('?', '?', path); @@ -221,7 +221,7 @@ class Status extends TextBuiltin { Collection<String> untracked = status.getUntracked(); Map<String, StageState> unmergedStates = status .getConflictingStageState(); - Collection<String> toBeCommitted = new ArrayList<String>(added); + Collection<String> 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<String> notStagedForCommit = new ArrayList<String>(modified); + Collection<String> 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<String> list) throws IOException { if (!list.isEmpty()) { - List<String> sortedList = new ArrayList<String>(list); + List<String> 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<String> set2, @SuppressWarnings("unused") Collection<String> set3) throws IOException { - List<String> sortedList = new ArrayList<String>(list); + List<String> 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<String, StageState> unmergedStates) throws IOException { - List<String> paths = new ArrayList<String>(unmergedStates.keySet()); + List<String> 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<String> algorithms = new ArrayList<String>(); + List<String> 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<File> gitDirs = new ArrayList<File>(); + List<File> 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<Test> init() { - List<Test> all = new ArrayList<Test>(); + List<Test> 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<ObjectId, ObjectId> rewrites = new HashMap<ObjectId, ObjectId>(); + private Map<ObjectId, ObjectId> rewrites = new HashMap<>(); @Override protected void run() throws Exception { @@ -137,8 +137,8 @@ class RebuildCommitGraph extends TextBuiltin { } private void recreateCommitGraph() throws IOException { - final Map<ObjectId, ToRewrite> toRewrite = new HashMap<ObjectId, ToRewrite>(); - List<ToRewrite> queue = new ArrayList<ToRewrite>(); + final Map<ObjectId, ToRewrite> toRewrite = new HashMap<>(); + List<ToRewrite> 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<ToRewrite> itr = queue .listIterator(queue.size()); - queue = new ArrayList<ToRewrite>(); + 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<String, Ref> computeNewRefs() throws IOException { - final Map<String, Ref> refs = new HashMap<String, Ref>(); + final Map<String, Ref> 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<String> hashFunctions = new ArrayList<String>(); + List<String> hashFunctions = new ArrayList<>(); @Option(name = "--fold", multiValued = true, metaVar = "NAME", usage = "Enable fold function(s)") - List<String> foldFunctions = new ArrayList<String>(); + List<String> 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<File> gitDirs = new ArrayList<File>(); + List<File> 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<Line> u = new HashSet<Line>(); + HashSet<Line> 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<Function> init() { - List<Hash> hashes = new ArrayList<Hash>(); - List<Fold> folds = new ArrayList<Fold>(); + List<Hash> hashes = new ArrayList<>(); + List<Fold> 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<Function> all = new ArrayList<Function>(); + List<Function> 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<String> tmp = new ArrayList<String>(args.length); + final ArrayList<String> 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<TreeFilter> { @Override public int parseArguments(final Parameters params) throws CmdLineException { - final List<PathFilter> filters = new ArrayList<PathFilter>(); + final List<PathFilter> filters = new ArrayList<>(); for (int idx = 0;; idx++) { final String path; try { |