diff options
Diffstat (limited to 'org.eclipse.jgit')
168 files changed, 481 insertions, 481 deletions
diff --git a/org.eclipse.jgit/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit/.settings/org.eclipse.jdt.core.prefs index 763144c86b..06ddbabb48 100644 --- a/org.eclipse.jgit/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.jgit/.settings/org.eclipse.jdt.core.prefs @@ -76,7 +76,7 @@ org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java index 0ef47a4152..1ed79449ef 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/AddCommand.java @@ -96,7 +96,7 @@ public class AddCommand extends GitCommand<DirCache> { */ public AddCommand(Repository repo) { super(repo); - filepatterns = new LinkedList<String>(); + filepatterns = new LinkedList<>(); } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java index 45311f7f9f..ba5673d977 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java @@ -198,10 +198,10 @@ public class ApplyCommand extends GitCommand<ApplyResult> { private void apply(File f, FileHeader fh) throws IOException, PatchApplyException { RawText rt = new RawText(f); - List<String> oldLines = new ArrayList<String>(rt.size()); + List<String> oldLines = new ArrayList<>(rt.size()); for (int i = 0; i < rt.size(); i++) oldLines.add(rt.getString(i)); - List<String> newLines = new ArrayList<String>(oldLines); + List<String> newLines = new ArrayList<>(oldLines); for (HunkHeader hh : fh.getHunks()) { byte[] b = new byte[hh.getEndOffset() - hh.getStartOffset()]; @@ -209,7 +209,7 @@ public class ApplyCommand extends GitCommand<ApplyResult> { b.length); RawText hrt = new RawText(b); - List<String> hunkLines = new ArrayList<String>(hrt.size()); + List<String> hunkLines = new ArrayList<>(hrt.size()); for (int i = 0; i < hrt.size(); i++) hunkLines.add(hrt.getString(i)); int pos = 0; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyResult.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyResult.java index 558ef0f8a8..2ef6650e91 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyResult.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyResult.java @@ -53,7 +53,7 @@ import java.util.List; */ public class ApplyResult { - private List<File> updatedFiles = new ArrayList<File>(); + private List<File> updatedFiles = new ArrayList<>(); /** * @param f diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ArchiveCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ArchiveCommand.java index 6c7dca5c2e..0d18eb3d07 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ArchiveCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ArchiveCommand.java @@ -259,7 +259,7 @@ public class ArchiveCommand extends GitCommand<OutputStream> { * the --format= option) */ private static final ConcurrentMap<String, FormatEntry> formats = - new ConcurrentHashMap<String, FormatEntry>(); + new ConcurrentHashMap<>(); /** * Replaces the entry for a key only if currently mapped to a given @@ -377,7 +377,7 @@ public class ArchiveCommand extends GitCommand<OutputStream> { private String prefix; private String format; private Map<String, Object> formatOptions = new HashMap<>(); - private List<String> paths = new ArrayList<String>(); + private List<String> paths = new ArrayList<>(); /** Filename suffix, for automatically choosing a format. */ private String suffix; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java index ce73d0e6b8..b1c81ff154 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/BlameCommand.java @@ -188,7 +188,7 @@ public class BlameCommand extends GitCommand<BlameResult> { public BlameCommand reverse(AnyObjectId start, Collection<ObjectId> end) throws IOException { startCommit = start.toObjectId(); - reverseEndCommits = new ArrayList<ObjectId>(end); + reverseEndCommits = new ArrayList<>(end); return this; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java index bb94e5494f..21d62837e9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java @@ -180,7 +180,7 @@ public class CheckoutCommand extends GitCommand<Ref> { */ protected CheckoutCommand(Repository repo) { super(repo); - this.paths = new LinkedList<String>(); + this.paths = new LinkedList<>(); } /** @@ -320,10 +320,10 @@ public class CheckoutCommand extends GitCommand<Ref> { if (!dco.getToBeDeleted().isEmpty()) { status = new CheckoutResult(Status.NONDELETED, dco.getToBeDeleted(), - new ArrayList<String>(dco.getUpdated().keySet()), + new ArrayList<>(dco.getUpdated().keySet()), dco.getRemoved()); } else - status = new CheckoutResult(new ArrayList<String>(dco + status = new CheckoutResult(new ArrayList<>(dco .getUpdated().keySet()), dco.getRemoved()); return ref; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutResult.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutResult.java index 92a67f46af..2186eb4b5a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutResult.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutResult.java @@ -139,11 +139,11 @@ public class CheckoutResult { if (status == Status.CONFLICTS) this.conflictList = fileList; else - this.conflictList = new ArrayList<String>(0); + this.conflictList = new ArrayList<>(0); if (status == Status.NONDELETED) this.undeletedList = fileList; else - this.undeletedList = new ArrayList<String>(0); + this.undeletedList = new ArrayList<>(0); this.modifiedList = modified; this.removedList = removed; @@ -160,8 +160,8 @@ public class CheckoutResult { CheckoutResult(List<String> modified, List<String> removed) { myStatus = Status.OK; - this.conflictList = new ArrayList<String>(0); - this.undeletedList = new ArrayList<String>(0); + this.conflictList = new ArrayList<>(0); + this.undeletedList = new ArrayList<>(0); this.modifiedList = modified; this.removedList = removed; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java index d3af7a6193..eed7b2a254 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java @@ -85,7 +85,7 @@ import org.eclipse.jgit.treewalk.FileTreeIterator; public class CherryPickCommand extends GitCommand<CherryPickResult> { private String reflogPrefix = "cherry-pick:"; //$NON-NLS-1$ - private List<Ref> commits = new LinkedList<Ref>(); + private List<Ref> commits = new LinkedList<>(); private String ourCommitName = null; @@ -121,7 +121,7 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> { UnmergedPathsException, ConcurrentRefUpdateException, WrongRepositoryStateException, NoHeadException { RevCommit newHead = null; - List<Ref> cherryPickedRefs = new LinkedList<Ref>(); + List<Ref> cherryPickedRefs = new LinkedList<>(); checkCallable(); try (RevWalk revWalk = new RevWalk(repo)) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java index 153513aa08..c58efb1478 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java @@ -96,14 +96,14 @@ public class CleanCommand extends GitCommand<Set<String>> { */ @Override public Set<String> call() throws NoWorkTreeException, GitAPIException { - Set<String> files = new TreeSet<String>(); + Set<String> files = new TreeSet<>(); try { StatusCommand command = new StatusCommand(repo); Status status = command.call(); - Set<String> untrackedAndIgnoredFiles = new TreeSet<String>( + Set<String> untrackedAndIgnoredFiles = new TreeSet<>( status.getUntracked()); - Set<String> untrackedAndIgnoredDirs = new TreeSet<String>( + Set<String> untrackedAndIgnoredDirs = new TreeSet<>( status.getUntrackedFolders()); FS fs = getRepository().getFS(); @@ -192,7 +192,7 @@ public class CleanCommand extends GitCommand<Set<String>> { private Set<String> filterIgnorePaths(Set<String> inputPaths, Set<String> ignoredNotInIndex, boolean exact) { if (ignore) { - Set<String> filtered = new TreeSet<String>(inputPaths); + Set<String> filtered = new TreeSet<>(inputPaths); for (String path : inputPaths) for (String ignored : ignoredNotInIndex) if ((exact && path.equals(ignored)) @@ -208,7 +208,7 @@ public class CleanCommand extends GitCommand<Set<String>> { private Set<String> filterFolders(Set<String> untracked, Set<String> untrackedFolders) { - Set<String> filtered = new TreeSet<String>(untracked); + Set<String> filtered = new TreeSet<>(untracked); for (String file : untracked) for (String folder : untrackedFolders) if (file.startsWith(folder)) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java index baa6d7fce9..4b815b439d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CloneCommand.java @@ -220,7 +220,7 @@ public class CloneCommand extends TransportCommand<CloneCommand, Git> { RefSpec wcrs = new RefSpec(); wcrs = wcrs.setForceUpdate(true); wcrs = wcrs.setSourceDestination(Constants.R_HEADS + "*", dst); //$NON-NLS-1$ - List<RefSpec> specs = new ArrayList<RefSpec>(); + List<RefSpec> specs = new ArrayList<>(); if (cloneAllBranches) specs.add(wcrs); else if (branchesToClone != null diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java index f3bc91aeda..274ece6dca 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java @@ -112,7 +112,7 @@ public class CommitCommand extends GitCommand<RevCommit> { private boolean all; - private List<String> only = new ArrayList<String>(); + private List<String> only = new ArrayList<>(); private boolean[] onlyProcessed; @@ -124,7 +124,7 @@ public class CommitCommand extends GitCommand<RevCommit> { * parents this commit should have. The current HEAD will be in this list * and also all commits mentioned in .git/MERGE_HEAD */ - private List<ObjectId> parents = new LinkedList<ObjectId>(); + private List<ObjectId> parents = new LinkedList<>(); private String reflogComment; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java index dcfad6a44c..d7e7e5c294 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java @@ -79,7 +79,7 @@ import org.eclipse.jgit.revwalk.RevWalk; * >Git documentation about Branch</a> */ public class DeleteBranchCommand extends GitCommand<List<String>> { - private final Set<String> branchNames = new HashSet<String>(); + private final Set<String> branchNames = new HashSet<>(); private boolean force; @@ -101,7 +101,7 @@ public class DeleteBranchCommand extends GitCommand<List<String>> { public List<String> call() throws GitAPIException, NotMergedException, CannotDeleteCurrentBranchException { checkCallable(); - List<String> result = new ArrayList<String>(); + List<String> result = new ArrayList<>(); if (branchNames.isEmpty()) return result; try { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteTagCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteTagCommand.java index 0d312dd402..77e3539996 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteTagCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteTagCommand.java @@ -68,7 +68,7 @@ import org.eclipse.jgit.lib.Repository; */ public class DeleteTagCommand extends GitCommand<List<String>> { - private final Set<String> tags = new HashSet<String>(); + private final Set<String> tags = new HashSet<>(); /** * @param repo @@ -83,7 +83,7 @@ public class DeleteTagCommand extends GitCommand<List<String>> { @Override public List<String> call() throws GitAPIException { checkCallable(); - List<String> result = new ArrayList<String>(); + List<String> result = new ArrayList<>(); if (tags.isEmpty()) return result; try { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/DescribeCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/DescribeCommand.java index a119fcc848..389c511e1c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/DescribeCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/DescribeCommand.java @@ -189,7 +189,7 @@ public class DescribeCommand extends GitCommand<String> { if (target == null) setTarget(Constants.HEAD); - Map<ObjectId, Ref> tags = new HashMap<ObjectId, Ref>(); + Map<ObjectId, Ref> tags = new HashMap<>(); for (Ref r : repo.getRefDatabase().getRefs(R_TAGS).values()) { ObjectId key = repo.peel(r).getPeeledObjectId(); @@ -240,7 +240,7 @@ public class DescribeCommand extends GitCommand<String> { } } - List<Candidate> candidates = new ArrayList<Candidate>(); // all the candidates we find + List<Candidate> candidates = new ArrayList<>(); // all the candidates we find // is the target already pointing to a tag? if so, we are done! Ref lucky = tags.get(target); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java index 1f4dcdd3e6..a9dca4d7bc 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/FetchCommand.java @@ -96,7 +96,7 @@ public class FetchCommand extends TransportCommand<FetchCommand, FetchResult> { */ protected FetchCommand(Repository repo) { super(repo); - refSpecs = new ArrayList<RefSpec>(3); + refSpecs = new ArrayList<>(3); } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ListBranchCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ListBranchCommand.java index 438ec89ff0..961eeaadd4 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ListBranchCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ListBranchCommand.java @@ -106,7 +106,7 @@ public class ListBranchCommand extends GitCommand<List<Ref>> { checkCallable(); List<Ref> resultRefs; try { - Collection<Ref> refs = new ArrayList<Ref>(); + Collection<Ref> refs = new ArrayList<>(); // Also return HEAD if it's detached Ref head = repo.exactRef(Constants.HEAD); @@ -121,7 +121,7 @@ public class ListBranchCommand extends GitCommand<List<Ref>> { refs.addAll(getRefs(Constants.R_HEADS)); refs.addAll(getRefs(Constants.R_REMOTES)); } - resultRefs = new ArrayList<Ref>(filterRefs(refs)); + resultRefs = new ArrayList<>(filterRefs(refs)); } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ListNotesCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ListNotesCommand.java index cdb32ca2f2..476c10bdbc 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ListNotesCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ListNotesCommand.java @@ -80,7 +80,7 @@ public class ListNotesCommand extends GitCommand<List<Note>> { @Override public List<Note> call() throws GitAPIException { checkCallable(); - List<Note> notes = new ArrayList<Note>(); + List<Note> notes = new ArrayList<>(); NoteMap map = NoteMap.newEmptyMap(); try (RevWalk walk = new RevWalk(repo)) { Ref ref = repo.findRef(notesRef); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ListTagCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ListTagCommand.java index 6d46cdf9a8..d649a53db1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ListTagCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ListTagCommand.java @@ -78,7 +78,7 @@ public class ListTagCommand extends GitCommand<List<Ref>> { public List<Ref> call() throws GitAPIException { checkCallable(); Map<String, Ref> refList; - List<Ref> tags = new ArrayList<Ref>(); + List<Ref> tags = new ArrayList<>(); try (RevWalk revWalk = new RevWalk(repo)) { refList = repo.getRefDatabase().getRefs(Constants.R_TAGS); for (Ref ref : refList.values()) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java index 47b2599812..f8fe95a88a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/LogCommand.java @@ -107,7 +107,7 @@ public class LogCommand extends GitCommand<Iterable<RevCommit>> { private RevFilter revFilter; - private final List<PathFilter> pathFilters = new ArrayList<PathFilter>(); + private final List<PathFilter> pathFilters = new ArrayList<>(); private int maxCount = -1; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/LsRemoteCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/LsRemoteCommand.java index 9ad71250e8..5157a411fd 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/LsRemoteCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/LsRemoteCommand.java @@ -188,14 +188,14 @@ public class LsRemoteCommand extends : Transport.open(new URIish(remote))) { transport.setOptionUploadPack(uploadPack); configure(transport); - Collection<RefSpec> refSpecs = new ArrayList<RefSpec>(1); + Collection<RefSpec> refSpecs = new ArrayList<>(1); if (tags) refSpecs.add(new RefSpec( "refs/tags/*:refs/remotes/origin/tags/*")); //$NON-NLS-1$ if (heads) refSpecs.add(new RefSpec("refs/heads/*:refs/remotes/origin/*")); //$NON-NLS-1$ Collection<Ref> refs; - Map<String, Ref> refmap = new HashMap<String, Ref>(); + Map<String, Ref> refmap = new HashMap<>(); try (FetchConnection fc = transport.openFetch()) { refs = fc.getRefs(); if (refSpecs.isEmpty()) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java index de7b604cf2..b5d9e8a6b6 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java @@ -102,7 +102,7 @@ public class MergeCommand extends GitCommand<MergeResult> { private MergeStrategy mergeStrategy = MergeStrategy.RECURSIVE; - private List<Ref> commits = new LinkedList<Ref>(); + private List<Ref> commits = new LinkedList<>(); private Boolean squash; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeResult.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeResult.java index aa8075d163..c487ef6509 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeResult.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeResult.java @@ -416,7 +416,7 @@ public class MergeResult { */ public void addConflict(String path, int[][] conflictingRanges) { if (conflicts == null) - conflicts = new HashMap<String, int[][]>(); + conflicts = new HashMap<>(); conflicts.put(path, conflictingRanges); } @@ -428,7 +428,7 @@ public class MergeResult { if (!lowLevelResult.containsConflicts()) return; if (conflicts == null) - conflicts = new HashMap<String, int[][]>(); + conflicts = new HashMap<>(); int nrOfConflicts = 0; // just counting for (MergeChunk mergeChunk : lowLevelResult) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/NameRevCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/NameRevCommand.java index fd28d0ec43..2a86fabede 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/NameRevCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/NameRevCommand.java @@ -124,8 +124,8 @@ public class NameRevCommand extends GitCommand<Map<ObjectId, String>> { protected NameRevCommand(Repository repo) { super(repo); mergeCost = MERGE_COST; - prefixes = new ArrayList<String>(2); - revs = new ArrayList<ObjectId>(2); + prefixes = new ArrayList<>(2); + revs = new ArrayList<>(2); walk = new RevWalk(repo) { @Override public NameRevCommit createCommit(AnyObjectId id) { @@ -137,7 +137,7 @@ public class NameRevCommand extends GitCommand<Map<ObjectId, String>> { @Override public Map<ObjectId, String> call() throws GitAPIException { try { - Map<ObjectId, String> nonCommits = new HashMap<ObjectId, String>(); + Map<ObjectId, String> nonCommits = new HashMap<>(); FIFORevQueue pending = new FIFORevQueue(); if (refs != null) { for (Ref ref : refs) @@ -170,7 +170,7 @@ public class NameRevCommand extends GitCommand<Map<ObjectId, String>> { } Map<ObjectId, String> result = - new LinkedHashMap<ObjectId, String>(revs.size()); + new LinkedHashMap<>(revs.size()); for (ObjectId id : revs) { RevObject o = walk.parseAny(id); if (o instanceof NameRevCommit) { @@ -275,7 +275,7 @@ public class NameRevCommand extends GitCommand<Map<ObjectId, String>> { public NameRevCommand addAnnotatedTags() { checkCallable(); if (refs == null) - refs = new ArrayList<Ref>(); + refs = new ArrayList<>(); try { for (Ref ref : repo.getRefDatabase().getRefs(Constants.R_TAGS).values()) { ObjectId id = ref.getObjectId(); @@ -302,7 +302,7 @@ public class NameRevCommand extends GitCommand<Map<ObjectId, String>> { public NameRevCommand addRef(Ref ref) { checkCallable(); if (refs == null) - refs = new ArrayList<Ref>(); + refs = new ArrayList<>(); refs.add(ref); return this; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java index 01b57bde81..bf88842618 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/PushCommand.java @@ -109,7 +109,7 @@ public class PushCommand extends */ protected PushCommand(Repository repo) { super(repo); - refSpecs = new ArrayList<RefSpec>(3); + refSpecs = new ArrayList<>(3); refLeaseSpecs = new HashMap<>(); } @@ -132,7 +132,7 @@ public class PushCommand extends org.eclipse.jgit.api.errors.TransportException { checkCallable(); - ArrayList<PushResult> pushResults = new ArrayList<PushResult>(3); + ArrayList<PushResult> pushResults = new ArrayList<>(3); try { if (refSpecs.isEmpty()) { @@ -283,7 +283,7 @@ public class PushCommand extends * @since 4.7 */ public List<RefLeaseSpec> getRefLeaseSpecs() { - return new ArrayList<RefLeaseSpec>(refLeaseSpecs.values()); + return new ArrayList<>(refLeaseSpecs.values()); } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java index 617c37d610..f704492fe5 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java @@ -299,7 +299,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { org.eclipse.jgit.api.Status status = Git.wrap(repo) .status().setIgnoreSubmodules(IgnoreSubmoduleMode.ALL).call(); if (status.hasUncommittedChanges()) { - List<String> list = new ArrayList<String>(); + List<String> list = new ArrayList<>(); list.addAll(status.getUncommittedChanges()); return RebaseResult.uncommittedChanges(list); } @@ -650,7 +650,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { // Get the rewritten equivalents for the parents of the given commit private List<RevCommit> getNewParents(RevCommit commitToPick) throws IOException { - List<RevCommit> newParents = new ArrayList<RevCommit>(); + List<RevCommit> newParents = new ArrayList<>(); for (int p = 0; p < commitToPick.getParentCount(); p++) { String parentHash = commitToPick.getParent(p).getName(); if (!new File(rebaseState.getRewrittenDir(), parentHash).exists()) @@ -1056,8 +1056,8 @@ public class RebaseCommand extends GitCommand<RebaseResult> { private void popSteps(int numSteps) throws IOException { if (numSteps == 0) return; - List<RebaseTodoLine> todoLines = new LinkedList<RebaseTodoLine>(); - List<RebaseTodoLine> poppedLines = new LinkedList<RebaseTodoLine>(); + List<RebaseTodoLine> todoLines = new LinkedList<>(); + List<RebaseTodoLine> poppedLines = new LinkedList<>(); for (RebaseTodoLine line : repo.readRebaseTodo( rebaseState.getPath(GIT_REBASE_TODO), true)) { @@ -1122,7 +1122,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { } rebaseState.createFile(QUIET, ""); //$NON-NLS-1$ - ArrayList<RebaseTodoLine> toDoSteps = new ArrayList<RebaseTodoLine>(); + ArrayList<RebaseTodoLine> toDoSteps = new ArrayList<>(); toDoSteps.add(new RebaseTodoLine("# Created by EGit: rebasing " + headId.name() //$NON-NLS-1$ + " onto " + upstreamCommit.name())); //$NON-NLS-1$ // determine the commits to be applied @@ -1158,7 +1158,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { LogCommand cmd = git.log().addRange(upstreamCommit, headCommit); commitsToUse = cmd.call(); } - List<RevCommit> cherryPickList = new ArrayList<RevCommit>(); + List<RevCommit> cherryPickList = new ArrayList<>(); for (RevCommit commit : commitsToUse) { if (preserveMerges || commit.getParentCount() == 1) cherryPickList.add(commit); @@ -1605,7 +1605,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { if (raw.length == 0) return null; - Map<String, String> keyValueMap = new HashMap<String, String>(); + Map<String, String> keyValueMap = new HashMap<>(); for (int p = 0; p < raw.length;) { int end = RawParseUtils.nextLF(raw, p); if (end == p) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java index 412219cead..c5222c2d5f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java @@ -121,7 +121,7 @@ public class ResetCommand extends GitCommand<Ref> { private ResetType mode; - private Collection<String> filepaths = new LinkedList<String>(); + private Collection<String> filepaths = new LinkedList<>(); private boolean isReflogDisabled; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java index 20683d5c0f..c3152a93b4 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java @@ -85,11 +85,11 @@ import org.eclipse.jgit.treewalk.FileTreeIterator; * >Git documentation about revert</a> */ public class RevertCommand extends GitCommand<RevCommit> { - private List<Ref> commits = new LinkedList<Ref>(); + private List<Ref> commits = new LinkedList<>(); private String ourCommitName = null; - private List<Ref> revertedRefs = new LinkedList<Ref>(); + private List<Ref> revertedRefs = new LinkedList<>(); private MergeResult failingResult; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RmCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RmCommand.java index 069a9cfacc..9e2cf31100 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RmCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RmCommand.java @@ -99,7 +99,7 @@ public class RmCommand extends GitCommand<DirCache> { */ public RmCommand(Repository repo) { super(repo); - filepatterns = new LinkedList<String>(); + filepatterns = new LinkedList<>(); } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java index 2cbfead8c8..681f8e65ae 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java @@ -262,9 +262,9 @@ public class StashCreateCommand extends GitCommand<RevCommit> { return null; MutableObjectId id = new MutableObjectId(); - List<PathEdit> wtEdits = new ArrayList<PathEdit>(); - List<String> wtDeletes = new ArrayList<String>(); - List<DirCacheEntry> untracked = new ArrayList<DirCacheEntry>(); + List<PathEdit> wtEdits = new ArrayList<>(); + List<String> wtDeletes = new ArrayList<>(); + List<DirCacheEntry> untracked = new ArrayList<>(); boolean hasChanges = false; do { AbstractTreeIterator headIter = treeWalk.getTree(0, diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashListCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashListCommand.java index a2946f9c1f..8420dd228e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashListCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashListCommand.java @@ -95,7 +95,7 @@ public class StashListCommand extends GitCommand<Collection<RevCommit>> { if (stashEntries.isEmpty()) return Collections.emptyList(); - final List<RevCommit> stashCommits = new ArrayList<RevCommit>( + final List<RevCommit> stashCommits = new ArrayList<>( stashEntries.size()); try (RevWalk walk = new RevWalk(repo)) { for (ReflogEntry entry : stashEntries) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/Status.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/Status.java index 48759c2d49..5b7c73b472 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/Status.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/Status.java @@ -189,7 +189,7 @@ public class Status { * @since 3.2 */ public Set<String> getUncommittedChanges() { - Set<String> uncommittedChanges = new HashSet<String>(); + Set<String> uncommittedChanges = new HashSet<>(); uncommittedChanges.addAll(diff.getAdded()); uncommittedChanges.addAll(diff.getChanged()); uncommittedChanges.addAll(diff.getRemoved()); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/StatusCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/StatusCommand.java index 1d5f54213e..8f7804a003 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/StatusCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/StatusCommand.java @@ -109,7 +109,7 @@ public class StatusCommand extends GitCommand<Status> { */ public StatusCommand addPath(String path) { if (paths == null) - paths = new LinkedList<String>(); + paths = new LinkedList<>(); paths.add(path); return this; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleInitCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleInitCommand.java index 8f91b67925..4c5e317cb1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleInitCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleInitCommand.java @@ -76,7 +76,7 @@ public class SubmoduleInitCommand extends GitCommand<Collection<String>> { */ public SubmoduleInitCommand(final Repository repo) { super(repo); - paths = new ArrayList<String>(); + paths = new ArrayList<>(); } /** @@ -99,7 +99,7 @@ public class SubmoduleInitCommand extends GitCommand<Collection<String>> { if (!paths.isEmpty()) generator.setFilter(PathFilterGroup.createFromStrings(paths)); StoredConfig config = repo.getConfig(); - List<String> initialized = new ArrayList<String>(); + List<String> initialized = new ArrayList<>(); while (generator.next()) { // Ignore entry if URL is already present in config file if (generator.getConfigUrl() != null) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleStatusCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleStatusCommand.java index 29d4b73756..8b27e4c41f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleStatusCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleStatusCommand.java @@ -76,7 +76,7 @@ public class SubmoduleStatusCommand extends */ public SubmoduleStatusCommand(final Repository repo) { super(repo); - paths = new ArrayList<String>(); + paths = new ArrayList<>(); } /** @@ -98,7 +98,7 @@ public class SubmoduleStatusCommand extends try (SubmoduleWalk generator = SubmoduleWalk.forIndex(repo)) { if (!paths.isEmpty()) generator.setFilter(PathFilterGroup.createFromStrings(paths)); - Map<String, SubmoduleStatus> statuses = new HashMap<String, SubmoduleStatus>(); + Map<String, SubmoduleStatus> statuses = new HashMap<>(); while (generator.next()) { SubmoduleStatus status = getStatus(generator); statuses.put(status.getPath(), status); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleSyncCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleSyncCommand.java index 8dc9ff9ab3..f97dce9833 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleSyncCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleSyncCommand.java @@ -78,7 +78,7 @@ public class SubmoduleSyncCommand extends GitCommand<Map<String, String>> { */ public SubmoduleSyncCommand(final Repository repo) { super(repo); - paths = new ArrayList<String>(); + paths = new ArrayList<>(); } /** @@ -115,7 +115,7 @@ public class SubmoduleSyncCommand extends GitCommand<Map<String, String>> { try (SubmoduleWalk generator = SubmoduleWalk.forIndex(repo)) { if (!paths.isEmpty()) generator.setFilter(PathFilterGroup.createFromStrings(paths)); - Map<String, String> synced = new HashMap<String, String>(); + Map<String, String> synced = new HashMap<>(); StoredConfig config = repo.getConfig(); while (generator.next()) { String remoteUrl = generator.getRemoteUrl(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleUpdateCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleUpdateCommand.java index bd2fb8668e..29d5d49a45 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleUpdateCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleUpdateCommand.java @@ -94,7 +94,7 @@ public class SubmoduleUpdateCommand extends */ public SubmoduleUpdateCommand(final Repository repo) { super(repo); - paths = new ArrayList<String>(); + paths = new ArrayList<>(); } /** @@ -148,7 +148,7 @@ public class SubmoduleUpdateCommand extends try (SubmoduleWalk generator = SubmoduleWalk.forIndex(repo)) { if (!paths.isEmpty()) generator.setFilter(PathFilterGroup.createFromStrings(paths)); - List<String> updated = new ArrayList<String>(); + List<String> updated = new ArrayList<>(); while (generator.next()) { // Skip submodules not registered in .gitmodules file if (generator.getModulesPath() == null) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/CheckoutConflictException.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/CheckoutConflictException.java index e317507139..7df35c925c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/CheckoutConflictException.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/errors/CheckoutConflictException.java @@ -95,7 +95,7 @@ public class CheckoutConflictException extends GitAPIException { */ CheckoutConflictException addConflictingPath(String conflictingPath) { if (conflictingPaths == null) - conflictingPaths = new LinkedList<String>(); + conflictingPaths = new LinkedList<>(); conflictingPaths.add(conflictingPath); return this; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/attributes/AttributesNode.java b/org.eclipse.jgit/src/org/eclipse/jgit/attributes/AttributesNode.java index 7196502112..13aeaee7dc 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/attributes/AttributesNode.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/attributes/AttributesNode.java @@ -65,7 +65,7 @@ public class AttributesNode { /** Create an empty ignore node with no rules. */ public AttributesNode() { - rules = new ArrayList<AttributesRule>(); + rules = new ArrayList<>(); } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/attributes/AttributesRule.java b/org.eclipse.jgit/src/org/eclipse/jgit/attributes/AttributesRule.java index 0532250f9c..c9c69db868 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/attributes/AttributesRule.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/attributes/AttributesRule.java @@ -71,7 +71,7 @@ public class AttributesRule { private static List<Attribute> parseAttributes(String attributesLine) { // the C implementation oddly enough allows \r between attributes too. - ArrayList<Attribute> result = new ArrayList<Attribute>(); + ArrayList<Attribute> result = new ArrayList<>(); for (String attribute : attributesLine.split(ATTRIBUTES_SPLIT_REGEX)) { attribute = attribute.trim(); if (attribute.length() == 0) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffAlgorithm.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffAlgorithm.java index 39421c6dee..bd6e5c859a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffAlgorithm.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffAlgorithm.java @@ -117,7 +117,7 @@ public abstract class DiffAlgorithm { if (region.getLengthA() == 1 && region.getLengthB() == 1) return EditList.singleton(region); - SubsequenceComparator<S> cs = new SubsequenceComparator<S>(cmp); + SubsequenceComparator<S> cs = new SubsequenceComparator<>(cmp); Subsequence<S> as = Subsequence.a(a, region); Subsequence<S> bs = Subsequence.b(b, region); EditList e = Subsequence.toBase(diffNonCommon(cs, as, bs), as, bs); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffEntry.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffEntry.java index 24409ee592..e1dfcff6bb 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffEntry.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffEntry.java @@ -179,7 +179,7 @@ public class DiffEntry { else treeFilterMarker = null; - List<DiffEntry> r = new ArrayList<DiffEntry>(); + List<DiffEntry> r = new ArrayList<>(); MutableObjectId idBuf = new MutableObjectId(); while (walk.next()) { DiffEntry entry = new DiffEntry(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/HashedSequencePair.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/HashedSequencePair.java index 74bbca1708..bf6d967c50 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/HashedSequencePair.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/HashedSequencePair.java @@ -81,7 +81,7 @@ public class HashedSequencePair<S extends Sequence> { /** @return obtain a comparator that uses the cached hash codes. */ public HashedSequenceComparator<S> getComparator() { - return new HashedSequenceComparator<S>(cmp); + return new HashedSequenceComparator<>(cmp); } /** @return wrapper around A that includes cached hash codes. */ @@ -103,6 +103,6 @@ public class HashedSequencePair<S extends Sequence> { final int[] hashes = new int[end]; for (int ptr = 0; ptr < end; ptr++) hashes[ptr] = cmp.hash(base, ptr); - return new HashedSequence<S>(base, hashes); + return new HashedSequence<>(base, hashes); } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/HistogramDiff.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/HistogramDiff.java index 80ac1b662e..4ef58455a7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/HistogramDiff.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/HistogramDiff.java @@ -134,14 +134,14 @@ public class HistogramDiff extends LowLevelDiffAlgorithm { public <S extends Sequence> void diffNonCommon(EditList edits, HashedSequenceComparator<S> cmp, HashedSequence<S> a, HashedSequence<S> b, Edit region) { - new State<S>(edits, cmp, a, b).diffRegion(region); + new State<>(edits, cmp, a, b).diffRegion(region); } private class State<S extends Sequence> { private final HashedSequenceComparator<S> cmp; private final HashedSequence<S> a; private final HashedSequence<S> b; - private final List<Edit> queue = new ArrayList<Edit>(); + private final List<Edit> queue = new ArrayList<>(); /** Result edits we have determined that must be made to convert a to b. */ final EditList edits; @@ -161,7 +161,7 @@ public class HistogramDiff extends LowLevelDiffAlgorithm { } private void diffReplace(Edit r) { - Edit lcs = new HistogramDiffIndex<S>(maxChainLength, cmp, a, b, r) + Edit lcs = new HistogramDiffIndex<>(maxChainLength, cmp, a, b, r) .findLongestCommonSequence(); if (lcs != null) { // If we were given an edit, we can prove a result here. @@ -214,7 +214,7 @@ public class HistogramDiff extends LowLevelDiffAlgorithm { } private SubsequenceComparator<HashedSequence<S>> subcmp() { - return new SubsequenceComparator<HashedSequence<S>>(cmp); + return new SubsequenceComparator<>(cmp); } } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/LowLevelDiffAlgorithm.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/LowLevelDiffAlgorithm.java index e3861cd65e..55ceec8012 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/LowLevelDiffAlgorithm.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/LowLevelDiffAlgorithm.java @@ -48,7 +48,7 @@ public abstract class LowLevelDiffAlgorithm extends DiffAlgorithm { @Override public <S extends Sequence> EditList diffNonCommon( SequenceComparator<? super S> cmp, S a, S b) { - HashedSequencePair<S> p = new HashedSequencePair<S>(cmp, a, b); + HashedSequencePair<S> p = new HashedSequencePair<>(cmp, a, b); HashedSequenceComparator<S> hc = p.getComparator(); HashedSequence<S> ha = p.getA(); HashedSequence<S> hb = p.getB(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java index 0e83990025..bc52473d93 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java @@ -393,15 +393,15 @@ public class RenameDetector { /** Reset this rename detector for another rename detection pass. */ public void reset() { - entries = new ArrayList<DiffEntry>(); - deleted = new ArrayList<DiffEntry>(); - added = new ArrayList<DiffEntry>(); + entries = new ArrayList<>(); + deleted = new ArrayList<>(); + added = new ArrayList<>(); done = false; } private void breakModifies(ContentSource.Pair reader, ProgressMonitor pm) throws IOException { - ArrayList<DiffEntry> newEntries = new ArrayList<DiffEntry>(entries.size()); + ArrayList<DiffEntry> newEntries = new ArrayList<>(entries.size()); pm.beginTask(JGitText.get().renamesBreakingModifies, entries.size()); @@ -428,8 +428,8 @@ public class RenameDetector { } private void rejoinModifies(ProgressMonitor pm) { - HashMap<String, DiffEntry> nameMap = new HashMap<String, DiffEntry>(); - ArrayList<DiffEntry> newAdded = new ArrayList<DiffEntry>(added.size()); + HashMap<String, DiffEntry> nameMap = new HashMap<>(); + ArrayList<DiffEntry> newAdded = new ArrayList<>(added.size()); pm.beginTask(JGitText.get().renamesRejoiningModifies, added.size() + deleted.size()); @@ -456,7 +456,7 @@ public class RenameDetector { } added = newAdded; - deleted = new ArrayList<DiffEntry>(nameMap.values()); + deleted = new ArrayList<>(nameMap.values()); } private int calculateModifyScore(ContentSource.Pair reader, DiffEntry d) @@ -508,8 +508,8 @@ public class RenameDetector { HashMap<AbbreviatedObjectId, Object> deletedMap = populateMap(deleted, pm); HashMap<AbbreviatedObjectId, Object> addedMap = populateMap(added, pm); - ArrayList<DiffEntry> uniqueAdds = new ArrayList<DiffEntry>(added.size()); - ArrayList<List<DiffEntry>> nonUniqueAdds = new ArrayList<List<DiffEntry>>(); + ArrayList<DiffEntry> uniqueAdds = new ArrayList<>(added.size()); + ArrayList<List<DiffEntry>> nonUniqueAdds = new ArrayList<>(); for (Object o : addedMap.values()) { if (o instanceof DiffEntry) @@ -518,7 +518,7 @@ public class RenameDetector { nonUniqueAdds.add((List<DiffEntry>) o); } - ArrayList<DiffEntry> left = new ArrayList<DiffEntry>(added.size()); + ArrayList<DiffEntry> left = new ArrayList<>(added.size()); for (DiffEntry a : uniqueAdds) { Object del = deletedMap.get(a.newId); @@ -627,7 +627,7 @@ public class RenameDetector { } added = left; - deleted = new ArrayList<DiffEntry>(deletedMap.size()); + deleted = new ArrayList<>(deletedMap.size()); for (Object o : deletedMap.values()) { if (o instanceof DiffEntry) { DiffEntry e = (DiffEntry) o; @@ -677,11 +677,11 @@ public class RenameDetector { @SuppressWarnings("unchecked") private HashMap<AbbreviatedObjectId, Object> populateMap( List<DiffEntry> diffEntries, ProgressMonitor pm) { - HashMap<AbbreviatedObjectId, Object> map = new HashMap<AbbreviatedObjectId, Object>(); + HashMap<AbbreviatedObjectId, Object> map = new HashMap<>(); for (DiffEntry de : diffEntries) { Object old = map.put(id(de), de); if (old instanceof DiffEntry) { - ArrayList<DiffEntry> list = new ArrayList<DiffEntry>(2); + ArrayList<DiffEntry> list = new ArrayList<>(2); list.add((DiffEntry) old); list.add(de); map.put(id(de), list); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityRenameDetector.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityRenameDetector.java index 6088d72f3b..653658be3c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityRenameDetector.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityRenameDetector.java @@ -136,7 +136,7 @@ class SimilarityRenameDetector { 2 * srcs.size() * dsts.size()); int mNext = buildMatrix(pm); - out = new ArrayList<DiffEntry>(Math.min(mNext, dsts.size())); + out = new ArrayList<>(Math.min(mNext, dsts.size())); // Match rename pairs on a first come, first serve basis until // we have looked at everything that is above our minimum score. @@ -192,7 +192,7 @@ class SimilarityRenameDetector { } private static List<DiffEntry> compactSrcList(List<DiffEntry> in) { - ArrayList<DiffEntry> r = new ArrayList<DiffEntry>(in.size()); + ArrayList<DiffEntry> r = new ArrayList<>(in.size()); for (DiffEntry e : in) { if (e.changeType == ChangeType.DELETE) r.add(e); @@ -201,7 +201,7 @@ class SimilarityRenameDetector { } private static List<DiffEntry> compactDstList(List<DiffEntry> in) { - ArrayList<DiffEntry> r = new ArrayList<DiffEntry>(in.size()); + ArrayList<DiffEntry> r = new ArrayList<>(in.size()); for (DiffEntry e : in) { if (e != null) r.add(e); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/diff/Subsequence.java b/org.eclipse.jgit/src/org/eclipse/jgit/diff/Subsequence.java index 017fe69973..50ca613cca 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/diff/Subsequence.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/diff/Subsequence.java @@ -66,7 +66,7 @@ public final class Subsequence<S extends Sequence> extends Sequence { * @return subsequence of {@code base} as described by A in {@code region}. */ public static <S extends Sequence> Subsequence<S> a(S a, Edit region) { - return new Subsequence<S>(a, region.beginA, region.endA); + return new Subsequence<>(a, region.beginA, region.endA); } /** @@ -81,7 +81,7 @@ public final class Subsequence<S extends Sequence> extends Sequence { * @return subsequence of {@code base} as described by B in {@code region}. */ public static <S extends Sequence> Subsequence<S> b(S b, Edit region) { - return new Subsequence<S>(b, region.beginB, region.endB); + return new Subsequence<>(b, region.beginB, region.endB); } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java index 17ddd35e64..ce52fedcb3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java @@ -993,7 +993,7 @@ public class DirCache { * @throws IOException */ private void updateSmudgedEntries() throws IOException { - List<String> paths = new ArrayList<String>(128); + List<String> paths = new ArrayList<>(128); try (TreeWalk walk = new TreeWalk(repository)) { walk.setOperationType(OperationType.CHECKIN_OP); for (int i = 0; i < entryCnt; i++) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java index c3184437b4..84f0da9e88 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java @@ -127,11 +127,11 @@ public class DirCacheCheckout { private Repository repo; - private HashMap<String, CheckoutMetadata> updated = new HashMap<String, CheckoutMetadata>(); + private HashMap<String, CheckoutMetadata> updated = new HashMap<>(); - private ArrayList<String> conflicts = new ArrayList<String>(); + private ArrayList<String> conflicts = new ArrayList<>(); - private ArrayList<String> removed = new ArrayList<String>(); + private ArrayList<String> removed = new ArrayList<>(); private ObjectId mergeCommitTree; @@ -147,7 +147,7 @@ public class DirCacheCheckout { private boolean failOnConflict = true; - private ArrayList<String> toBeDeleted = new ArrayList<String>(); + private ArrayList<String> toBeDeleted = new ArrayList<>(); private boolean emptyDirCache; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEditor.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEditor.java index 0cc2b7653f..22bedcf91b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEditor.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEditor.java @@ -96,7 +96,7 @@ public class DirCacheEditor extends BaseDirCacheEditor { */ protected DirCacheEditor(final DirCache dc, final int ecnt) { super(dc, ecnt); - edits = new ArrayList<PathEdit>(); + edits = new ArrayList<>(); } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/errors/CompoundException.java b/org.eclipse.jgit/src/org/eclipse/jgit/errors/CompoundException.java index 55b64eeb90..3a7b2c66d1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/errors/CompoundException.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/errors/CompoundException.java @@ -75,7 +75,7 @@ public class CompoundException extends Exception { */ public CompoundException(final Collection<Throwable> why) { super(format(why)); - causeList = Collections.unmodifiableList(new ArrayList<Throwable>(why)); + causeList = Collections.unmodifiableList(new ArrayList<>(why)); } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/events/ListenerList.java b/org.eclipse.jgit/src/org/eclipse/jgit/events/ListenerList.java index 6ac4b0f8ba..12ef533add 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/events/ListenerList.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/events/ListenerList.java @@ -50,7 +50,7 @@ import java.util.concurrent.CopyOnWriteArrayList; /** Manages a thread-safe list of {@link RepositoryListener}s. */ public class ListenerList { - private final ConcurrentMap<Class<? extends RepositoryListener>, CopyOnWriteArrayList<ListenerHandle>> lists = new ConcurrentHashMap<Class<? extends RepositoryListener>, CopyOnWriteArrayList<ListenerHandle>>(); + private final ConcurrentMap<Class<? extends RepositoryListener>, CopyOnWriteArrayList<ListenerHandle>> lists = new ConcurrentHashMap<>(); /** * Register an IndexChangedListener. @@ -126,7 +126,7 @@ public class ListenerList { if (list == null) { CopyOnWriteArrayList<ListenerHandle> newList; - newList = new CopyOnWriteArrayList<ListenerHandle>(); + newList = new CopyOnWriteArrayList<>(); list = lists.putIfAbsent(handle.type, newList); if (list == null) list = newList; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java b/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java index f9c239431a..856d74e997 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/FileNameMatcher.java @@ -120,9 +120,9 @@ public class FileNameMatcher { private FileNameMatcher(final List<Head> headsStartValue, final List<Head> heads) { this.headsStartValue = headsStartValue; - this.heads = new ArrayList<Head>(heads.size()); + this.heads = new ArrayList<>(heads.size()); this.heads.addAll(heads); - this.listForLocalUseage = new ArrayList<Head>(heads.size()); + this.listForLocalUseage = new ArrayList<>(heads.size()); } /** @@ -158,7 +158,7 @@ public class FileNameMatcher { final List<AbstractHead> allHeads = parseHeads(patternString, invalidWildgetCharacter); - List<Head> nextHeadsSuggestion = new ArrayList<Head>(2); + List<Head> nextHeadsSuggestion = new ArrayList<>(2); nextHeadsSuggestion.add(LastHead.INSTANCE); for (int i = allHeads.size() - 1; i >= 0; i--) { final AbstractHead head = allHeads.get(i); @@ -172,7 +172,7 @@ public class FileNameMatcher { head.setNewHeads(nextHeadsSuggestion); } else { head.setNewHeads(nextHeadsSuggestion); - nextHeadsSuggestion = new ArrayList<Head>(2); + nextHeadsSuggestion = new ArrayList<>(2); nextHeadsSuggestion.add(head); } } @@ -236,7 +236,7 @@ public class FileNameMatcher { throws InvalidPatternException { int currentIndex = 0; - List<AbstractHead> heads = new ArrayList<AbstractHead>(); + List<AbstractHead> heads = new ArrayList<>(); while (currentIndex < pattern.length()) { final int groupStart = indexOfUnescaped(pattern, '[', currentIndex); if (groupStart == -1) { @@ -262,7 +262,7 @@ public class FileNameMatcher { private static List<AbstractHead> createSimpleHeads( final String patternPart, final Character invalidWildgetCharacter) { - final List<AbstractHead> heads = new ArrayList<AbstractHead>( + final List<AbstractHead> heads = new ArrayList<>( patternPart.length()); boolean escaped = false; @@ -375,7 +375,7 @@ public class FileNameMatcher { * reset and start point. */ public FileNameMatcher createMatcherForSuffix() { - final List<Head> copyOfHeads = new ArrayList<Head>(heads.size()); + final List<Head> copyOfHeads = new ArrayList<>(heads.size()); copyOfHeads.addAll(heads); return new FileNameMatcher(copyOfHeads); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/GroupHead.java b/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/GroupHead.java index a7bd2eafba..5c18756786 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/GroupHead.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/fnmatch/GroupHead.java @@ -64,7 +64,7 @@ final class GroupHead extends AbstractHead { GroupHead(String pattern, final String wholePattern) throws InvalidPatternException { super(false); - this.characterClasses = new ArrayList<CharacterPattern>(); + this.characterClasses = new ArrayList<>(); this.inverse = pattern.startsWith("!"); //$NON-NLS-1$ if (inverse) { pattern = pattern.substring(1); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/ManifestParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/ManifestParser.java index 55ded92a17..7b600ee060 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/ManifestParser.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/ManifestParser.java @@ -132,8 +132,8 @@ public class ManifestParser extends DefaultHandler { lastIndex--; this.baseUrl = baseUrl.substring(0, lastIndex + 1); - plusGroups = new HashSet<String>(); - minusGroups = new HashSet<String>(); + plusGroups = new HashSet<>(); + minusGroups = new HashSet<>(); if (groups == null || groups.length() == 0 || groups.equals("default")) { //$NON-NLS-1$ // default means "all,-notdefault" @@ -147,9 +147,9 @@ public class ManifestParser extends DefaultHandler { } } - remotes = new HashMap<String, Remote>(); - projects = new ArrayList<RepoProject>(); - filteredProjects = new ArrayList<RepoProject>(); + remotes = new HashMap<>(); + projects = new ArrayList<>(); + filteredProjects = new ArrayList<>(); } /** @@ -258,7 +258,7 @@ public class ManifestParser extends DefaultHandler { return; // Only do the following after we finished reading everything. - Map<String, String> remoteUrls = new HashMap<String, String>(); + Map<String, String> remoteUrls = new HashMap<>(); URI baseUri; try { baseUri = new URI(baseUrl); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java index c3c7714c14..dd68f60108 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java @@ -464,7 +464,7 @@ public class RepoCommand extends GitCommand<RevCommit> { } if (repo.isBare()) { - bareProjects = new ArrayList<RepoProject>(); + bareProjects = new ArrayList<>(); if (author == null) author = new PersonIdent(repo); if (callback == null) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoProject.java b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoProject.java index ff4a3ed1c6..700cf11070 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoProject.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoProject.java @@ -155,7 +155,7 @@ public class RepoProject implements Comparable<RepoProject> { this.remote = remote; this.groups = groups; this.recommendShallow = recommendShallow; - copyfiles = new ArrayList<CopyFile>(); + copyfiles = new ArrayList<>(); } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/IgnoreNode.java b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/IgnoreNode.java index 8b1244ed1b..6314c63d2e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/IgnoreNode.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/IgnoreNode.java @@ -83,7 +83,7 @@ public class IgnoreNode { /** Create an empty ignore node with no rules. */ public IgnoreNode() { - rules = new ArrayList<FastIgnoreRule>(); + rules = new ArrayList<>(); } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/PathMatcher.java b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/PathMatcher.java index 9bb93cd888..65224eab91 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/PathMatcher.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/PathMatcher.java @@ -90,7 +90,7 @@ public class PathMatcher extends AbstractMatcher { static private List<IMatcher> createMatchers(List<String> segments, Character pathSeparator, boolean dirOnly) throws InvalidPatternException { - List<IMatcher> matchers = new ArrayList<IMatcher>(segments.size()); + List<IMatcher> matchers = new ArrayList<>(segments.size()); for (int i = 0; i < segments.size(); i++) { String segment = segments.get(i); IMatcher matcher = createNameMatcher0(segment, pathSeparator, diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java index 1c467fe71b..da482fa50a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/ignore/internal/Strings.java @@ -148,7 +148,7 @@ public class Strings { if (count < 1) throw new IllegalStateException( "Pattern must have at least two segments: " + pattern); //$NON-NLS-1$ - List<String> segments = new ArrayList<String>(count); + List<String> segments = new ArrayList<>(count); int right = 0; while (true) { int left = right; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCache.java index f7decf1324..ef0b80c11f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCache.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsBlockCache.java @@ -183,7 +183,7 @@ public final class DfsBlockCache { if (tableSize < 1) throw new IllegalArgumentException(JGitText.get().tSizeMustBeGreaterOrEqual1); - table = new AtomicReferenceArray<HashEntry>(tableSize); + table = new AtomicReferenceArray<>(tableSize); loadLocks = new ReentrantLock[cfg.getConcurrencyLevel()]; for (int i = 0; i < loadLocks.length; i++) loadLocks[i] = new ReentrantLock(true /* fair */); @@ -194,10 +194,10 @@ public final class DfsBlockCache { blockSizeShift = Integer.numberOfTrailingZeros(blockSize); clockLock = new ReentrantLock(true /* fair */); - clockHand = new Ref<Object>(new DfsPackKey(), -1, 0, null); + clockHand = new Ref<>(new DfsPackKey(), -1, 0, null); clockHand.next = clockHand; - packCache = new ConcurrentHashMap<DfsPackDescription, DfsPackFile>( + packCache = new ConcurrentHashMap<>( 16, 0.75f, 1); packFiles = Collections.unmodifiableCollection(packCache.values()); @@ -357,7 +357,7 @@ public final class DfsBlockCache { } key.cachedSize.addAndGet(v.size()); - Ref<DfsBlock> ref = new Ref<DfsBlock>(key, position, v.size(), v); + Ref<DfsBlock> ref = new Ref<>(key, position, v.size(), v); ref.hot = true; for (;;) { HashEntry n = new HashEntry(clean(e2), ref); @@ -461,7 +461,7 @@ public final class DfsBlockCache { } key.cachedSize.addAndGet(size); - ref = new Ref<T>(key, pos, size, v); + ref = new Ref<>(key, pos, size, v); ref.hot = true; for (;;) { HashEntry n = new HashEntry(clean(e2), ref); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java index 968313254b..d3803024a5 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsGarbageCollector.java @@ -127,9 +127,9 @@ public class DfsGarbageCollector { repo = repository; refdb = repo.getRefDatabase(); objdb = repo.getObjectDatabase(); - newPackDesc = new ArrayList<DfsPackDescription>(4); - newPackStats = new ArrayList<PackStatistics>(4); - newPackObj = new ArrayList<ObjectIdSet>(4); + newPackDesc = new ArrayList<>(4); + newPackStats = new ArrayList<>(4); + newPackObj = new ArrayList<>(4); packConfig = new PackConfig(repo); packConfig.setIndexVersion(2); @@ -249,10 +249,10 @@ public class DfsGarbageCollector { return true; } - allHeads = new HashSet<ObjectId>(); - nonHeads = new HashSet<ObjectId>(); - txnHeads = new HashSet<ObjectId>(); - tagTargets = new HashSet<ObjectId>(); + allHeads = new HashSet<>(); + nonHeads = new HashSet<>(); + txnHeads = new HashSet<>(); + tagTargets = new HashSet<>(); for (Ref ref : refsBefore) { if (ref.isSymbolic() || ref.getObjectId() == null) continue; @@ -304,8 +304,8 @@ public class DfsGarbageCollector { private void readPacksBefore() throws IOException { DfsPackFile[] packs = objdb.getPacks(); - packsBefore = new ArrayList<DfsPackFile>(packs.length); - expiredGarbagePacks = new ArrayList<DfsPackFile>(packs.length); + packsBefore = new ArrayList<>(packs.length); + expiredGarbagePacks = new ArrayList<>(packs.length); long mostRecentGC = mostRecentGC(packs); long now = SystemReader.getInstance().getCurrentTime(); @@ -437,7 +437,7 @@ public class DfsGarbageCollector { private List<DfsPackDescription> toPrune() { int cnt = packsBefore.size(); - List<DfsPackDescription> all = new ArrayList<DfsPackDescription>(cnt); + List<DfsPackDescription> all = new ArrayList<>(cnt); for (DfsPackFile pack : packsBefore) { all.add(pack.getPackDescription()); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsInserter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsInserter.java index c179e77786..1551ad6150 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsInserter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsInserter.java @@ -274,8 +274,8 @@ public class DfsInserter extends ObjectInserter { } private void beginPack() throws IOException { - objectList = new BlockList<PackedObjectInfo>(); - objectMap = new ObjectIdOwnerMap<PackedObjectInfo>(); + objectList = new BlockList<>(); + objectMap = new ObjectIdOwnerMap<>(); cache = DfsBlockCache.getInstance(); rollback = true; @@ -543,7 +543,7 @@ public class DfsInserter extends ObjectInserter { if (objectList == null) return stored; - Set<ObjectId> r = new HashSet<ObjectId>(stored.size() + 2); + Set<ObjectId> r = new HashSet<>(stored.size() + 2); r.addAll(stored); for (PackedObjectInfo obj : objectList) { if (id.prefixCompare(obj) == 0) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjDatabase.java index b68527544a..b1cb72dec9 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjDatabase.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsObjDatabase.java @@ -160,7 +160,7 @@ public abstract class DfsObjDatabase extends ObjectDatabase { protected DfsObjDatabase(DfsRepository repository, DfsReaderOptions options) { this.repository = repository; - this.packList = new AtomicReference<PackList>(NO_PACKS); + this.packList = new AtomicReference<>(NO_PACKS); this.readerOptions = options; } @@ -458,7 +458,7 @@ public abstract class DfsObjDatabase extends ObjectDatabase { List<DfsPackDescription> scanned = listPacks(); Collections.sort(scanned); - List<DfsPackFile> list = new ArrayList<DfsPackFile>(scanned.size()); + List<DfsPackFile> list = new ArrayList<>(scanned.size()); boolean foundNew = false; for (DfsPackDescription dsc : scanned) { DfsPackFile oldPack = forReuse.remove(dsc); @@ -483,7 +483,7 @@ public abstract class DfsObjDatabase extends ObjectDatabase { private static Map<DfsPackDescription, DfsPackFile> reuseMap(PackList old) { Map<DfsPackDescription, DfsPackFile> forReuse - = new HashMap<DfsPackDescription, DfsPackFile>(); + = new HashMap<>(); for (DfsPackFile p : old.packs) { if (p.invalid()) { // The pack instance is corrupted, and cannot be safely used diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackCompactor.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackCompactor.java index cc467853bc..0a29ac515f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackCompactor.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackCompactor.java @@ -113,10 +113,10 @@ public class DfsPackCompactor { public DfsPackCompactor(DfsRepository repository) { repo = repository; autoAddSize = 5 * 1024 * 1024; // 5 MiB - srcPacks = new ArrayList<DfsPackFile>(); - exclude = new ArrayList<ObjectIdSet>(4); - newPacks = new ArrayList<DfsPackDescription>(1); - newStats = new ArrayList<PackStatistics>(1); + srcPacks = new ArrayList<>(); + exclude = new ArrayList<>(4); + newPacks = new ArrayList<>(1); + newStats = new ArrayList<>(1); } /** @@ -280,7 +280,7 @@ public class DfsPackCompactor { private List<DfsPackDescription> toPrune() { int cnt = srcPacks.size(); - List<DfsPackDescription> all = new ArrayList<DfsPackDescription>(cnt); + List<DfsPackDescription> all = new ArrayList<>(cnt); for (DfsPackFile pack : srcPacks) all.add(pack.getPackDescription()); return all; @@ -302,7 +302,7 @@ public class DfsPackCompactor { rw = new RevWalk(ctx); added = rw.newFlag("ADDED"); //$NON-NLS-1$ isBase = rw.newFlag("IS_BASE"); //$NON-NLS-1$ - List<RevObject> baseObjects = new BlockList<RevObject>(); + List<RevObject> baseObjects = new BlockList<>(); pm.beginTask(JGitText.get().countingObjects, ProgressMonitor.UNKNOWN); for (DfsPackFile src : srcPacks) { @@ -346,7 +346,7 @@ public class DfsPackCompactor { private List<ObjectIdWithOffset> toInclude(DfsPackFile src, DfsReader ctx) throws IOException { PackIndex srcIdx = src.getPackIndex(ctx); - List<ObjectIdWithOffset> want = new BlockList<ObjectIdWithOffset>( + List<ObjectIdWithOffset> want = new BlockList<>( (int) srcIdx.getObjectCount()); SCAN: for (PackIndex.MutableEntry ent : srcIdx) { ObjectId id = ent.toObjectId(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackDescription.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackDescription.java index 358a921382..e825f1a8be 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackDescription.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackDescription.java @@ -102,7 +102,7 @@ public class DfsPackDescription implements Comparable<DfsPackDescription> { this.repoDesc = repoDesc; int dot = name.lastIndexOf('.'); this.packName = (dot < 0) ? name : name.substring(0, dot); - this.sizeMap = new HashMap<PackExt, Long>(PackExt.values().length * 2); + this.sizeMap = new HashMap<>(PackExt.values().length * 2); } /** @return description of the repository. */ diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java index 5b55880583..755b163127 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java @@ -166,7 +166,7 @@ public final class DfsReader extends ObjectReader implements ObjectReuseAsIs { throws IOException { if (id.isComplete()) return Collections.singleton(id.toObjectId()); - HashSet<ObjectId> matches = new HashSet<ObjectId>(4); + HashSet<ObjectId> matches = new HashSet<>(4); PackList packList = db.getPackList(); resolveImpl(packList, id, matches); if (matches.size() < MAX_RESOLVE_MATCHES && packList.dirty()) { @@ -319,7 +319,7 @@ public final class DfsReader extends ObjectReader implements ObjectReuseAsIs { findAllImpl(db.scanPacks(packList), pending, r); } for (T t : pending) { - r.add(new FoundObject<T>(t)); + r.add(new FoundObject<>(t)); } Collections.sort(r, FOUND_OBJECT_SORT); return r; @@ -340,7 +340,7 @@ public final class DfsReader extends ObjectReader implements ObjectReuseAsIs { try { long p = lastPack.findOffset(this, t); if (0 < p) { - r.add(new FoundObject<T>(t, lastIdx, lastPack, p)); + r.add(new FoundObject<>(t, lastIdx, lastPack, p)); it.remove(); continue; } @@ -358,7 +358,7 @@ public final class DfsReader extends ObjectReader implements ObjectReuseAsIs { try { long p = pack.findOffset(this, t); if (0 < p) { - r.add(new FoundObject<T>(t, i, pack, p)); + r.add(new FoundObject<>(t, i, pack, p)); it.remove(); lastIdx = i; lastPack = pack; @@ -612,7 +612,7 @@ public final class DfsReader extends ObjectReader implements ObjectReuseAsIs { private List<DfsObjectToPack> findAllFromPack(DfsPackFile pack, Iterable<ObjectToPack> objects) throws IOException { - List<DfsObjectToPack> tmp = new BlockList<DfsObjectToPack>(); + List<DfsObjectToPack> tmp = new BlockList<>(); PackIndex idx = pack.getPackIndex(this); for (ObjectToPack otp : objects) { long p = idx.findOffset(otp); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsRefDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsRefDatabase.java index 4ddcec1673..b41c18b6c2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsRefDatabase.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsRefDatabase.java @@ -78,7 +78,7 @@ public abstract class DfsRefDatabase extends RefDatabase { */ protected DfsRefDatabase(DfsRepository repository) { this.repository = repository; - this.cache = new AtomicReference<RefCache>(); + this.cache = new AtomicReference<>(); } /** @return the repository the database holds the references of. */ @@ -120,7 +120,7 @@ public abstract class DfsRefDatabase extends RefDatabase { RefCache curr = read(); RefList<Ref> packed = RefList.emptyList(); RefList<Ref> loose = curr.ids; - RefList.Builder<Ref> sym = new RefList.Builder<Ref>(curr.sym.size()); + RefList.Builder<Ref> sym = new RefList.Builder<>(curr.sym.size()); for (int idx = 0; idx < curr.sym.size(); idx++) { Ref ref = curr.sym.get(idx); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/InMemoryRepository.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/InMemoryRepository.java index a31a47e115..527e46b733 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/InMemoryRepository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/InMemoryRepository.java @@ -107,7 +107,7 @@ public class InMemoryRepository extends DfsRepository { } private class MemObjDatabase extends DfsObjDatabase { - private List<DfsPackDescription> packs = new ArrayList<DfsPackDescription>(); + private List<DfsPackDescription> packs = new ArrayList<>(); MemObjDatabase(DfsRepository repo) { super(repo, new DfsReaderOptions()); @@ -132,7 +132,7 @@ public class InMemoryRepository extends DfsRepository { Collection<DfsPackDescription> desc, Collection<DfsPackDescription> replace) { List<DfsPackDescription> n; - n = new ArrayList<DfsPackDescription>(desc.size() + packs.size()); + n = new ArrayList<>(desc.size() + packs.size()); n.addAll(desc); n.addAll(packs); if (replace != null) @@ -170,7 +170,7 @@ public class InMemoryRepository extends DfsRepository { private static class MemPack extends DfsPackDescription { final Map<PackExt, byte[]> - fileMap = new HashMap<PackExt, byte[]>(); + fileMap = new HashMap<>(); MemPack(String name, DfsRepositoryDescription repoDesc) { super(repoDesc, name); @@ -278,7 +278,7 @@ public class InMemoryRepository extends DfsRepository { * subclasses of InMemoryRepository. */ protected class MemRefDatabase extends DfsRefDatabase { - private final ConcurrentMap<String, Ref> refs = new ConcurrentHashMap<String, Ref>(); + private final ConcurrentMap<String, Ref> refs = new ConcurrentHashMap<>(); private final ReadWriteLock lock = new ReentrantReadWriteLock(true /* fair */); /** @@ -315,8 +315,8 @@ public class InMemoryRepository extends DfsRepository { @Override protected RefCache scanAllRefs() throws IOException { - RefList.Builder<Ref> ids = new RefList.Builder<Ref>(); - RefList.Builder<Ref> sym = new RefList.Builder<Ref>(); + RefList.Builder<Ref> ids = new RefList.Builder<>(); + RefList.Builder<Ref> sym = new RefList.Builder<>(); try { lock.readLock().lock(); for (Ref ref : refs.values()) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/BitmapIndexImpl.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/BitmapIndexImpl.java index 7855a460cd..88eef4ce86 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/BitmapIndexImpl.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/BitmapIndexImpl.java @@ -442,10 +442,10 @@ public class BitmapIndexImpl implements BitmapIndex { private static final class MutableBitmapIndex { private final ObjectIdOwnerMap<MutableEntry> - revMap = new ObjectIdOwnerMap<MutableEntry>(); + revMap = new ObjectIdOwnerMap<>(); private final BlockList<MutableEntry> - revList = new BlockList<MutableEntry>(); + revList = new BlockList<>(); int findPosition(AnyObjectId objectId) { MutableEntry entry = revMap.get(objectId); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/CachedObjectDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/CachedObjectDirectory.java index a81d8ec0e9..d47b304688 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/CachedObjectDirectory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/CachedObjectDirectory.java @@ -90,7 +90,7 @@ class CachedObjectDirectory extends FileObjectDatabase { } private ObjectIdOwnerMap<UnpackedObjectId> scanLoose() { - ObjectIdOwnerMap<UnpackedObjectId> m = new ObjectIdOwnerMap<UnpackedObjectId>(); + ObjectIdOwnerMap<UnpackedObjectId> m = new ObjectIdOwnerMap<>(); File objects = wrapped.getDirectory(); String[] fanout = objects.list(); if (fanout == null) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/DeltaBaseCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/DeltaBaseCache.java index a95dea74b6..b3979894e4 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/DeltaBaseCache.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/DeltaBaseCache.java @@ -69,7 +69,7 @@ class DeltaBaseCache { private int openByteCount; static { - DEAD = new SoftReference<Entry>(null); + DEAD = new SoftReference<>(null); reconfigure(new WindowCacheConfig()); } @@ -115,7 +115,7 @@ class DeltaBaseCache { e.provider = pack; e.position = position; e.sz = data.length; - e.data = new SoftReference<Entry>(new Entry(data, objectType)); + e.data = new SoftReference<>(new Entry(data, objectType)); moveToHead(e); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java index 16315a5b55..ba52251a4c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileRepository.java @@ -490,7 +490,7 @@ public class FileRepository extends Repository { */ @Override public Set<ObjectId> getAdditionalHaves() { - HashSet<ObjectId> r = new HashSet<ObjectId>(); + HashSet<ObjectId> r = new HashSet<>(); for (AlternateHandle d : objectDatabase.myAlternates()) { if (d instanceof AlternateRepository) { Repository repo; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java index 353024c9da..c68e5f7f3d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java @@ -453,7 +453,7 @@ public class GC { // Collect all loose objects which are old enough, not referenced from // the index and not in objectsToKeep - Map<ObjectId, File> deletionCandidates = new HashMap<ObjectId, File>(); + Map<ObjectId, File> deletionCandidates = new HashMap<>(); Set<ObjectId> indexObjects = null; File objects = repo.getObjectsDirectory(); String[] fanout = objects.list(); @@ -694,7 +694,7 @@ public class GC { */ public void packRefs() throws IOException { Collection<Ref> refs = repo.getRefDatabase().getRefs(Constants.R_REFS).values(); - List<String> refsToBePacked = new ArrayList<String>(refs.size()); + List<String> refsToBePacked = new ArrayList<>(refs.size()); pm.beginTask(JGitText.get().packRefs, refs.size()); try { for (Ref ref : refs) { @@ -729,10 +729,10 @@ public class GC { long time = System.currentTimeMillis(); Collection<Ref> refsBefore = getAllRefs(); - Set<ObjectId> allHeads = new HashSet<ObjectId>(); - Set<ObjectId> nonHeads = new HashSet<ObjectId>(); - Set<ObjectId> txnHeads = new HashSet<ObjectId>(); - Set<ObjectId> tagTargets = new HashSet<ObjectId>(); + Set<ObjectId> allHeads = new HashSet<>(); + Set<ObjectId> nonHeads = new HashSet<>(); + Set<ObjectId> txnHeads = new HashSet<>(); + Set<ObjectId> tagTargets = new HashSet<>(); Set<ObjectId> indexObjects = listNonHEADIndexObjects(); RefDatabase refdb = repo.getRefDatabase(); @@ -751,7 +751,7 @@ public class GC { tagTargets.add(ref.getPeeledObjectId()); } - List<ObjectIdSet> excluded = new LinkedList<ObjectIdSet>(); + List<ObjectIdSet> excluded = new LinkedList<>(); for (final PackFile f : repo.getObjectDatabase().getPacks()) { checkCancelled(); if (f.shouldBeKept()) @@ -761,7 +761,7 @@ public class GC { tagTargets.addAll(allHeads); nonHeads.addAll(indexObjects); - List<PackFile> ret = new ArrayList<PackFile>(2); + List<PackFile> ret = new ArrayList<>(2); PackFile heads = null; if (!allHeads.isEmpty()) { heads = writePack(allHeads, Collections.<ObjectId> emptySet(), @@ -863,7 +863,7 @@ public class GC { .getReverseEntries(); if (rlEntries == null || rlEntries.isEmpty()) return Collections.<ObjectId> emptySet(); - Set<ObjectId> ret = new HashSet<ObjectId>(); + Set<ObjectId> ret = new HashSet<>(); for (ReflogEntry e : rlEntries) { if (e.getWho().getWhen().getTime() < minTime) break; @@ -932,7 +932,7 @@ public class GC { treeWalk.setFilter(TreeFilter.ANY_DIFF); treeWalk.setRecursive(true); - Set<ObjectId> ret = new HashSet<ObjectId>(); + Set<ObjectId> ret = new HashSet<>(); while (treeWalk.next()) { checkCancelled(); @@ -965,7 +965,7 @@ public class GC { List<ObjectIdSet> excludeObjects) throws IOException { checkCancelled(); File tmpPack = null; - Map<PackExt, File> tmpExts = new TreeMap<PackExt, File>( + Map<PackExt, File> tmpExts = new TreeMap<>( new Comparator<PackExt>() { @Override public int compare(PackExt o1, PackExt o2) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java index 2f4d2d633c..1aa71e5a59 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java @@ -169,12 +169,12 @@ public class ObjectDirectory extends FileObjectDatabase { packDirectory = new File(objects, "pack"); //$NON-NLS-1$ preservedDirectory = new File(packDirectory, "preserved"); //$NON-NLS-1$ alternatesFile = new File(infoDirectory, "alternates"); //$NON-NLS-1$ - packList = new AtomicReference<PackList>(NO_PACKS); + packList = new AtomicReference<>(NO_PACKS); unpackedObjectCache = new UnpackedObjectCache(); this.fs = fs; this.shallowFile = shallowFile; - alternates = new AtomicReference<AlternateHandle[]>(); + alternates = new AtomicReference<>(); if (alternatePaths != null) { AlternateHandle[] alt; @@ -700,7 +700,7 @@ public class ObjectDirectory extends FileObjectDatabase { if (shallowFileSnapshot == null || shallowFileSnapshot.isModified(shallowFile)) { - shallowCommitsIds = new HashSet<ObjectId>(); + shallowCommitsIds = new HashSet<>(); final BufferedReader reader = open(shallowFile); try { @@ -797,7 +797,7 @@ public class ObjectDirectory extends FileObjectDatabase { final Map<String, PackFile> forReuse = reuseMap(old); final FileSnapshot snapshot = FileSnapshot.save(packDirectory); final Set<String> names = listPackDirectory(); - final List<PackFile> list = new ArrayList<PackFile>(names.size() >> 2); + final List<PackFile> list = new ArrayList<>(names.size() >> 2); boolean foundNew = false; for (final String indexName : names) { // Must match "pack-[0-9a-f]{40}.idx" to be an index. @@ -855,7 +855,7 @@ public class ObjectDirectory extends FileObjectDatabase { } private static Map<String, PackFile> reuseMap(final PackList old) { - final Map<String, PackFile> forReuse = new HashMap<String, PackFile>(); + final Map<String, PackFile> forReuse = new HashMap<>(); for (final PackFile p : old.packs) { if (p.invalid()) { // The pack instance is corrupted, and cannot be safely used @@ -884,7 +884,7 @@ public class ObjectDirectory extends FileObjectDatabase { final String[] nameList = packDirectory.list(); if (nameList == null) return Collections.emptySet(); - final Set<String> nameSet = new HashSet<String>(nameList.length << 1); + final Set<String> nameSet = new HashSet<>(nameList.length << 1); for (final String name : nameList) { if (name.startsWith("pack-")) //$NON-NLS-1$ nameSet.add(name); @@ -911,7 +911,7 @@ public class ObjectDirectory extends FileObjectDatabase { } private AlternateHandle[] loadAlternates() throws IOException { - final List<AlternateHandle> l = new ArrayList<AlternateHandle>(4); + final List<AlternateHandle> l = new ArrayList<>(4); final BufferedReader br = open(alternatesFile); try { String line; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexBuilder.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexBuilder.java index d80abaa9c3..bfd60fc535 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexBuilder.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexBuilder.java @@ -75,9 +75,9 @@ public class PackBitmapIndexBuilder extends BasePackBitmapIndex { private final EWAHCompressedBitmap tags; private final BlockList<PositionEntry> byOffset; final BlockList<StoredBitmap> - byAddOrder = new BlockList<StoredBitmap>(); + byAddOrder = new BlockList<>(); final ObjectIdOwnerMap<PositionEntry> - positionEntries = new ObjectIdOwnerMap<PositionEntry>(); + positionEntries = new ObjectIdOwnerMap<>(); /** * Creates a PackBitmapIndex used for building the contents of an index diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexRemapper.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexRemapper.java index 6b5b8826ea..9a8c2752dd 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexRemapper.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexRemapper.java @@ -107,7 +107,7 @@ public class PackBitmapIndexRemapper extends PackBitmapIndex BasePackBitmapIndex oldPackIndex, PackBitmapIndex newPackIndex) { this.oldPackIndex = oldPackIndex; this.newPackIndex = newPackIndex; - convertedBitmaps = new ObjectIdOwnerMap<StoredBitmap>(); + convertedBitmaps = new ObjectIdOwnerMap<>(); inflated = new BitSet(newPackIndex.getObjectCount()); prevToNewMapping = new int[oldPackIndex.getObjectCount()]; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java index 542570a2db..24d51a5ea6 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java @@ -153,10 +153,10 @@ public class RefDirectory extends RefDatabase { * converted into resolved references during a get operation, ensuring the * live value is always returned. */ - private final AtomicReference<RefList<LooseRef>> looseRefs = new AtomicReference<RefList<LooseRef>>(); + private final AtomicReference<RefList<LooseRef>> looseRefs = new AtomicReference<>(); /** Immutable sorted list of packed references. */ - final AtomicReference<PackedRefList> packedRefs = new AtomicReference<PackedRefList>(); + final AtomicReference<PackedRefList> packedRefs = new AtomicReference<>(); /** * Number of modifications made to this database. @@ -352,7 +352,7 @@ public class RefDirectory extends RefDatabase { @Override public List<Ref> getAdditionalRefs() throws IOException { - List<Ref> ret = new LinkedList<Ref>(); + List<Ref> ret = new LinkedList<>(); for (String name : additionalRefsNames) { Ref r = getRef(name); if (r != null) @@ -371,7 +371,7 @@ public class RefDirectory extends RefDatabase { private int curIdx; - final RefList.Builder<Ref> symbolic = new RefList.Builder<Ref>(4); + final RefList.Builder<Ref> symbolic = new RefList.Builder<>(4); RefList.Builder<LooseRef> newLoose; @@ -819,7 +819,7 @@ public class RefDirectory extends RefDatabase { private RefList<Ref> parsePackedRefs(final BufferedReader br) throws IOException { - RefList.Builder<Ref> all = new RefList.Builder<Ref>(); + RefList.Builder<Ref> all = new RefList.Builder<>(); Ref last = null; boolean peeled = false; boolean needSort = false; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ReflogReaderImpl.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ReflogReaderImpl.java index 490da46952..c3702fecab 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ReflogReaderImpl.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ReflogReaderImpl.java @@ -132,7 +132,7 @@ class ReflogReaderImpl implements ReflogReader { } int rs = RawParseUtils.prevLF(log, log.length); - List<ReflogEntry> ret = new ArrayList<ReflogEntry>(); + List<ReflogEntry> ret = new ArrayList<>(); while (rs >= 0 && max-- > 0) { rs = RawParseUtils.prevLF(log, rs); ReflogEntry entry = new ReflogEntryImpl(log, rs < 0 ? 0 : rs + 2); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObjectCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObjectCache.java index ce67ae07ad..967754a627 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObjectCache.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/UnpackedObjectCache.java @@ -100,7 +100,7 @@ class UnpackedObjectCache { final int bits; Table(int bits) { - this.ids = new AtomicReferenceArray<ObjectId>(1 << bits); + this.ids = new AtomicReferenceArray<>(1 << bits); this.shift = 32 - bits; this.bits = bits; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCache.java index e1b7606df2..a525c85116 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCache.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCache.java @@ -235,9 +235,9 @@ public class WindowCache { if (lockCount < 1) throw new IllegalArgumentException(JGitText.get().lockCountMustBeGreaterOrEqual1); - queue = new ReferenceQueue<ByteWindow>(); + queue = new ReferenceQueue<>(); clock = new AtomicLong(1); - table = new AtomicReferenceArray<Entry>(tableSize); + table = new AtomicReferenceArray<>(tableSize); locks = new Lock[lockCount]; for (int i = 0; i < locks.length; i++) locks[i] = new Lock(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCursor.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCursor.java index 27215502ba..83b236ed96 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCursor.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/WindowCursor.java @@ -142,7 +142,7 @@ final class WindowCursor extends ObjectReader implements ObjectReuseAsIs { throws IOException { if (id.isComplete()) return Collections.singleton(id.toObjectId()); - HashSet<ObjectId> matches = new HashSet<ObjectId>(4); + HashSet<ObjectId> matches = new HashSet<>(4); db.resolve(matches, id); return matches; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/BaseSearch.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/BaseSearch.java index b6af0b03f5..d231ccb997 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/BaseSearch.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/BaseSearch.java @@ -96,7 +96,7 @@ class BaseSearch { edgeObjects = edges; alreadyProcessed = new IntSet(); - treeCache = new ObjectIdOwnerMap<TreeWithData>(); + treeCache = new ObjectIdOwnerMap<>(); parser = new CanonicalTreeParser(); idBuf = new MutableObjectId(); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaCache.java index 91917b2812..973dd1de37 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaCache.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaCache.java @@ -60,7 +60,7 @@ class DeltaCache { DeltaCache(PackConfig pc) { size = pc.getDeltaCacheSize(); entryLimit = pc.getDeltaCacheLimit(); - queue = new ReferenceQueue<byte[]>(); + queue = new ReferenceQueue<>(); } boolean canCache(int length, ObjectToPack src, ObjectToPack res) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaTask.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaTask.java index 635cb8d8d7..0c4e4448d8 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaTask.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaTask.java @@ -78,7 +78,7 @@ final class DeltaTask implements Callable<Object> { Block(int threads, PackConfig config, ObjectReader reader, DeltaCache dc, ThreadSafeProgressMonitor pm, ObjectToPack[] list, int begin, int end) { - this.tasks = new ArrayList<DeltaTask>(threads); + this.tasks = new ArrayList<>(threads); this.threads = threads; this.config = config; this.templateReader = reader; @@ -176,7 +176,7 @@ final class DeltaTask implements Callable<Object> { } private ArrayList<WeightedPath> computeTopPaths() { - ArrayList<WeightedPath> topPaths = new ArrayList<WeightedPath>( + ArrayList<WeightedPath> topPaths = new ArrayList<>( threads); int cp = beginIndex; int ch = list[cp].getPathHash(); @@ -277,7 +277,7 @@ final class DeltaTask implements Callable<Object> { DeltaTask(Block b) { this.block = b; - this.slices = new LinkedList<Slice>(); + this.slices = new LinkedList<>(); } void add(Slice s) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java index 37354d3e61..93dbee3e79 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java @@ -167,7 +167,7 @@ public class PackWriter implements AutoCloseable { public static final Set<ObjectId> NONE = Collections.emptySet(); private static final Map<WeakReference<PackWriter>, Boolean> instances = - new ConcurrentHashMap<WeakReference<PackWriter>, Boolean>(); + new ConcurrentHashMap<>(); private static final Iterable<PackWriter> instancesIterable = new Iterable<PackWriter>() { @Override @@ -217,21 +217,21 @@ public class PackWriter implements AutoCloseable { @SuppressWarnings("unchecked") BlockList<ObjectToPack> objectsLists[] = new BlockList[OBJ_TAG + 1]; { - objectsLists[OBJ_COMMIT] = new BlockList<ObjectToPack>(); - objectsLists[OBJ_TREE] = new BlockList<ObjectToPack>(); - objectsLists[OBJ_BLOB] = new BlockList<ObjectToPack>(); - objectsLists[OBJ_TAG] = new BlockList<ObjectToPack>(); + objectsLists[OBJ_COMMIT] = new BlockList<>(); + objectsLists[OBJ_TREE] = new BlockList<>(); + objectsLists[OBJ_BLOB] = new BlockList<>(); + objectsLists[OBJ_TAG] = new BlockList<>(); } - private ObjectIdOwnerMap<ObjectToPack> objectsMap = new ObjectIdOwnerMap<ObjectToPack>(); + private ObjectIdOwnerMap<ObjectToPack> objectsMap = new ObjectIdOwnerMap<>(); // edge objects for thin packs - private List<ObjectToPack> edgeObjects = new BlockList<ObjectToPack>(); + private List<ObjectToPack> edgeObjects = new BlockList<>(); // Objects the client is known to have already. private BitmapBuilder haveObjects; - private List<CachedPack> cachedPacks = new ArrayList<CachedPack>(2); + private List<CachedPack> cachedPacks = new ArrayList<>(2); private Set<ObjectId> tagTargets = Collections.emptySet(); @@ -359,7 +359,7 @@ public class PackWriter implements AutoCloseable { reuseValidate = true; // be paranoid by default stats = new PackStatistics.Accumulator(); state = new MutableState(); - selfRef = new WeakReference<PackWriter>(this); + selfRef = new WeakReference<>(this); instances.put(selfRef, Boolean.TRUE); } @@ -387,7 +387,7 @@ public class PackWriter implements AutoCloseable { */ public void setClientShallowCommits(Set<ObjectId> clientShallowCommits) { stats.clientShallowCommits = Collections - .unmodifiableSet(new HashSet<ObjectId>(clientShallowCommits)); + .unmodifiableSet(new HashSet<>(clientShallowCommits)); } /** @@ -918,7 +918,7 @@ public class PackWriter implements AutoCloseable { cnt += objectsLists[OBJ_BLOB].size(); cnt += objectsLists[OBJ_TAG].size(); - sortedByName = new BlockList<ObjectToPack>(cnt); + sortedByName = new BlockList<>(cnt); sortedByName.addAll(objectsLists[OBJ_COMMIT]); sortedByName.addAll(objectsLists[OBJ_TREE]); sortedByName.addAll(objectsLists[OBJ_BLOB]); @@ -1112,7 +1112,7 @@ public class PackWriter implements AutoCloseable { beginPhase(PackingPhase.FINDING_SOURCES, monitor, cnt); if (cnt <= 4096) { // For small object counts, do everything as one list. - BlockList<ObjectToPack> tmp = new BlockList<ObjectToPack>((int) cnt); + BlockList<ObjectToPack> tmp = new BlockList<>((int) cnt); tmp.addAll(objectsLists[OBJ_TAG]); tmp.addAll(objectsLists[OBJ_COMMIT]); tmp.addAll(objectsLists[OBJ_TREE]); @@ -1447,7 +1447,7 @@ public class PackWriter implements AutoCloseable { private static void runTasks(ExecutorService pool, ThreadSafeProgressMonitor pm, DeltaTask.Block tb, List<Throwable> errors) throws IOException { - List<Future<?>> futures = new ArrayList<Future<?>>(tb.tasks.size()); + List<Future<?>> futures = new ArrayList<>(tb.tasks.size()); for (DeltaTask task : tb.tasks) futures.add(pool.submit(task)); @@ -1676,7 +1676,7 @@ public class PackWriter implements AutoCloseable { } } - List<ObjectId> all = new ArrayList<ObjectId>(want.size() + have.size()); + List<ObjectId> all = new ArrayList<>(want.size() + have.size()); all.addAll(want); all.addAll(have); @@ -1694,9 +1694,9 @@ public class PackWriter implements AutoCloseable { walker.sort(RevSort.BOUNDARY, true); } - List<RevObject> wantObjs = new ArrayList<RevObject>(want.size()); - List<RevObject> haveObjs = new ArrayList<RevObject>(haveEst); - List<RevTag> wantTags = new ArrayList<RevTag>(want.size()); + List<RevObject> wantObjs = new ArrayList<>(want.size()); + List<RevObject> haveObjs = new ArrayList<>(haveEst); + List<RevTag> wantTags = new ArrayList<>(want.size()); // Retrieve the RevWalk's versions of "want" and "have" objects to // maintain any state previously set in the RevWalk. @@ -1727,7 +1727,7 @@ public class PackWriter implements AutoCloseable { } if (!wantTags.isEmpty()) { - all = new ArrayList<ObjectId>(wantTags.size()); + all = new ArrayList<>(wantTags.size()); for (RevTag tag : wantTags) all.add(tag.getObject()); q = walker.parseAny(all, true); @@ -1770,8 +1770,8 @@ public class PackWriter implements AutoCloseable { walker.markUninteresting(obj); final int maxBases = config.getDeltaSearchWindowSize(); - Set<RevTree> baseTrees = new HashSet<RevTree>(); - BlockList<RevCommit> commits = new BlockList<RevCommit>(); + Set<RevTree> baseTrees = new HashSet<>(); + BlockList<RevCommit> commits = new BlockList<>(); Set<ObjectId> roots = new HashSet<>(); RevCommit c; while ((c = walker.next()) != null) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapPreparer.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapPreparer.java index 2c2c80eb84..07a03b4040 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapPreparer.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapPreparer.java @@ -168,7 +168,7 @@ class PackWriterBitmapPreparer { pm.endTask(); int totCommits = selectionHelper.getCommitCount(); - BlockList<BitmapCommit> selections = new BlockList<BitmapCommit>( + BlockList<BitmapCommit> selections = new BlockList<>( totCommits / recentCommitSpan + 1); for (BitmapCommit reuse : selectionHelper.reusedCommits) { selections.add(reuse); @@ -195,7 +195,7 @@ class PackWriterBitmapPreparer { // better compression/on the run-length encoding of the XORs between // them. List<List<BitmapCommit>> chains = - new ArrayList<List<BitmapCommit>>(); + new ArrayList<>(); // Mark the current branch as inactive if its tip commit isn't // recent and there are an excessive number of branches, to @@ -287,7 +287,7 @@ class PackWriterBitmapPreparer { } if (longestAncestorChain == null) { - longestAncestorChain = new ArrayList<BitmapCommit>(); + longestAncestorChain = new ArrayList<>(); chains.add(longestAncestorChain); } longestAncestorChain.add(new BitmapCommit( @@ -376,7 +376,7 @@ class PackWriterBitmapPreparer { int expectedCommitCount) throws IncorrectObjectTypeException, IOException, MissingObjectException { BitmapBuilder reuse = commitBitmapIndex.newBitmapBuilder(); - List<BitmapCommit> reuseCommits = new ArrayList<BitmapCommit>(); + List<BitmapCommit> reuseCommits = new ArrayList<>(); for (PackBitmapIndexRemapper.Entry entry : bitmapRemapper) { // More recent commits did not have the reuse flag set, so skip them if ((entry.getFlags() & FLAG_REUSE) != FLAG_REUSE) { @@ -398,9 +398,9 @@ class PackWriterBitmapPreparer { // Add branch tips that are not represented in old bitmap indices. Set // up the RevWalk to walk the new commits not in the old packs. - List<BitmapBuilderEntry> tipCommitBitmaps = new ArrayList<BitmapBuilderEntry>( + List<BitmapBuilderEntry> tipCommitBitmaps = new ArrayList<>( want.size()); - Set<RevCommit> peeledWant = new HashSet<RevCommit>(want.size()); + Set<RevCommit> peeledWant = new HashSet<>(want.size()); for (AnyObjectId objectId : want) { RevObject ro = rw.peel(rw.parseAny(objectId)); if (!(ro instanceof RevCommit) || reuse.contains(ro)) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java index 670f9a9e14..de1003bdde 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BaseRepositoryBuilder.java @@ -218,7 +218,7 @@ public class BaseRepositoryBuilder<B extends BaseRepositoryBuilder, R extends Re public B addAlternateObjectDirectory(File other) { if (other != null) { if (alternateObjectDirectories == null) - alternateObjectDirectories = new LinkedList<File>(); + alternateObjectDirectories = new LinkedList<>(); alternateObjectDirectories.add(other); } return self(); @@ -429,7 +429,7 @@ public class BaseRepositoryBuilder<B extends BaseRepositoryBuilder, R extends Re public B addCeilingDirectory(File root) { if (root != null) { if (ceilingDirectories == null) - ceilingDirectories = new LinkedList<File>(); + ceilingDirectories = new LinkedList<>(); ceilingDirectories.add(root); } return self(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BatchRefUpdate.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BatchRefUpdate.java index 653c9f66b6..3f6995de83 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/BatchRefUpdate.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/BatchRefUpdate.java @@ -120,7 +120,7 @@ public class BatchRefUpdate { */ protected BatchRefUpdate(RefDatabase refdb) { this.refdb = refdb; - this.commands = new ArrayList<ReceiveCommand>(); + this.commands = new ArrayList<>(); this.atomic = refdb.performsAtomicTransactions(); } @@ -400,7 +400,7 @@ public class BatchRefUpdate { } monitor.beginTask(JGitText.get().updatingReferences, commands.size()); - List<ReceiveCommand> commands2 = new ArrayList<ReceiveCommand>( + List<ReceiveCommand> commands2 = new ArrayList<>( commands.size()); // First delete refs. This may free the name space for some of the // updates. @@ -431,7 +431,7 @@ public class BatchRefUpdate { } if (!commands2.isEmpty()) { // What part of the name space is already taken - Collection<String> takenNames = new HashSet<String>(refdb.getRefs( + Collection<String> takenNames = new HashSet<>(refdb.getRefs( RefDatabase.ALL).keySet()); Collection<String> takenPrefixes = getTakenPrefixes(takenNames); @@ -525,7 +525,7 @@ public class BatchRefUpdate { private static Collection<String> getTakenPrefixes( final Collection<String> names) { - Collection<String> ref = new HashSet<String>(); + Collection<String> ref = new HashSet<>(); for (String name : names) ref.addAll(getPrefixes(name)); return ref; @@ -539,7 +539,7 @@ public class BatchRefUpdate { } static Collection<String> getPrefixes(String s) { - Collection<String> ret = new HashSet<String>(); + Collection<String> ret = new HashSet<>(); int p1 = s.indexOf('/'); while (p1 > 0) { ret.add(s.substring(0, p1)); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java index ec771a24f0..f45c71cf95 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java @@ -122,7 +122,7 @@ public class Config { */ public Config(Config defaultConfig) { baseConfig = defaultConfig; - state = new AtomicReference<ConfigSnapshot>(newState()); + state = new AtomicReference<>(newState()); } /** @@ -960,7 +960,7 @@ public class Config { final String section, final String subsection) { final int max = srcState.entryList.size(); - final ArrayList<ConfigLine> r = new ArrayList<ConfigLine>(max); + final ArrayList<ConfigLine> r = new ArrayList<>(max); boolean lastWasMatch = false; for (ConfigLine e : srcState.entryList) { @@ -1075,7 +1075,7 @@ public class Config { // for a new section header. Assume that and allocate the space. // final int max = src.entryList.size() + values.size() + 1; - final ArrayList<ConfigLine> r = new ArrayList<ConfigLine>(max); + final ArrayList<ConfigLine> r = new ArrayList<>(max); r.addAll(src.entryList); return r; } @@ -1163,7 +1163,7 @@ public class Config { throw new ConfigInvalidException( JGitText.get().tooManyIncludeRecursions); } - final List<ConfigLine> newEntries = new ArrayList<ConfigLine>(); + final List<ConfigLine> newEntries = new ArrayList<>(); final StringReader in = new StringReader(text); ConfigLine last = null; ConfigLine e = new ConfigLine(); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigSnapshot.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigSnapshot.java index 90c42ea168..f5ada13a38 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigSnapshot.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigSnapshot.java @@ -78,7 +78,7 @@ class ConfigSnapshot { ConfigSnapshot(List<ConfigLine> entries, ConfigSnapshot base) { entryList = entries; - cache = new ConcurrentHashMap<Object, Object>(16, 0.75f, 1); + cache = new ConcurrentHashMap<>(16, 0.75f, 1); baseState = base; } @@ -112,7 +112,7 @@ class ConfigSnapshot { if (idx < 0) idx = -(idx + 1); - Map<String, String> m = new LinkedHashMap<String, String>(); + Map<String, String> m = new LinkedHashMap<>(); while (idx < s.size()) { ConfigLine e = s.get(idx++); if (!e.match(section, subsection)) @@ -187,7 +187,7 @@ class ConfigSnapshot { } private static List<ConfigLine> sort(List<ConfigLine> in) { - List<ConfigLine> sorted = new ArrayList<ConfigLine>(in.size()); + List<ConfigLine> sorted = new ArrayList<>(in.size()); for (ConfigLine line : in) { if (line.section != null && line.name != null) sorted.add(line); @@ -237,8 +237,8 @@ class ConfigSnapshot { final Map<String, Set<String>> subsections; SectionNames(ConfigSnapshot cfg) { - Map<String, String> sec = new LinkedHashMap<String, String>(); - Map<String, Set<String>> sub = new HashMap<String, Set<String>>(); + Map<String, String> sec = new LinkedHashMap<>(); + Map<String, Set<String>> sub = new HashMap<>(); while (cfg != null) { for (ConfigLine e : cfg.entryList) { if (e.section == null) @@ -253,7 +253,7 @@ class ConfigSnapshot { Set<String> m = sub.get(l1); if (m == null) { - m = new LinkedHashSet<String>(); + m = new LinkedHashSet<>(); sub.put(l1, m); } m.add(e.subsection); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java index b845fad03f..e544b72a85 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java @@ -253,19 +253,19 @@ public class IndexDiff { private final WorkingTreeIterator initialWorkingTreeIterator; - private Set<String> added = new HashSet<String>(); + private Set<String> added = new HashSet<>(); - private Set<String> changed = new HashSet<String>(); + private Set<String> changed = new HashSet<>(); - private Set<String> removed = new HashSet<String>(); + private Set<String> removed = new HashSet<>(); - private Set<String> missing = new HashSet<String>(); + private Set<String> missing = new HashSet<>(); - private Set<String> modified = new HashSet<String>(); + private Set<String> modified = new HashSet<>(); - private Set<String> untracked = new HashSet<String>(); + private Set<String> untracked = new HashSet<>(); - private Map<String, StageState> conflicts = new HashMap<String, StageState>(); + private Map<String, StageState> conflicts = new HashMap<>(); private Set<String> ignored; @@ -275,11 +275,11 @@ public class IndexDiff { private IndexDiffFilter indexDiffFilter; - private Map<String, IndexDiff> submoduleIndexDiffs = new HashMap<String, IndexDiff>(); + private Map<String, IndexDiff> submoduleIndexDiffs = new HashMap<>(); private IgnoreSubmoduleMode ignoreSubmoduleMode = null; - private Map<FileMode, Set<String>> fileModes = new HashMap<FileMode, Set<String>>(); + private Map<FileMode, Set<String>> fileModes = new HashMap<>(); /** * Construct an IndexDiff @@ -417,7 +417,7 @@ public class IndexDiff { treeWalk.addTree(new DirCacheIterator(dirCache)); treeWalk.addTree(initialWorkingTreeIterator); initialWorkingTreeIterator.setDirCacheIterator(treeWalk, 1); - Collection<TreeFilter> filters = new ArrayList<TreeFilter>(4); + Collection<TreeFilter> filters = new ArrayList<>(4); if (monitor != null) { // Get the maximum size of the work tree and index @@ -518,7 +518,7 @@ public class IndexDiff { String path = treeWalk.getPathString(); if (path != null) { if (values == null) - values = new HashSet<String>(); + values = new HashSet<>(); values.add(path); fileModes.put(treeWalk.getFileMode(i), values); } @@ -687,7 +687,7 @@ public class IndexDiff { */ public Set<String> getAssumeUnchanged() { if (assumeUnchanged == null) { - HashSet<String> unchanged = new HashSet<String>(); + HashSet<String> unchanged = new HashSet<>(); for (int i = 0; i < dirCache.getEntryCount(); i++) if (dirCache.getEntry(i).isAssumeValid()) unchanged.add(dirCache.getEntry(i).getPathString()); @@ -701,7 +701,7 @@ public class IndexDiff { */ public Set<String> getUntrackedFolders() { return ((indexDiffFilter == null) ? Collections.<String> emptySet() - : new HashSet<String>(indexDiffFilter.getUntrackedFolders())); + : new HashSet<>(indexDiffFilter.getUntrackedFolders())); } /** @@ -727,7 +727,7 @@ public class IndexDiff { public Set<String> getPathsWithIndexMode(final FileMode mode) { Set<String> paths = fileModes.get(mode); if (paths == null) - paths = new HashSet<String>(); + paths = new HashSet<>(); return paths; } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java index feecbd81c0..9d3aee1508 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java @@ -611,7 +611,7 @@ public class ObjectChecker { int ptr = 0; int lastNameB = 0, lastNameE = 0, lastMode = 0; Set<String> normalized = windows || macosx - ? new HashSet<String>() + ? new HashSet<>() : null; while (ptr < sz) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java index b79a02c64d..f39f291899 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectReader.java @@ -134,7 +134,7 @@ public abstract class ObjectReader implements AutoCloseable { Collection<ObjectId> matches = resolve(abbrev); while (1 < matches.size() && len < Constants.OBJECT_ID_STRING_LENGTH) { abbrev = objectId.abbreviate(++len); - List<ObjectId> n = new ArrayList<ObjectId>(8); + List<ObjectId> n = new ArrayList<>(8); for (ObjectId candidate : matches) { if (abbrev.prefixCompare(candidate) == 0) n.add(candidate); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoFile.java index 75a3592213..1047a6df99 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoFile.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoFile.java @@ -89,7 +89,7 @@ public class RebaseTodoFile { byte[] buf = IO.readFully(new File(repo.getDirectory(), path)); int ptr = 0; int tokenBegin = 0; - List<RebaseTodoLine> r = new LinkedList<RebaseTodoLine>(); + List<RebaseTodoLine> r = new LinkedList<>(); while (ptr < buf.length) { tokenBegin = ptr; ptr = RawParseUtils.nextLF(buf, ptr); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefComparator.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefComparator.java index 91b0319f4f..95e338685a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefComparator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefComparator.java @@ -73,7 +73,7 @@ public class RefComparator implements Comparator<Ref> { * @return sorted collection of refs */ public static Collection<Ref> sort(final Collection<Ref> refs) { - final List<Ref> r = new ArrayList<Ref>(refs); + final List<Ref> r = new ArrayList<>(refs); Collections.sort(r, INSTANCE); return r; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDatabase.java index 517c8aa538..59a104b60f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDatabase.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RefDatabase.java @@ -150,7 +150,7 @@ public abstract class RefDatabase { lastSlash = name.lastIndexOf('/', lastSlash - 1); } - List<String> conflicting = new ArrayList<String>(); + List<String> conflicting = new ArrayList<>(); // Cannot be the container of an existing reference. String prefix = name + '/'; for (String existing : allRefs.keySet()) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java index c59224e3ae..e2f6c3c711 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java @@ -1053,7 +1053,7 @@ public abstract class Repository implements AutoCloseable { try { return getRefDatabase().getRefs(RefDatabase.ALL); } catch (IOException e) { - return new HashMap<String, Ref>(); + return new HashMap<>(); } } @@ -1067,7 +1067,7 @@ public abstract class Repository implements AutoCloseable { try { return getRefDatabase().getRefs(Constants.R_TAGS); } catch (IOException e) { - return new HashMap<String, Ref>(); + return new HashMap<>(); } } @@ -1102,7 +1102,7 @@ public abstract class Repository implements AutoCloseable { @NonNull public Map<AnyObjectId, Set<Ref>> getAllRefsByPeeledObjectId() { Map<String, Ref> allRefs = getAllRefs(); - Map<AnyObjectId, Set<Ref>> ret = new HashMap<AnyObjectId, Set<Ref>>(allRefs.size()); + Map<AnyObjectId, Set<Ref>> ret = new HashMap<>(allRefs.size()); for (Ref ref : allRefs.values()) { ref = peel(ref); AnyObjectId target = ref.getPeeledObjectId(); @@ -1114,7 +1114,7 @@ public abstract class Repository implements AutoCloseable { // that was not the case (rare) if (oset.size() == 1) { // Was a read-only singleton, we must copy to a new Set - oset = new HashSet<Ref>(oset); + oset = new HashSet<>(oset); } ret.put(target, oset); oset.add(ref); @@ -1576,7 +1576,7 @@ public abstract class Repository implements AutoCloseable { if (raw == null) return null; - LinkedList<ObjectId> heads = new LinkedList<ObjectId>(); + LinkedList<ObjectId> heads = new LinkedList<>(); for (int p = 0; p < raw.length;) { heads.add(ObjectId.fromString(raw, p)); p = RawParseUtils diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java index 2f1a9e1cda..baa5286862 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RepositoryCache.java @@ -300,7 +300,7 @@ public class RepositoryCache { } private Collection<Key> getKeys() { - return new ArrayList<Key>(cacheMap.keySet()); + return new ArrayList<>(cacheMap.keySet()); } private void clearAllExpired() { 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 <S extends Sequence> MergeResult<S> merge( SequenceComparator<S> cmp, S base, S ours, S theirs) { - List<S> sequences = new ArrayList<S>(3); + List<S> sequences = new ArrayList<>(3); sequences.add(base); sequences.add(ours); sequences.add(theirs); - MergeResult<S> result = new MergeResult<S>(sequences); + MergeResult<S> 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<String> names = new ArrayList<String>(3); + List<String> 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<String> branches = new ArrayList<String>(); - List<String> remoteBranches = new ArrayList<String>(); - List<String> tags = new ArrayList<String>(); - List<String> commits = new ArrayList<String>(); - List<String> others = new ArrayList<String>(); + List<String> branches = new ArrayList<>(); + List<String> remoteBranches = new ArrayList<>(); + List<String> tags = new ArrayList<>(); + List<String> commits = new ArrayList<>(); + List<String> 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<String> listings = new ArrayList<String>(); + List<String> 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<String, MergeStrategy> STRATEGIES = new HashMap<String, MergeStrategy>(); + private static final HashMap<String, MergeStrategy> 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<RevCommit> baseCommits = new ArrayList<RevCommit>(); + ArrayList<RevCommit> 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<RevCommit> parents = new ArrayList<RevCommit>(); + List<RevCommit> 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<String> unmergedPaths = new ArrayList<String>(); + protected List<String> unmergedPaths = new ArrayList<>(); /** * Files modified during this merge operation. * * @since 3.4 */ - protected List<String> modifiedFiles = new LinkedList<String>(); + protected List<String> 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<String, DirCacheEntry> toBeCheckedOut = new HashMap<String, DirCacheEntry>(); + protected Map<String, DirCacheEntry> 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<String> toBeDeleted = new ArrayList<String>(); + protected List<String> 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<String, MergeResult<? extends Sequence>> mergeResults = new HashMap<String, MergeResult<? extends Sequence>>(); + protected Map<String, MergeResult<? extends Sequence>> mergeResults = new HashMap<>(); /** * Paths for which the merge failed altogether. * * @since 3.4 */ - protected Map<String, MergeFailureReason> failingPaths = new HashMap<String, MergeFailureReason>(); + protected Map<String, MergeFailureReason> 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<RawText>(Collections + new MergeResult<>(Collections .<RawText> emptyList())); } return true; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/nls/GlobalBundleCache.java b/org.eclipse.jgit/src/org/eclipse/jgit/nls/GlobalBundleCache.java index d880d9b616..fd425abf35 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/nls/GlobalBundleCache.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/nls/GlobalBundleCache.java @@ -65,7 +65,7 @@ import org.eclipse.jgit.errors.TranslationStringMissingException; */ class GlobalBundleCache { private static final Map<Locale, Map<Class, TranslationBundle>> cachedBundles - = new HashMap<Locale, Map<Class, TranslationBundle>>(); + = new HashMap<>(); /** * Looks up for a translation bundle in the global cache. If found returns @@ -87,7 +87,7 @@ class GlobalBundleCache { try { Map<Class, TranslationBundle> bundles = cachedBundles.get(locale); if (bundles == null) { - bundles = new HashMap<Class, TranslationBundle>(); + bundles = new HashMap<>(); cachedBundles.put(locale, bundles); } TranslationBundle bundle = bundles.get(type); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/nls/NLS.java b/org.eclipse.jgit/src/org/eclipse/jgit/nls/NLS.java index 396ad7884d..5e7beed1e5 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/nls/NLS.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/nls/NLS.java @@ -120,7 +120,7 @@ public class NLS { } final private Locale locale; - final private ConcurrentHashMap<Class, TranslationBundle> map = new ConcurrentHashMap<Class, TranslationBundle>(); + final private ConcurrentHashMap<Class, TranslationBundle> map = new ConcurrentHashMap<>(); private NLS(Locale locale) { this.locale = locale; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedFileHeader.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedFileHeader.java index b104a49842..2c8f34e7cd 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedFileHeader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/CombinedFileHeader.java @@ -183,7 +183,7 @@ public class CombinedFileHeader extends FileHeader { protected void parseIndexLine(int ptr, final int eol) { // "index $asha1,$bsha1..$csha1" // - final List<AbbreviatedObjectId> ids = new ArrayList<AbbreviatedObjectId>(); + final List<AbbreviatedObjectId> ids = new ArrayList<>(); while (ptr < eol) { final int comma = nextLF(buf, ptr, ','); if (eol <= comma) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java index 534c827314..eb28a0e2a3 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/FileHeader.java @@ -305,7 +305,7 @@ public class FileHeader extends DiffEntry { if (h.getFileHeader() != this) throw new IllegalArgumentException(JGitText.get().hunkBelongsToAnotherFile); if (hunks == null) - hunks = new ArrayList<HunkHeader>(); + hunks = new ArrayList<>(); hunks.add(h); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/patch/Patch.java b/org.eclipse.jgit/src/org/eclipse/jgit/patch/Patch.java index 40ea77e8ec..10ac449d12 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/patch/Patch.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/patch/Patch.java @@ -83,8 +83,8 @@ public class Patch { /** Create an empty patch. */ public Patch() { - files = new ArrayList<FileHeader>(); - errors = new ArrayList<FormatError>(0); + files = new ArrayList<>(); + errors = new ArrayList<>(0); } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java index 6102a81482..a8eb86e232 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java @@ -74,12 +74,12 @@ public class PlotCommitList<L extends PlotLane> extends private int positionsAllocated; - private final TreeSet<Integer> freePositions = new TreeSet<Integer>(); + private final TreeSet<Integer> freePositions = new TreeSet<>(); - private final HashSet<PlotLane> activeLanes = new HashSet<PlotLane>(32); + private final HashSet<PlotLane> activeLanes = new HashSet<>(32); /** number of (child) commits on a lane */ - private final HashMap<PlotLane, Integer> laneLength = new HashMap<PlotLane, Integer>( + private final HashMap<PlotLane, Integer> laneLength = new HashMap<>( 32); @Override diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java index bdeb01c3aa..be1f07a38c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotWalk.java @@ -107,7 +107,7 @@ public class PlotWalk extends RevWalk { if (set == null) set = Collections.singleton(ref); else { - set = new HashSet<Ref>(set); + set = new HashSet<>(set); set.add(ref); } reverseRefMap.put(ref.getObjectId(), set); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/MergeBaseGenerator.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/MergeBaseGenerator.java index 3609d46e30..5d7e72dd29 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/MergeBaseGenerator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/MergeBaseGenerator.java @@ -87,7 +87,7 @@ class MergeBaseGenerator extends Generator { private int recarryMask; private int mergeBaseAncestor = -1; - private LinkedList<RevCommit> ret = new LinkedList<RevCommit>(); + private LinkedList<RevCommit> ret = new LinkedList<>(); MergeBaseGenerator(final RevWalk w) { walker = w; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java index f98a7d637e..58689981b5 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/ObjectWalk.java @@ -133,7 +133,7 @@ public class ObjectWalk extends RevWalk { public ObjectWalk(ObjectReader or) { super(or); setRetainBody(false); - rootObjects = new ArrayList<RevObject>(); + rootObjects = new ArrayList<>(); pendingObjects = new BlockObjQueue(); objectFilter = ObjectFilter.ALL; pathBuf = new byte[256]; @@ -682,7 +682,7 @@ public class ObjectWalk extends RevWalk { for (RevObject obj : rootObjects) obj.flags &= ~IN_PENDING; - rootObjects = new ArrayList<RevObject>(); + rootObjects = new ArrayList<>(); pendingObjects = new BlockObjQueue(); currVisit = null; freeVisit = null; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommit.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommit.java index 1e91006d47..c641a13311 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommit.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevCommit.java @@ -565,7 +565,7 @@ public class RevCommit extends RevObject { ptr--; final int msgB = RawParseUtils.commitMessage(raw, 0); - final ArrayList<FooterLine> r = new ArrayList<FooterLine>(4); + final ArrayList<FooterLine> r = new ArrayList<>(4); final Charset enc = guessEncoding(); for (;;) { ptr = RawParseUtils.prevLF(raw, ptr); @@ -628,7 +628,7 @@ public class RevCommit extends RevObject { final List<FooterLine> src = getFooterLines(); if (src.isEmpty()) return Collections.emptyList(); - final ArrayList<String> r = new ArrayList<String>(src.size()); + final ArrayList<String> r = new ArrayList<>(src.size()); for (final FooterLine f : src) { if (f.matches(keyName)) r.add(f.getValue()); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevFlagSet.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevFlagSet.java index 1afdeb610f..bb699e08c4 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevFlagSet.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevFlagSet.java @@ -61,7 +61,7 @@ public class RevFlagSet extends AbstractSet<RevFlag> { /** Create an empty set of flags. */ public RevFlagSet() { - active = new ArrayList<RevFlag>(); + active = new ArrayList<>(); } /** @@ -72,7 +72,7 @@ public class RevFlagSet extends AbstractSet<RevFlag> { */ public RevFlagSet(final RevFlagSet s) { mask = s.mask; - active = new ArrayList<RevFlag>(s.active); + active = new ArrayList<>(s.active); } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java index 572ebcd2ec..320f05f440 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalk.java @@ -226,8 +226,8 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable { private RevWalk(ObjectReader or, boolean closeReader) { reader = or; idBuffer = new MutableObjectId(); - objects = new ObjectIdOwnerMap<RevObject>(); - roots = new ArrayList<RevCommit>(); + objects = new ObjectIdOwnerMap<>(); + roots = new ArrayList<>(); queue = new DateRevQueue(); pending = new StartGenerator(this); sorting = EnumSet.of(RevSort.NONE); @@ -931,8 +931,8 @@ public class RevWalk implements Iterable<RevCommit>, AutoCloseable { */ public <T extends ObjectId> AsyncRevObjectQueue parseAny( Iterable<T> objectIds, boolean reportMissing) { - List<T> need = new ArrayList<T>(); - List<RevObject> have = new ArrayList<RevObject>(); + List<T> need = new ArrayList<>(); + List<RevObject> have = new ArrayList<>(); for (T id : objectIds) { RevObject r = objects.get(id); if (r != null && (r.flags & PARSED) != 0) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalkUtils.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalkUtils.java index 11fec31e91..e751d7714c 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalkUtils.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/RevWalkUtils.java @@ -121,7 +121,7 @@ public final class RevWalkUtils { if (end != null) walk.markUninteresting(end); - List<RevCommit> commits = new ArrayList<RevCommit>(); + List<RevCommit> commits = new ArrayList<>(); for (RevCommit c : walk) commits.add(c); return commits; @@ -155,7 +155,7 @@ public final class RevWalkUtils { // Make sure commit is from the same RevWalk commit = revWalk.parseCommit(commit.getId()); revWalk.reset(); - List<Ref> result = new ArrayList<Ref>(); + List<Ref> result = new ArrayList<>(); final int SKEW = 24*3600; // one day clock skew diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java index 1aebaddacd..64cb4ddba8 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/AmazonS3.java @@ -120,7 +120,7 @@ public class AmazonS3 { private static final String X_AMZ_META = "x-amz-meta-"; //$NON-NLS-1$ static { - SIGNED_HEADERS = new HashSet<String>(); + SIGNED_HEADERS = new HashSet<>(); SIGNED_HEADERS.add("content-type"); //$NON-NLS-1$ SIGNED_HEADERS.add("content-md5"); //$NON-NLS-1$ SIGNED_HEADERS.add("date"); //$NON-NLS-1$ @@ -606,7 +606,7 @@ public class AmazonS3 { void authorize(final HttpURLConnection c) throws IOException { final Map<String, List<String>> reqHdr = c.getRequestProperties(); - final SortedMap<String, String> sigHdr = new TreeMap<String, String>(); + final SortedMap<String, String> sigHdr = new TreeMap<>(); for (final Map.Entry<String, List<String>> entry : reqHdr.entrySet()) { final String hdr = entry.getKey(); if (isSignedHeader(hdr)) @@ -664,7 +664,7 @@ public class AmazonS3 { } private final class ListParser extends DefaultHandler { - final List<String> entries = new ArrayList<String>(); + final List<String> entries = new ArrayList<>(); private final String bucket; @@ -680,7 +680,7 @@ public class AmazonS3 { } void list() throws IOException { - final Map<String, String> args = new TreeMap<String, String>(); + final Map<String, String> args = new TreeMap<>(); if (prefix.length() > 0) args.put("prefix", prefix); //$NON-NLS-1$ if (!entries.isEmpty()) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java index aa36aeb1be..c69544930d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java @@ -117,10 +117,10 @@ abstract class BasePackConnection extends BaseConnection { protected boolean statelessRPC; /** Capability tokens advertised by the remote side. */ - private final Set<String> remoteCapablities = new HashSet<String>(); + private final Set<String> remoteCapablities = new HashSet<>(); /** Extra objects the remote has, but which aren't offered as refs. */ - protected final Set<ObjectId> additionalHaves = new HashSet<ObjectId>(); + protected final Set<ObjectId> additionalHaves = new HashSet<>(); BasePackConnection(final PackTransport packTransport) { transport = (Transport) packTransport; @@ -191,7 +191,7 @@ abstract class BasePackConnection extends BaseConnection { } private void readAdvertisedRefsImpl() throws IOException { - final LinkedHashMap<String, Ref> avail = new LinkedHashMap<String, Ref>(); + final LinkedHashMap<String, Ref> avail = new LinkedHashMap<>(); for (;;) { String line; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java index 128ec4e28f..e8d18812f6 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java @@ -260,7 +260,7 @@ public abstract class BasePackFetchConnection extends BasePackConnection if (local != null) { walk = new RevWalk(local); - reachableCommits = new RevCommitList<RevCommit>(); + reachableCommits = new RevCommitList<>(); REACHABLE = walk.newFlag("REACHABLE"); //$NON-NLS-1$ COMMON = walk.newFlag("COMMON"); //$NON-NLS-1$ STATE = walk.newFlag("STATE"); //$NON-NLS-1$ diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java index bb5922d217..679ea0c8fd 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java @@ -328,8 +328,8 @@ public abstract class BasePackPushConnection extends BasePackConnection implemen private void writePack(final Map<String, RemoteRefUpdate> refUpdates, final ProgressMonitor monitor) throws IOException { - Set<ObjectId> remoteObjects = new HashSet<ObjectId>(); - Set<ObjectId> newObjects = new HashSet<ObjectId>(); + Set<ObjectId> remoteObjects = new HashSet<>(); + Set<ObjectId> newObjects = new HashSet<>(); try (final PackWriter writer = new PackWriter(transport.getPackConfig(), local.newObjectReader())) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java index a7e72f1dea..6f94dbbfec 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BaseReceivePack.java @@ -124,7 +124,7 @@ public abstract class BaseReceivePack { * line from the client. */ public FirstLine(String line) { - final HashSet<String> caps = new HashSet<String>(); + final HashSet<String> caps = new HashSet<>(); final int nul = line.indexOf('\0'); if (nul >= 0) { for (String c : line.substring(nul + 1).split(" ")) //$NON-NLS-1$ @@ -325,8 +325,8 @@ public abstract class BaseReceivePack { maxDiscardBytes = rc.maxDiscardBytes; advertiseRefsHook = AdvertiseRefsHook.DEFAULT; refFilter = RefFilter.DEFAULT; - advertisedHaves = new HashSet<ObjectId>(); - clientShallowCommits = new HashSet<ObjectId>(); + advertisedHaves = new HashSet<>(); + clientShallowCommits = new HashSet<>(); signedPushConfig = rc.signedPush; } @@ -1062,8 +1062,8 @@ public abstract class BaseReceivePack { pckOut = new PacketLineOut(rawOut); pckOut.setFlushOnEnd(false); - enabledCapabilities = new HashSet<String>(); - commands = new ArrayList<ReceiveCommand>(); + enabledCapabilities = new HashSet<>(); + commands = new ArrayList<>(); } /** @return advertised refs, or the default if not explicitly advertised. */ diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java index 559c40394c..f37ba01034 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleFetchConnection.java @@ -92,7 +92,7 @@ class BundleFetchConnection extends BaseFetchConnection { InputStream bin; - final Map<ObjectId, String> prereqs = new HashMap<ObjectId, String>(); + final Map<ObjectId, String> prereqs = new HashMap<>(); private String lockMessage; @@ -130,7 +130,7 @@ class BundleFetchConnection extends BaseFetchConnection { private void readBundleV2() throws IOException { final byte[] hdrbuf = new byte[1024]; - final LinkedHashMap<String, Ref> avail = new LinkedHashMap<String, Ref>(); + final LinkedHashMap<String, Ref> avail = new LinkedHashMap<>(); for (;;) { String line = readLine(hdrbuf); if (line.length() == 0) @@ -228,8 +228,8 @@ class BundleFetchConnection extends BaseFetchConnection { final RevFlag PREREQ = rw.newFlag("PREREQ"); //$NON-NLS-1$ final RevFlag SEEN = rw.newFlag("SEEN"); //$NON-NLS-1$ - final Map<ObjectId, String> missing = new HashMap<ObjectId, String>(); - final List<RevObject> commits = new ArrayList<RevObject>(); + final Map<ObjectId, String> missing = new HashMap<>(); + final List<RevObject> commits = new ArrayList<>(); for (final Map.Entry<ObjectId, String> e : prereqs.entrySet()) { ObjectId p = e.getKey(); try { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java index ca624c03d5..37d70e3a14 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BundleWriter.java @@ -102,9 +102,9 @@ public class BundleWriter { */ public BundleWriter(final Repository repo) { db = repo; - include = new TreeMap<String, ObjectId>(); - assume = new HashSet<RevCommit>(); - tagTargets = new HashSet<ObjectId>(); + include = new TreeMap<>(); + assume = new HashSet<>(); + tagTargets = new HashSet<>(); } /** @@ -202,8 +202,8 @@ public class BundleWriter { try (PackWriter packWriter = new PackWriter(pc, db.newObjectReader())) { packWriter.setObjectCountCallback(callback); - final HashSet<ObjectId> inc = new HashSet<ObjectId>(); - final HashSet<ObjectId> exc = new HashSet<ObjectId>(); + final HashSet<ObjectId> inc = new HashSet<>(); + final HashSet<ObjectId> exc = new HashSet<>(); inc.addAll(include.values()); for (final RevCommit r : assume) exc.add(r.getId()); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ChainingCredentialsProvider.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ChainingCredentialsProvider.java index 739ddccc73..8cb3d604cf 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/ChainingCredentialsProvider.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/ChainingCredentialsProvider.java @@ -68,7 +68,7 @@ public class ChainingCredentialsProvider extends CredentialsProvider { * here */ public ChainingCredentialsProvider(CredentialsProvider... providers) { - this.credentialProviders = new ArrayList<CredentialsProvider>( + this.credentialProviders = new ArrayList<>( Arrays.asList(providers)); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/CredentialsProviderUserInfo.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/CredentialsProviderUserInfo.java index 843f6cc0e5..83586350be 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/CredentialsProviderUserInfo.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/CredentialsProviderUserInfo.java @@ -141,7 +141,7 @@ public class CredentialsProviderUserInfo implements UserInfo, for (int i = 0; i < prompt.length; i++) v[i] = new CredentialItem.StringType(prompt[i], !echo[i]); - List<CredentialItem> items = new ArrayList<CredentialItem>(); + List<CredentialItem> items = new ArrayList<>(); if (instruction != null && instruction.length() > 0) items.add(new CredentialItem.InformationalMessage(instruction)); items.addAll(Arrays.asList(v)); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java index 8cb36c7918..280e6d4df7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java @@ -88,18 +88,18 @@ class FetchProcess { private final Collection<RefSpec> toFetch; /** Set of refs we will actually wind up asking to obtain. */ - private final HashMap<ObjectId, Ref> askFor = new HashMap<ObjectId, Ref>(); + private final HashMap<ObjectId, Ref> askFor = new HashMap<>(); /** Objects we know we have locally. */ - private final HashSet<ObjectId> have = new HashSet<ObjectId>(); + private final HashSet<ObjectId> have = new HashSet<>(); /** Updates to local tracking branches (if any). */ - private final ArrayList<TrackingRefUpdate> localUpdates = new ArrayList<TrackingRefUpdate>(); + private final ArrayList<TrackingRefUpdate> localUpdates = new ArrayList<>(); /** Records to be recorded into FETCH_HEAD. */ - private final ArrayList<FetchHeadRecord> fetchHeadUpdates = new ArrayList<FetchHeadRecord>(); + private final ArrayList<FetchHeadRecord> fetchHeadUpdates = new ArrayList<>(); - private final ArrayList<PackLock> packLocks = new ArrayList<PackLock>(); + private final ArrayList<PackLock> packLocks = new ArrayList<>(); private FetchConnection conn; @@ -137,7 +137,7 @@ class FetchProcess { try { result.setAdvertisedRefs(transport.getURI(), conn.getRefsMap()); result.peerUserAgent = conn.getPeerUserAgent(); - final Set<Ref> matched = new HashSet<Ref>(); + final Set<Ref> matched = new HashSet<>(); for (final RefSpec spec : toFetch) { if (spec.getSource() == null) throw new TransportException(MessageFormat.format( @@ -275,11 +275,11 @@ class FetchProcess { // We rebuild our askFor list using only the refs that the // new connection has offered to us. // - final HashMap<ObjectId, Ref> avail = new HashMap<ObjectId, Ref>(); + final HashMap<ObjectId, Ref> avail = new HashMap<>(); for (final Ref r : conn.getRefs()) avail.put(r.getObjectId(), r); - final Collection<Ref> wants = new ArrayList<Ref>(askFor.values()); + final Collection<Ref> wants = new ArrayList<>(askFor.values()); askFor.clear(); for (final Ref want : wants) { final Ref newRef = avail.get(want.getObjectId()); @@ -369,7 +369,7 @@ class FetchProcess { } private Collection<Ref> expandAutoFollowTags() throws TransportException { - final Collection<Ref> additionalTags = new ArrayList<Ref>(); + final Collection<Ref> additionalTags = new ArrayList<>(); final Map<String, Ref> haveRefs = localRefs(); for (final Ref r : conn.getRefs()) { if (!isTag(r)) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchResult.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchResult.java index 3d95eddc9b..7df997c1e2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchResult.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchResult.java @@ -59,7 +59,7 @@ public class FetchResult extends OperationResult { private final List<FetchHeadRecord> forMerge; FetchResult() { - forMerge = new ArrayList<FetchHeadRecord>(); + forMerge = new ArrayList<>(); } void add(final FetchHeadRecord r) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java index 4256fe47db..c97daa958f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/HttpAuthMethod.java @@ -348,7 +348,7 @@ abstract class HttpAuthMethod { @SuppressWarnings("boxing") @Override void configureRequest(final HttpConnection conn) throws IOException { - final Map<String, String> r = new LinkedHashMap<String, String>(); + final Map<String, String> r = new LinkedHashMap<>(); final String realm = params.get("realm"); //$NON-NLS-1$ final String nonce = params.get("nonce"); //$NON-NLS-1$ @@ -467,7 +467,7 @@ abstract class HttpAuthMethod { } private static Map<String, String> parse(String auth) { - Map<String, String> p = new HashMap<String, String>(); + Map<String, String> p = new HashMap<>(); int next = 0; while (next < auth.length()) { if (next < auth.length() && auth.charAt(next) == ',') { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java index d1cbd8d268..ce14183a56 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/JschConfigSessionFactory.java @@ -80,7 +80,7 @@ import com.jcraft.jsch.UserInfo; * to supply appropriate {@link UserInfo} to the session. */ public abstract class JschConfigSessionFactory extends SshSessionFactory { - private final Map<String, JSch> byIdentityFile = new HashMap<String, JSch>(); + private final Map<String, JSch> byIdentityFile = new HashMap<>(); private JSch defaultJSch; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/LongMap.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/LongMap.java index 88b4b074a3..4d60202a6f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/LongMap.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/LongMap.java @@ -106,7 +106,7 @@ final class LongMap<V> { if (++size == growAt) grow(); - insert(new Node<V>(key, value)); + insert(new Node<>(key, value)); return null; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/NetRC.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/NetRC.java index 8855f96567..bab5bf0354 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/NetRC.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/NetRC.java @@ -125,7 +125,7 @@ public class NetRC { private long lastModified; - private Map<String, NetRCEntry> hosts = new HashMap<String, NetRCEntry>(); + private Map<String, NetRCEntry> hosts = new HashMap<>(); private static final TreeMap<String, State> STATE = new TreeMap<String, NetRC.State>() { private static final long serialVersionUID = -4285910831814853334L; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java index 6051f39c01..8b7b60da37 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/OpenSshConfig.java @@ -175,9 +175,9 @@ public class OpenSshConfig { } private Map<String, Host> parse(final InputStream in) throws IOException { - final Map<String, Host> m = new LinkedHashMap<String, Host>(); + final Map<String, Host> m = new LinkedHashMap<>(); final BufferedReader br = new BufferedReader(new InputStreamReader(in)); - final List<Host> current = new ArrayList<Host>(4); + final List<Host> current = new ArrayList<>(4); String line; while ((line = br.readLine()) != null) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/OperationResult.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/OperationResult.java index ad51f3e70c..42317984fe 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/OperationResult.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/OperationResult.java @@ -64,7 +64,7 @@ public abstract class OperationResult { URIish uri; - final SortedMap<String, TrackingRefUpdate> updates = new TreeMap<String, TrackingRefUpdate>(); + final SortedMap<String, TrackingRefUpdate> updates = new TreeMap<>(); StringBuilder messageBuffer; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java index 4bbe3f8813..93e7952bdd 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java @@ -275,7 +275,7 @@ public abstract class PackParser { */ public void setNeedNewObjectIds(boolean b) { if (b) - newObjectIds = new ObjectIdSubclassMap<ObjectId>(); + newObjectIds = new ObjectIdSubclassMap<>(); else newObjectIds = null; } @@ -333,14 +333,14 @@ public abstract class PackParser { public ObjectIdSubclassMap<ObjectId> getNewObjectIds() { if (newObjectIds != null) return newObjectIds; - return new ObjectIdSubclassMap<ObjectId>(); + return new ObjectIdSubclassMap<>(); } /** @return set of objects the incoming pack assumed for delta purposes */ public ObjectIdSubclassMap<ObjectId> getBaseObjectIds() { if (baseObjectIds != null) return baseObjectIds; - return new ObjectIdSubclassMap<ObjectId>(); + return new ObjectIdSubclassMap<>(); } /** @@ -527,9 +527,9 @@ public abstract class PackParser { readPackHeader(); entries = new PackedObjectInfo[(int) objectCount]; - baseById = new ObjectIdOwnerMap<DeltaChain>(); - baseByPos = new LongMap<UnresolvedDelta>(); - deferredCheckBlobs = new BlockList<PackedObjectInfo>(); + baseById = new ObjectIdOwnerMap<>(); + baseByPos = new LongMap<>(); + deferredCheckBlobs = new BlockList<>(); receiving.beginTask(JGitText.get().receivingObjects, (int) objectCount); @@ -826,9 +826,9 @@ public abstract class PackParser { growEntries(baseById.size()); if (needBaseObjectIds) - baseObjectIds = new ObjectIdSubclassMap<ObjectId>(); + baseObjectIds = new ObjectIdSubclassMap<>(); - final List<DeltaChain> missing = new ArrayList<DeltaChain>(64); + final List<DeltaChain> missing = new ArrayList<>(64); for (final DeltaChain baseId : baseById) { if (baseId.head == null) continue; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushProcess.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushProcess.java index 5590c2d256..3201732a98 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushProcess.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PushProcess.java @@ -124,7 +124,7 @@ class PushProcess { throws TransportException { this.walker = new RevWalk(transport.local); this.transport = transport; - this.toPush = new HashMap<String, RemoteRefUpdate>(); + this.toPush = new HashMap<>(); this.out = out; this.pushOptions = transport.getPushOptions(); for (final RemoteRefUpdate rru : toPush) { @@ -190,7 +190,7 @@ class PushProcess { private Map<String, RemoteRefUpdate> prepareRemoteUpdates() throws TransportException { boolean atomic = transport.isPushAtomic(); - final Map<String, RemoteRefUpdate> result = new HashMap<String, RemoteRefUpdate>(); + final Map<String, RemoteRefUpdate> result = new HashMap<>(); for (final RemoteRefUpdate rru : toPush.values()) { final Ref advertisedRef = connection.getRef(rru.getRemoteName()); ObjectId advertisedOld = null; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java index 0cd720c29d..745e813c41 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RefAdvertiser.java @@ -163,9 +163,9 @@ public abstract class RefAdvertiser { private final char[] tmpId = new char[Constants.OBJECT_ID_STRING_LENGTH]; - final Set<String> capablities = new LinkedHashSet<String>(); + final Set<String> capablities = new LinkedHashSet<>(); - private final Set<ObjectId> sent = new HashSet<ObjectId>(); + private final Set<ObjectId> sent = new HashSet<>(); private Repository repository; diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteConfig.java index ba0931b9ba..d91684e2f5 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteConfig.java @@ -114,11 +114,11 @@ public class RemoteConfig implements Serializable { */ public static List<RemoteConfig> getAllRemoteConfigs(final Config rc) throws URISyntaxException { - final List<String> names = new ArrayList<String>(rc + final List<String> names = new ArrayList<>(rc .getSubsections(SECTION)); Collections.sort(names); - final List<RemoteConfig> result = new ArrayList<RemoteConfig>(names + final List<RemoteConfig> result = new ArrayList<>(names .size()); for (final String name : names) result.add(new RemoteConfig(rc, name)); @@ -169,24 +169,24 @@ public class RemoteConfig implements Serializable { vlst = rc.getStringList(SECTION, name, KEY_URL); Map<String, String> insteadOf = getReplacements(rc, KEY_INSTEADOF); - uris = new ArrayList<URIish>(vlst.length); + uris = new ArrayList<>(vlst.length); for (final String s : vlst) uris.add(new URIish(replaceUri(s, insteadOf))); Map<String, String> pushInsteadOf = getReplacements(rc, KEY_PUSHINSTEADOF); vlst = rc.getStringList(SECTION, name, KEY_PUSHURL); - pushURIs = new ArrayList<URIish>(vlst.length); + pushURIs = new ArrayList<>(vlst.length); for (final String s : vlst) pushURIs.add(new URIish(replaceUri(s, pushInsteadOf))); vlst = rc.getStringList(SECTION, name, KEY_FETCH); - fetch = new ArrayList<RefSpec>(vlst.length); + fetch = new ArrayList<>(vlst.length); for (final String s : vlst) fetch.add(new RefSpec(s)); vlst = rc.getStringList(SECTION, name, KEY_PUSH); - push = new ArrayList<RefSpec>(vlst.length); + push = new ArrayList<>(vlst.length); for (final String s : vlst) push.add(new RefSpec(s)); @@ -213,7 +213,7 @@ public class RemoteConfig implements Serializable { * the configuration file to store ourselves into. */ public void update(final Config rc) { - final List<String> vlst = new ArrayList<String>(); + final List<String> vlst = new ArrayList<>(); vlst.clear(); for (final URIish u : getURIs()) @@ -272,7 +272,7 @@ public class RemoteConfig implements Serializable { private Map<String, String> getReplacements(final Config config, final String keyName) { - final Map<String, String> replacements = new HashMap<String, String>(); + final Map<String, String> replacements = new HashMap<>(); for (String url : config.getSubsections(KEY_URL)) for (String insteadOf : config.getStringList(KEY_URL, url, keyName)) replacements.put(insteadOf, url); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TestProtocol.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TestProtocol.java index 5fd2f84b7e..8a28e3a7d7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TestProtocol.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TestProtocol.java @@ -103,7 +103,7 @@ public class TestProtocol<C> extends TransportProtocol { ReceivePackFactory<C> receivePackFactory) { this.uploadPackFactory = uploadPackFactory; this.receivePackFactory = receivePackFactory; - this.handles = new HashMap<URIish, Handle>(); + this.handles = new HashMap<>(); } @Override @@ -174,7 +174,7 @@ public class TestProtocol<C> extends TransportProtocol { public FetchConnection openFetch() throws NotSupportedException, TransportException { handle.remote.incrementOpen(); - return new InternalFetchConnection<C>( + return new InternalFetchConnection<>( this, uploadPackFactory, handle.req, handle.remote); } @@ -182,7 +182,7 @@ public class TestProtocol<C> extends TransportProtocol { public PushConnection openPush() throws NotSupportedException, TransportException { handle.remote.incrementOpen(); - return new InternalPushConnection<C>( + return new InternalPushConnection<>( this, receivePackFactory, handle.req, handle.remote); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java index 5507e9b057..2198b50f0d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransferConfig.java @@ -210,7 +210,7 @@ public class TransferConfig { return new RefFilter() { @Override public Map<String, Ref> filter(Map<String, Ref> refs) { - Map<String, Ref> result = new HashMap<String, Ref>(); + Map<String, Ref> result = new HashMap<>(); for (Map.Entry<String, Ref> e : refs.entrySet()) { boolean add = true; for (String hide : hideRefs) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java index 269d11644b..649e840626 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java @@ -109,7 +109,7 @@ public abstract class Transport implements AutoCloseable { } private static final List<WeakReference<TransportProtocol>> protocols = - new CopyOnWriteArrayList<WeakReference<TransportProtocol>>(); + new CopyOnWriteArrayList<>(); static { // Registration goes backwards in order of priority. @@ -226,7 +226,7 @@ public abstract class Transport implements AutoCloseable { * the protocol definition. Must not be null. */ public static void register(TransportProtocol proto) { - protocols.add(0, new WeakReference<TransportProtocol>(proto)); + protocols.add(0, new WeakReference<>(proto)); } /** @@ -256,7 +256,7 @@ public abstract class Transport implements AutoCloseable { */ public static List<TransportProtocol> getTransportProtocols() { int cnt = protocols.size(); - List<TransportProtocol> res = new ArrayList<TransportProtocol>(cnt); + List<TransportProtocol> res = new ArrayList<>(cnt); for (WeakReference<TransportProtocol> ref : protocols) { TransportProtocol proto = ref.get(); if (proto != null) @@ -380,7 +380,7 @@ public abstract class Transport implements AutoCloseable { TransportException { final RemoteConfig cfg = new RemoteConfig(local.getConfig(), remote); if (doesNotExist(cfg)) { - final ArrayList<Transport> transports = new ArrayList<Transport>(1); + final ArrayList<Transport> transports = new ArrayList<>(1); transports.add(open(local, new URIish(remote), null)); return transports; } @@ -490,7 +490,7 @@ public abstract class Transport implements AutoCloseable { final RemoteConfig cfg, final Operation op) throws NotSupportedException, TransportException { final List<URIish> uris = getURIs(cfg, op); - final List<Transport> transports = new ArrayList<Transport>(uris.size()); + final List<Transport> transports = new ArrayList<>(uris.size()); for (final URIish uri : uris) { final Transport tn = open(local, uri, cfg.getName()); tn.applyConfig(cfg); @@ -629,7 +629,7 @@ public abstract class Transport implements AutoCloseable { Collection<RefSpec> fetchSpecs) throws IOException { if (fetchSpecs == null) fetchSpecs = Collections.emptyList(); - final List<RemoteRefUpdate> result = new LinkedList<RemoteRefUpdate>(); + final List<RemoteRefUpdate> result = new LinkedList<>(); final Collection<RefSpec> procRefs = expandPushWildcardsFor(db, specs); for (final RefSpec spec : procRefs) { @@ -698,7 +698,7 @@ public abstract class Transport implements AutoCloseable { final Repository db, final Collection<RefSpec> specs) throws IOException { final Map<String, Ref> localRefs = db.getRefDatabase().getRefs(ALL); - final Collection<RefSpec> procRefs = new HashSet<RefSpec>(); + final Collection<RefSpec> procRefs = new HashSet<>(); for (final RefSpec spec : specs) { if (spec.isWildcard()) { @@ -1217,7 +1217,7 @@ public abstract class Transport implements AutoCloseable { // the local tracking branches without incurring additional // object transfer overheads. // - final Collection<RefSpec> tmp = new ArrayList<RefSpec>(toFetch); + final Collection<RefSpec> tmp = new ArrayList<>(toFetch); for (final RefSpec requested : toFetch) { final String reqSrc = requested.getSource(); for (final RefSpec configured : fetch) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java index 74d9e7ff45..6cd119bd2f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportAmazonS3.java @@ -270,10 +270,10 @@ public class TransportAmazonS3 extends HttpTransport implements WalkTransport { @Override Collection<String> getPackNames() throws IOException { - final HashSet<String> have = new HashSet<String>(); + final HashSet<String> have = new HashSet<>(); have.addAll(s3.list(bucket, resolveKey("pack"))); //$NON-NLS-1$ - final Collection<String> packs = new ArrayList<String>(); + final Collection<String> packs = new ArrayList<>(); for (final String n : have) { if (!n.startsWith("pack-") || !n.endsWith(".pack")) //$NON-NLS-1$ //$NON-NLS-2$ continue; @@ -312,7 +312,7 @@ public class TransportAmazonS3 extends HttpTransport implements WalkTransport { } Map<String, Ref> readAdvertisedRefs() throws TransportException { - final TreeMap<String, Ref> avail = new TreeMap<String, Ref>(); + final TreeMap<String, Ref> avail = new TreeMap<>(); readPackedRefs(avail); readLooseRefs(avail); readRef(avail, Constants.HEAD); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundleFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundleFile.java index 31d7909d1b..f2ddc0d0d1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundleFile.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportBundleFile.java @@ -66,7 +66,7 @@ class TransportBundleFile extends Transport implements TransportBundle { private final String[] schemeNames = { "bundle", "file" }; //$NON-NLS-1$ //$NON-NLS-2$ private final Set<String> schemeSet = Collections - .unmodifiableSet(new LinkedHashSet<String>(Arrays + .unmodifiableSet(new LinkedHashSet<>(Arrays .asList(schemeNames))); @Override diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java index 49a2042d9b..9a40f47cb7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java @@ -87,7 +87,7 @@ public class TransportGitSsh extends SshTransport implements PackTransport { private final String[] schemeNames = { "ssh", "ssh+git", "git+ssh" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ private final Set<String> schemeSet = Collections - .unmodifiableSet(new LinkedHashSet<String>(Arrays + .unmodifiableSet(new LinkedHashSet<>(Arrays .asList(schemeNames))); @Override @@ -227,7 +227,7 @@ public class TransportGitSsh extends SshTransport implements PackTransport { String ssh = SystemReader.getInstance().getenv("GIT_SSH"); //$NON-NLS-1$ boolean putty = ssh.toLowerCase(Locale.ROOT).contains("plink"); //$NON-NLS-1$ - List<String> args = new ArrayList<String>(); + List<String> args = new ArrayList<>(); args.add(ssh); if (putty && !ssh.toLowerCase(Locale.ROOT).contains("tortoiseplink")) //$NON-NLS-1$ diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java index 7c5289293c..26a254d946 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java @@ -154,7 +154,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport, private final String[] schemeNames = { "http", "https" }; //$NON-NLS-1$ //$NON-NLS-2$ private final Set<String> schemeSet = Collections - .unmodifiableSet(new LinkedHashSet<String>(Arrays + .unmodifiableSet(new LinkedHashSet<>(Arrays .asList(schemeNames))); @Override @@ -551,7 +551,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport, } catch (IOException e) { if (authMethod.getType() != HttpAuthMethod.Type.NONE) { if (ignoreTypes == null) { - ignoreTypes = new HashSet<Type>(); + ignoreTypes = new HashSet<>(); } ignoreTypes.add(authMethod.getType()); @@ -726,7 +726,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport, @Override Collection<String> getPackNames() throws IOException { - final Collection<String> packs = new ArrayList<String>(); + final Collection<String> packs = new ArrayList<>(); try { final BufferedReader br = openReader(INFO_PACKS); try { @@ -779,7 +779,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport, Map<String, Ref> readAdvertisedImpl(final BufferedReader br) throws IOException, PackProtocolException { - final TreeMap<String, Ref> avail = new TreeMap<String, Ref>(); + final TreeMap<String, Ref> avail = new TreeMap<>(); for (;;) { String line = br.readLine(); if (line == null) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportLocal.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportLocal.java index 32582ec48a..f483ec7f9f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportLocal.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportLocal.java @@ -191,7 +191,7 @@ class TransportLocal extends Transport implements PackTransport { return createUploadPack(db); } }; - return new InternalFetchConnection<Void>(this, upf, null, openRepo()); + return new InternalFetchConnection<>(this, upf, null, openRepo()); } @Override @@ -207,7 +207,7 @@ class TransportLocal extends Transport implements PackTransport { return createReceivePack(db); } }; - return new InternalPushConnection<Void>(this, rpf, null, openRepo()); + return new InternalPushConnection<>(this, rpf, null, openRepo()); } @Override diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java index b99378dc91..c46f94b7da 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportSftp.java @@ -231,15 +231,15 @@ public class TransportSftp extends SshTransport implements WalkTransport { @Override Collection<String> getPackNames() throws IOException { - final List<String> packs = new ArrayList<String>(); + final List<String> packs = new ArrayList<>(); try { @SuppressWarnings("unchecked") final Collection<ChannelSftp.LsEntry> list = ftp.ls("pack"); //$NON-NLS-1$ final HashMap<String, ChannelSftp.LsEntry> files; final HashMap<String, Integer> mtimes; - files = new HashMap<String, ChannelSftp.LsEntry>(); - mtimes = new HashMap<String, Integer>(); + files = new HashMap<>(); + mtimes = new HashMap<>(); for (final ChannelSftp.LsEntry ent : list) files.put(ent.getFilename(), ent); @@ -388,7 +388,7 @@ public class TransportSftp extends SshTransport implements WalkTransport { } Map<String, Ref> readAdvertisedRefs() throws TransportException { - final TreeMap<String, Ref> avail = new TreeMap<String, Ref>(); + final TreeMap<String, Ref> avail = new TreeMap<>(); readPackedRefs(avail); readRef(avail, ROOT_DIR + Constants.HEAD, Constants.HEAD); readLooseRefs(avail, ROOT_DIR + "refs", "refs/"); //$NON-NLS-1$ //$NON-NLS-2$ diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java index 3177b32e61..58fdd25745 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java @@ -177,7 +177,7 @@ public class UploadPack { */ public FirstLine(String line) { if (line.length() > 45) { - final HashSet<String> opts = new HashSet<String>(); + final HashSet<String> opts = new HashSet<>(); String opt = line.substring(45); if (opt.startsWith(" ")) //$NON-NLS-1$ opt = opt.substring(1); @@ -263,19 +263,19 @@ public class UploadPack { String userAgent; /** Raw ObjectIds the client has asked for, before validating them. */ - private final Set<ObjectId> wantIds = new HashSet<ObjectId>(); + private final Set<ObjectId> wantIds = new HashSet<>(); /** Objects the client wants to obtain. */ - private final Set<RevObject> wantAll = new HashSet<RevObject>(); + private final Set<RevObject> wantAll = new HashSet<>(); /** Objects on both sides, these don't have to be sent. */ - private final Set<RevObject> commonBase = new HashSet<RevObject>(); + private final Set<RevObject> commonBase = new HashSet<>(); /** Shallow commits the client already has. */ - private final Set<ObjectId> clientShallowCommits = new HashSet<ObjectId>(); + private final Set<ObjectId> clientShallowCommits = new HashSet<>(); /** Shallow commits on the client which are now becoming unshallow */ - private final List<ObjectId> unshallowCommits = new ArrayList<ObjectId>(); + private final List<ObjectId> unshallowCommits = new ArrayList<>(); /** Desired depth from the client on a shallow request. */ private int depth; @@ -776,7 +776,7 @@ public class UploadPack { } private static Set<ObjectId> refIdSet(Collection<Ref> refs) { - Set<ObjectId> ids = new HashSet<ObjectId>(refs.size()); + Set<ObjectId> ids = new HashSet<>(refs.size()); for (Ref ref : refs) { ObjectId id = ref.getObjectId(); if (id != null) { @@ -1018,7 +1018,7 @@ public class UploadPack { okToGiveUp = Boolean.FALSE; ObjectId last = ObjectId.zeroId(); - List<ObjectId> peerHas = new ArrayList<ObjectId>(64); + List<ObjectId> peerHas = new ArrayList<>(64); for (;;) { String line; try { @@ -1172,7 +1172,7 @@ public class UploadPack { for (ObjectId obj : wantIds) { if (!advertised.contains(obj)) { if (notAdvertisedWants == null) - notAdvertisedWants = new ArrayList<ObjectId>(); + notAdvertisedWants = new ArrayList<>(); notAdvertisedWants.add(obj); } } @@ -1488,7 +1488,7 @@ public class UploadPack { pw.setReuseValidatingObjects(false); if (commonBase.isEmpty() && refs != null) { - Set<ObjectId> tagTargets = new HashSet<ObjectId>(); + Set<ObjectId> tagTargets = new HashSet<>(); for (Ref ref : refs.values()) { if (ref.getPeeledObjectId() != null) tagTargets.add(ref.getPeeledObjectId()); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java index 0319d93865..3d60aedcca 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java @@ -197,20 +197,20 @@ class WalkFetchConnection extends BaseFetchConnection { inserter = local.newObjectInserter(); reader = inserter.newReader(); - remotes = new ArrayList<WalkRemoteObjectDatabase>(); + remotes = new ArrayList<>(); remotes.add(w); - unfetchedPacks = new LinkedList<RemotePack>(); - packsConsidered = new HashSet<String>(); + unfetchedPacks = new LinkedList<>(); + packsConsidered = new HashSet<>(); - noPacksYet = new LinkedList<WalkRemoteObjectDatabase>(); + noPacksYet = new LinkedList<>(); noPacksYet.add(w); - noAlternatesYet = new LinkedList<WalkRemoteObjectDatabase>(); + noAlternatesYet = new LinkedList<>(); noAlternatesYet.add(w); - fetchErrors = new HashMap<ObjectId, List<Throwable>>(); - packLocks = new ArrayList<PackLock>(4); + fetchErrors = new HashMap<>(); + packLocks = new ArrayList<>(4); revWalk = new RevWalk(reader); revWalk.setRetainBody(false); @@ -220,7 +220,7 @@ class WalkFetchConnection extends BaseFetchConnection { LOCALLY_SEEN = revWalk.newFlag("LOCALLY_SEEN"); //$NON-NLS-1$ localCommitQueue = new DateRevQueue(); - workQueue = new LinkedList<ObjectId>(); + workQueue = new LinkedList<>(); } @Override @@ -273,7 +273,7 @@ class WalkFetchConnection extends BaseFetchConnection { private void queueWants(final Collection<Ref> want) throws TransportException { - final HashSet<ObjectId> inWorkQueue = new HashSet<ObjectId>(); + final HashSet<ObjectId> inWorkQueue = new HashSet<>(); for (final Ref r : want) { final ObjectId id = r.getObjectId(); if (id == null) { @@ -597,7 +597,7 @@ class WalkFetchConnection extends BaseFetchConnection { private Iterator<ObjectId> swapFetchQueue() { final Iterator<ObjectId> r = workQueue.iterator(); - workQueue = new LinkedList<ObjectId>(); + workQueue = new LinkedList<>(); return r; } @@ -794,7 +794,7 @@ class WalkFetchConnection extends BaseFetchConnection { final ObjectId objId = id.copy(); List<Throwable> errors = fetchErrors.get(objId); if (errors == null) { - errors = new ArrayList<Throwable>(2); + errors = new ArrayList<>(2); fetchErrors.put(objId, errors); } errors.add(what); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java index 39f11f96e3..5c4e14ca31 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkPushConnection.java @@ -147,14 +147,14 @@ class WalkPushConnection extends BaseConnection implements PushConnection { throws TransportException { markStartedOperation(); packNames = null; - newRefs = new TreeMap<String, Ref>(getRefsMap()); - packedRefUpdates = new ArrayList<RemoteRefUpdate>(refUpdates.size()); + newRefs = new TreeMap<>(getRefsMap()); + packedRefUpdates = new ArrayList<>(refUpdates.size()); // Filter the commands and issue all deletes first. This way we // can correctly handle a directory being cleared out and a new // ref using the directory name being created. // - final List<RemoteRefUpdate> updates = new ArrayList<RemoteRefUpdate>(); + final List<RemoteRefUpdate> updates = new ArrayList<>(); for (final RemoteRefUpdate u : refUpdates.values()) { final String n = u.getRemoteName(); if (!n.startsWith("refs/") || !Repository.isValidRefName(n)) { //$NON-NLS-1$ @@ -225,8 +225,8 @@ class WalkPushConnection extends BaseConnection implements PushConnection { try (final PackWriter writer = new PackWriter(transport.getPackConfig(), local.newObjectReader())) { - final Set<ObjectId> need = new HashSet<ObjectId>(); - final Set<ObjectId> have = new HashSet<ObjectId>(); + final Set<ObjectId> need = new HashSet<>(); + final Set<ObjectId> have = new HashSet<>(); for (final RemoteRefUpdate r : updates) need.add(r.getNewObjectId()); for (final Ref r : getRefs()) { @@ -243,7 +243,7 @@ class WalkPushConnection extends BaseConnection implements PushConnection { if (writer.getObjectCount() == 0) return; - packNames = new LinkedHashMap<String, String>(); + packNames = new LinkedHashMap<>(); for (final String n : dest.getPackNames()) packNames.put(n, n); @@ -279,7 +279,7 @@ class WalkPushConnection extends BaseConnection implements PushConnection { // way clients are likely to consult the newest pack first, // and discover the most recent objects there. // - final ArrayList<String> infoPacks = new ArrayList<String>(); + final ArrayList<String> infoPacks = new ArrayList<>(); infoPacks.add(packName); infoPacks.addAll(packNames.keySet()); dest.writeInfoPacks(infoPacks); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java index 24f30ed206..17f8c3ec19 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkRemoteObjectDatabase.java @@ -396,7 +396,7 @@ abstract class WalkRemoteObjectDatabase { throws IOException { final BufferedReader br = openReader(listPath); try { - final Collection<WalkRemoteObjectDatabase> alts = new ArrayList<WalkRemoteObjectDatabase>(); + final Collection<WalkRemoteObjectDatabase> alts = new ArrayList<>(); for (;;) { String line = br.readLine(); if (line == null) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/resolver/FileResolver.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/resolver/FileResolver.java index 44d90aba00..7654d462eb 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/resolver/FileResolver.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/resolver/FileResolver.java @@ -72,8 +72,8 @@ public class FileResolver<C> implements RepositoryResolver<C> { /** Initialize an empty file based resolver. */ public FileResolver() { - exports = new ConcurrentHashMap<String, Repository>(); - exportBase = new CopyOnWriteArrayList<File>(); + exports = new ConcurrentHashMap<>(); + exportBase = new CopyOnWriteArrayList<>(); } /** diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java index 01156c338d..1ed9468159 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java @@ -128,7 +128,7 @@ public class TreeWalk implements AutoCloseable, AttributesProvider { * The filter command as defined in gitattributes. The keys are * filterName+"."+filterCommandType. E.g. "lfs.clean" */ - private Map<String, String> filterCommandsByNameDotType = new HashMap<String, String>(); + private Map<String, String> filterCommandsByNameDotType = new HashMap<>(); /** * @param operationType diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java index 4eb530e981..0d3c788886 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java @@ -1368,7 +1368,7 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator { cmd = state.walk .getFilterCommand(Constants.ATTR_FILTER_TYPE_CLEAN); } - cleanFilterCommandHolder = new Holder<String>(cmd); + cleanFilterCommandHolder = new Holder<>(cmd); } return cleanFilterCommandHolder.get(); } @@ -1415,7 +1415,7 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator { break; } } - eolStreamTypeHolder = new Holder<EolStreamType>(type); + eolStreamTypeHolder = new Holder<>(type); } return eolStreamTypeHolder.get(); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/IndexDiffFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/IndexDiffFilter.java index 42725bc767..b821a16471 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/IndexDiffFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/IndexDiffFilter.java @@ -86,11 +86,11 @@ public class IndexDiffFilter extends TreeFilter { private final boolean honorIgnores; - private final Set<String> ignoredPaths = new HashSet<String>(); + private final Set<String> ignoredPaths = new HashSet<>(); - private final LinkedList<String> untrackedParentFolders = new LinkedList<String>(); + private final LinkedList<String> untrackedParentFolders = new LinkedList<>(); - private final LinkedList<String> untrackedFolders = new LinkedList<String>(); + private final LinkedList<String> untrackedFolders = new LinkedList<>(); /** * Creates a new instance of this filter. Do not use an instance of this @@ -292,7 +292,7 @@ public class IndexDiffFilter extends TreeFilter { * empty list will be returned. */ public List<String> getUntrackedFolders() { - LinkedList<String> ret = new LinkedList<String>(untrackedFolders); + LinkedList<String> ret = new LinkedList<>(untrackedFolders); if (!untrackedParentFolders.isEmpty()) { String toBeAdded = untrackedParentFolders.getLast(); while (!ret.isEmpty() && ret.getLast().startsWith(toBeAdded)) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/CachedAuthenticator.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/CachedAuthenticator.java index 6828185a8a..8677c690fb 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/CachedAuthenticator.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/CachedAuthenticator.java @@ -51,7 +51,7 @@ import java.util.concurrent.CopyOnWriteArrayList; /** Abstract authenticator which remembers prior authentications. */ public abstract class CachedAuthenticator extends Authenticator { - private static final Collection<CachedAuthentication> cached = new CopyOnWriteArrayList<CachedAuthentication>(); + private static final Collection<CachedAuthentication> cached = new CopyOnWriteArrayList<>(); /** * Add a cached authentication for future use. diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java index f189b3586b..68b71309b1 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java @@ -375,7 +375,7 @@ public abstract class FS { public File userHome() { Holder<File> p = userHome; if (p == null) { - p = new Holder<File>(userHomeImpl()); + p = new Holder<>(userHomeImpl()); userHome = p; } return p.value; @@ -390,7 +390,7 @@ public abstract class FS { * @return {@code this}. */ public FS setUserHome(File path) { - userHome = new Holder<File>(path); + userHome = new Holder<>(path); return this; } @@ -650,7 +650,7 @@ public abstract class FS { */ public File getGitSystemConfig() { if (gitSystemConfig == null) { - gitSystemConfig = new Holder<File>(discoverGitSystemConfig()); + gitSystemConfig = new Holder<>(discoverGitSystemConfig()); } return gitSystemConfig.value; } @@ -664,7 +664,7 @@ public abstract class FS { * @since 4.0 */ public FS setGitSystemConfig(File configFile) { - gitSystemConfig = new Holder<File>(configFile); + gitSystemConfig = new Holder<>(configFile); return this; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java index cb4868cc7a..0780d2b560 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_POSIX.java @@ -225,7 +225,7 @@ public class FS_POSIX extends FS { @Override public ProcessBuilder runInShell(String cmd, String[] args) { - List<String> argv = new ArrayList<String>(4 + args.length); + List<String> argv = new ArrayList<>(4 + args.length); argv.add("sh"); //$NON-NLS-1$ argv.add("-c"); //$NON-NLS-1$ argv.add(cmd + " \"$@\""); //$NON-NLS-1$ diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java index dffd665691..060292160e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32.java @@ -162,7 +162,7 @@ public class FS_Win32 extends FS { @Override public ProcessBuilder runInShell(String cmd, String[] args) { - List<String> argv = new ArrayList<String>(3 + args.length); + List<String> argv = new ArrayList<>(3 + args.length); argv.add("cmd.exe"); //$NON-NLS-1$ argv.add("/c"); //$NON-NLS-1$ argv.add(cmd); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java index e62083e9c5..545cc0119e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FS_Win32_Cygwin.java @@ -148,7 +148,7 @@ public class FS_Win32_Cygwin extends FS_Win32 { @Override public ProcessBuilder runInShell(String cmd, String[] args) { - List<String> argv = new ArrayList<String>(4 + args.length); + List<String> argv = new ArrayList<>(4 + args.length); argv.add("sh.exe"); //$NON-NLS-1$ argv.add("-c"); //$NON-NLS-1$ argv.add(cmd + " \"$@\""); //$NON-NLS-1$ diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java index 1f1d15b324..1f20e9700d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/FileUtils.java @@ -151,8 +151,8 @@ public class FileUtils { if ((options & RECURSIVE) != 0 && fs.isDirectory(f)) { final File[] items = f.listFiles(); if (items != null) { - List<File> files = new ArrayList<File>(); - List<File> dirs = new ArrayList<File>(); + List<File> files = new ArrayList<>(); + List<File> dirs = new ArrayList<>(); for (File c : items) if (c.isFile()) files.add(c); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/GitDateParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/GitDateParser.java index 4aafa3a2c4..da78008a0b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/GitDateParser.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/GitDateParser.java @@ -77,7 +77,7 @@ public class GitDateParser { @Override protected Map<Locale, Map<ParseableSimpleDateFormat, SimpleDateFormat>> initialValue() { - return new HashMap<Locale, Map<ParseableSimpleDateFormat, SimpleDateFormat>>(); + return new HashMap<>(); } }; @@ -91,7 +91,7 @@ public class GitDateParser { Map<ParseableSimpleDateFormat, SimpleDateFormat> map = cache .get(locale); if (map == null) { - map = new HashMap<ParseableSimpleDateFormat, SimpleDateFormat>(); + map = new HashMap<>(); cache.put(locale, map); return getNewSimpleDateFormat(f, locale, map); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java index 0d283fde63..6cff76cc21 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java @@ -344,7 +344,7 @@ public class IO { * @since 2.0 */ public static List<String> readLines(final String s) { - List<String> l = new ArrayList<String>(); + List<String> l = new ArrayList<>(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/RefList.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/RefList.java index 96c1a89f2b..159781795e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/RefList.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/RefList.java @@ -68,7 +68,7 @@ import org.eclipse.jgit.lib.RefComparator; * the type of reference being stored in the collection. */ public class RefList<T extends Ref> implements Iterable<Ref> { - private static final RefList<Ref> EMPTY = new RefList<Ref>(new Ref[0], 0); + private static final RefList<Ref> EMPTY = new RefList<>(new Ref[0], 0); /** * @return an empty unmodifiable reference list. @@ -213,7 +213,7 @@ public class RefList<T extends Ref> implements Iterable<Ref> { * @return a new builder with the first {@code n} elements already added. */ public final Builder<T> copy(int n) { - Builder<T> r = new Builder<T>(Math.max(16, n)); + Builder<T> r = new Builder<>(Math.max(16, n)); r.addAll(list, 0, n); return r; } @@ -234,7 +234,7 @@ public class RefList<T extends Ref> implements Iterable<Ref> { Ref[] newList = new Ref[cnt]; System.arraycopy(list, 0, newList, 0, cnt); newList[idx] = ref; - return new RefList<T>(newList, cnt); + return new RefList<>(newList, cnt); } /** @@ -261,7 +261,7 @@ public class RefList<T extends Ref> implements Iterable<Ref> { newList[idx] = ref; if (idx < cnt) System.arraycopy(list, idx, newList, idx + 1, cnt - idx); - return new RefList<T>(newList, cnt + 1); + return new RefList<>(newList, cnt + 1); } /** @@ -282,7 +282,7 @@ public class RefList<T extends Ref> implements Iterable<Ref> { System.arraycopy(list, 0, newList, 0, idx); if (idx + 1 < cnt) System.arraycopy(list, idx + 1, newList, idx, cnt - (idx + 1)); - return new RefList<T>(newList, cnt - 1); + return new RefList<>(newList, cnt - 1); } /** @@ -431,7 +431,7 @@ public class RefList<T extends Ref> implements Iterable<Ref> { /** @return an unmodifiable list using this collection's backing array. */ public RefList<T> toRefList() { - return new RefList<T>(list, size); + return new RefList<>(list, size); } @Override diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/TemporaryBuffer.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/TemporaryBuffer.java index 9509db0db2..e3f1916f43 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/TemporaryBuffer.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/TemporaryBuffer.java @@ -325,7 +325,7 @@ public abstract class TemporaryBuffer extends OutputStream { if (blocks != null) blocks.clear(); else - blocks = new ArrayList<Block>(initialBlocks); + blocks = new ArrayList<>(initialBlocks); blocks.add(new Block(Math.min(inCoreLimit, Block.SZ))); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/UnionInputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/UnionInputStream.java index 0319afd5ad..1c46310ef5 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/UnionInputStream.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/UnionInputStream.java @@ -67,7 +67,7 @@ public class UnionInputStream extends InputStream { } }; - private final LinkedList<InputStream> streams = new LinkedList<InputStream>(); + private final LinkedList<InputStream> streams = new LinkedList<>(); /** Create an empty InputStream that is currently at EOF state. */ public UnionInputStream() { |