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 --- .../src/org/eclipse/jgit/merge/MergeAlgorithm.java | 4 ++-- .../src/org/eclipse/jgit/merge/MergeFormatter.java | 2 +- .../src/org/eclipse/jgit/merge/MergeMessageFormatter.java | 12 ++++++------ .../src/org/eclipse/jgit/merge/MergeStrategy.java | 2 +- .../src/org/eclipse/jgit/merge/RecursiveMerger.java | 4 ++-- .../src/org/eclipse/jgit/merge/ResolveMerger.java | 14 +++++++------- 6 files changed, 19 insertions(+), 19 deletions(-) (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/merge') diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeAlgorithm.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeAlgorithm.java index 112550a1de..04c65effb8 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeAlgorithm.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeAlgorithm.java @@ -98,11 +98,11 @@ public final class MergeAlgorithm { */ public MergeResult merge( SequenceComparator cmp, S base, S ours, S theirs) { - List sequences = new ArrayList(3); + List sequences = new ArrayList<>(3); sequences.add(base); sequences.add(ours); sequences.add(theirs); - MergeResult result = new MergeResult(sequences); + MergeResult result = new MergeResult<>(sequences); if (ours.size() == 0) { if (theirs.size() != 0) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java index ee6095aa71..43876a6227 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java @@ -105,7 +105,7 @@ public class MergeFormatter { @SuppressWarnings("unchecked") public void formatMerge(OutputStream out, MergeResult res, String baseName, String oursName, String theirsName, String charsetName) throws IOException { - List names = new ArrayList(3); + List names = new ArrayList<>(3); names.add(baseName); names.add(oursName); names.add(theirsName); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java index 82cbf368c7..ca0e18a0ef 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java @@ -71,11 +71,11 @@ public class MergeMessageFormatter { StringBuilder sb = new StringBuilder(); sb.append("Merge "); //$NON-NLS-1$ - List branches = new ArrayList(); - List remoteBranches = new ArrayList(); - List tags = new ArrayList(); - List commits = new ArrayList(); - List others = new ArrayList(); + List branches = new ArrayList<>(); + List remoteBranches = new ArrayList<>(); + List tags = new ArrayList<>(); + List commits = new ArrayList<>(); + List others = new ArrayList<>(); for (Ref ref : refsToMerge) { if (ref.getName().startsWith(Constants.R_HEADS)) { branches.add("'" + Repository.shortenRefName(ref.getName()) //$NON-NLS-1$ @@ -95,7 +95,7 @@ public class MergeMessageFormatter { } } - List listings = new ArrayList(); + List listings = new ArrayList<>(); if (!branches.isEmpty()) listings.add(joinNames(branches, "branch", "branches")); //$NON-NLS-1$//$NON-NLS-2$ diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeStrategy.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeStrategy.java index c5e615ed87..656480e468 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeStrategy.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeStrategy.java @@ -80,7 +80,7 @@ public abstract class MergeStrategy { */ public static final ThreeWayMergeStrategy RECURSIVE = new StrategyRecursive(); - private static final HashMap STRATEGIES = new HashMap(); + private static final HashMap STRATEGIES = new HashMap<>(); static { register(OURS); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/RecursiveMerger.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/RecursiveMerger.java index e0556447ce..f8e1998ed7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/RecursiveMerger.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/RecursiveMerger.java @@ -147,7 +147,7 @@ public class RecursiveMerger extends ResolveMerger { */ protected RevCommit getBaseCommit(RevCommit a, RevCommit b, int callDepth) throws IOException { - ArrayList baseCommits = new ArrayList(); + ArrayList baseCommits = new ArrayList<>(); walk.reset(); walk.setRevFilter(RevFilter.MERGE_BASE); walk.markStart(a); @@ -181,7 +181,7 @@ public class RecursiveMerger extends ResolveMerger { dircache = DirCache.read(reader, currentBase.getTree()); inCore = true; - List parents = new ArrayList(); + List parents = new ArrayList<>(); parents.add(currentBase); for (int commitIdx = 1; commitIdx < baseCommits.size(); commitIdx++) { RevCommit nextBase = baseCommits.get(commitIdx); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java index fd5e7ef7ba..f667af278a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java @@ -180,14 +180,14 @@ public class ResolveMerger extends ThreeWayMerger { * * @since 3.4 */ - protected List unmergedPaths = new ArrayList(); + protected List unmergedPaths = new ArrayList<>(); /** * Files modified during this merge operation. * * @since 3.4 */ - protected List modifiedFiles = new LinkedList(); + protected List modifiedFiles = new LinkedList<>(); /** * If the merger has nothing to do for a file but check it out at the end of @@ -195,7 +195,7 @@ public class ResolveMerger extends ThreeWayMerger { * * @since 3.4 */ - protected Map toBeCheckedOut = new HashMap(); + protected Map toBeCheckedOut = new HashMap<>(); /** * Paths in this list will be deleted from the local copy at the end of the @@ -203,7 +203,7 @@ public class ResolveMerger extends ThreeWayMerger { * * @since 3.4 */ - protected List toBeDeleted = new ArrayList(); + protected List toBeDeleted = new ArrayList<>(); /** * Low-level textual merge results. Will be passed on to the callers in case @@ -211,14 +211,14 @@ public class ResolveMerger extends ThreeWayMerger { * * @since 3.4 */ - protected Map> mergeResults = new HashMap>(); + protected Map> mergeResults = new HashMap<>(); /** * Paths for which the merge failed altogether. * * @since 3.4 */ - protected Map failingPaths = new HashMap(); + protected Map failingPaths = new HashMap<>(); /** * Updated as we merge entries of the tree walk. Tells us whether we should @@ -518,7 +518,7 @@ public class ResolveMerger extends ThreeWayMerger { unmergedPaths.add(tw.getPathString()); mergeResults.put( tw.getPathString(), - new MergeResult(Collections + new MergeResult<>(Collections . emptyList())); } return true; -- cgit v1.2.3