From 3b4448637fbb9d74e0c9d44048ba76bb7c1214ce Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Mon, 20 Feb 2017 13:17:27 +0900 Subject: Enable and fix warnings about redundant specification of type arguments Since the introduction of generic type parameter inference in Java 7, it's not necessary to explicitly specify the type of generic parameters. Enable the warning in Eclipse, and fix all occurrences. Change-Id: I9158caf1beca5e4980b6240ac401f3868520aad0 Signed-off-by: David Pursehouse --- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../src/org/eclipse/jgit/api/AddCommand.java | 2 +- .../src/org/eclipse/jgit/api/ApplyCommand.java | 6 ++-- .../src/org/eclipse/jgit/api/ApplyResult.java | 2 +- .../src/org/eclipse/jgit/api/ArchiveCommand.java | 4 +-- .../src/org/eclipse/jgit/api/BlameCommand.java | 2 +- .../src/org/eclipse/jgit/api/CheckoutCommand.java | 6 ++-- .../src/org/eclipse/jgit/api/CheckoutResult.java | 8 ++--- .../org/eclipse/jgit/api/CherryPickCommand.java | 4 +-- .../src/org/eclipse/jgit/api/CleanCommand.java | 10 +++--- .../src/org/eclipse/jgit/api/CloneCommand.java | 2 +- .../src/org/eclipse/jgit/api/CommitCommand.java | 4 +-- .../org/eclipse/jgit/api/DeleteBranchCommand.java | 4 +-- .../src/org/eclipse/jgit/api/DeleteTagCommand.java | 4 +-- .../src/org/eclipse/jgit/api/DescribeCommand.java | 4 +-- .../src/org/eclipse/jgit/api/FetchCommand.java | 2 +- .../org/eclipse/jgit/api/ListBranchCommand.java | 4 +-- .../src/org/eclipse/jgit/api/ListNotesCommand.java | 2 +- .../src/org/eclipse/jgit/api/ListTagCommand.java | 2 +- .../src/org/eclipse/jgit/api/LogCommand.java | 2 +- .../src/org/eclipse/jgit/api/LsRemoteCommand.java | 4 +-- .../src/org/eclipse/jgit/api/MergeCommand.java | 2 +- .../src/org/eclipse/jgit/api/MergeResult.java | 4 +-- .../src/org/eclipse/jgit/api/NameRevCommand.java | 12 +++---- .../src/org/eclipse/jgit/api/PushCommand.java | 6 ++-- .../src/org/eclipse/jgit/api/RebaseCommand.java | 14 ++++---- .../src/org/eclipse/jgit/api/ResetCommand.java | 2 +- .../src/org/eclipse/jgit/api/RevertCommand.java | 4 +-- .../src/org/eclipse/jgit/api/RmCommand.java | 2 +- .../org/eclipse/jgit/api/StashCreateCommand.java | 6 ++-- .../src/org/eclipse/jgit/api/StashListCommand.java | 2 +- .../src/org/eclipse/jgit/api/Status.java | 2 +- .../src/org/eclipse/jgit/api/StatusCommand.java | 2 +- .../org/eclipse/jgit/api/SubmoduleInitCommand.java | 4 +-- .../eclipse/jgit/api/SubmoduleStatusCommand.java | 4 +-- .../org/eclipse/jgit/api/SubmoduleSyncCommand.java | 4 +-- .../eclipse/jgit/api/SubmoduleUpdateCommand.java | 4 +-- .../jgit/api/errors/CheckoutConflictException.java | 2 +- .../eclipse/jgit/attributes/AttributesNode.java | 2 +- .../eclipse/jgit/attributes/AttributesRule.java | 2 +- .../src/org/eclipse/jgit/diff/DiffAlgorithm.java | 2 +- .../src/org/eclipse/jgit/diff/DiffEntry.java | 2 +- .../org/eclipse/jgit/diff/HashedSequencePair.java | 4 +-- .../src/org/eclipse/jgit/diff/HistogramDiff.java | 8 ++--- .../eclipse/jgit/diff/LowLevelDiffAlgorithm.java | 2 +- .../src/org/eclipse/jgit/diff/RenameDetector.java | 26 +++++++------- .../jgit/diff/SimilarityRenameDetector.java | 6 ++-- .../src/org/eclipse/jgit/diff/Subsequence.java | 4 +-- .../src/org/eclipse/jgit/dircache/DirCache.java | 2 +- .../eclipse/jgit/dircache/DirCacheCheckout.java | 8 ++--- .../org/eclipse/jgit/dircache/DirCacheEditor.java | 2 +- .../org/eclipse/jgit/errors/CompoundException.java | 2 +- .../src/org/eclipse/jgit/events/ListenerList.java | 4 +-- .../org/eclipse/jgit/fnmatch/FileNameMatcher.java | 14 ++++---- .../src/org/eclipse/jgit/fnmatch/GroupHead.java | 2 +- .../org/eclipse/jgit/gitrepo/ManifestParser.java | 12 +++---- .../src/org/eclipse/jgit/gitrepo/RepoCommand.java | 2 +- .../src/org/eclipse/jgit/gitrepo/RepoProject.java | 2 +- .../src/org/eclipse/jgit/ignore/IgnoreNode.java | 2 +- .../eclipse/jgit/ignore/internal/PathMatcher.java | 2 +- .../org/eclipse/jgit/ignore/internal/Strings.java | 2 +- .../jgit/internal/storage/dfs/DfsBlockCache.java | 10 +++--- .../internal/storage/dfs/DfsGarbageCollector.java | 20 +++++------ .../jgit/internal/storage/dfs/DfsInserter.java | 6 ++-- .../jgit/internal/storage/dfs/DfsObjDatabase.java | 6 ++-- .../internal/storage/dfs/DfsPackCompactor.java | 14 ++++---- .../internal/storage/dfs/DfsPackDescription.java | 2 +- .../jgit/internal/storage/dfs/DfsReader.java | 10 +++--- .../jgit/internal/storage/dfs/DfsRefDatabase.java | 4 +-- .../internal/storage/dfs/InMemoryRepository.java | 12 +++---- .../internal/storage/file/BitmapIndexImpl.java | 4 +-- .../storage/file/CachedObjectDirectory.java | 2 +- .../jgit/internal/storage/file/DeltaBaseCache.java | 4 +-- .../jgit/internal/storage/file/FileRepository.java | 2 +- .../org/eclipse/jgit/internal/storage/file/GC.java | 22 ++++++------ .../internal/storage/file/ObjectDirectory.java | 14 ++++---- .../storage/file/PackBitmapIndexBuilder.java | 4 +-- .../storage/file/PackBitmapIndexRemapper.java | 2 +- .../jgit/internal/storage/file/RefDirectory.java | 10 +++--- .../internal/storage/file/ReflogReaderImpl.java | 2 +- .../internal/storage/file/UnpackedObjectCache.java | 2 +- .../jgit/internal/storage/file/WindowCache.java | 4 +-- .../jgit/internal/storage/file/WindowCursor.java | 2 +- .../jgit/internal/storage/pack/BaseSearch.java | 2 +- .../jgit/internal/storage/pack/DeltaCache.java | 2 +- .../jgit/internal/storage/pack/DeltaTask.java | 6 ++-- .../jgit/internal/storage/pack/PackWriter.java | 40 +++++++++++----------- .../storage/pack/PackWriterBitmapPreparer.java | 12 +++---- .../eclipse/jgit/lib/BaseRepositoryBuilder.java | 4 +-- .../src/org/eclipse/jgit/lib/BatchRefUpdate.java | 10 +++--- .../src/org/eclipse/jgit/lib/Config.java | 8 ++--- .../src/org/eclipse/jgit/lib/ConfigSnapshot.java | 12 +++---- .../src/org/eclipse/jgit/lib/IndexDiff.java | 28 +++++++-------- .../src/org/eclipse/jgit/lib/ObjectChecker.java | 2 +- .../src/org/eclipse/jgit/lib/ObjectReader.java | 2 +- .../src/org/eclipse/jgit/lib/RebaseTodoFile.java | 2 +- .../src/org/eclipse/jgit/lib/RefComparator.java | 2 +- .../src/org/eclipse/jgit/lib/RefDatabase.java | 2 +- .../src/org/eclipse/jgit/lib/Repository.java | 10 +++--- .../src/org/eclipse/jgit/lib/RepositoryCache.java | 2 +- .../src/org/eclipse/jgit/merge/MergeAlgorithm.java | 4 +-- .../src/org/eclipse/jgit/merge/MergeFormatter.java | 2 +- .../eclipse/jgit/merge/MergeMessageFormatter.java | 12 +++---- .../src/org/eclipse/jgit/merge/MergeStrategy.java | 2 +- .../org/eclipse/jgit/merge/RecursiveMerger.java | 4 +-- .../src/org/eclipse/jgit/merge/ResolveMerger.java | 14 ++++---- .../org/eclipse/jgit/nls/GlobalBundleCache.java | 4 +-- org.eclipse.jgit/src/org/eclipse/jgit/nls/NLS.java | 2 +- .../org/eclipse/jgit/patch/CombinedFileHeader.java | 2 +- .../src/org/eclipse/jgit/patch/FileHeader.java | 2 +- .../src/org/eclipse/jgit/patch/Patch.java | 4 +-- .../org/eclipse/jgit/revplot/PlotCommitList.java | 6 ++-- .../src/org/eclipse/jgit/revplot/PlotWalk.java | 2 +- .../eclipse/jgit/revwalk/MergeBaseGenerator.java | 2 +- .../src/org/eclipse/jgit/revwalk/ObjectWalk.java | 4 +-- .../src/org/eclipse/jgit/revwalk/RevCommit.java | 4 +-- .../src/org/eclipse/jgit/revwalk/RevFlagSet.java | 4 +-- .../src/org/eclipse/jgit/revwalk/RevWalk.java | 8 ++--- .../src/org/eclipse/jgit/revwalk/RevWalkUtils.java | 4 +-- .../src/org/eclipse/jgit/transport/AmazonS3.java | 8 ++--- .../eclipse/jgit/transport/BasePackConnection.java | 6 ++-- .../jgit/transport/BasePackFetchConnection.java | 2 +- .../jgit/transport/BasePackPushConnection.java | 4 +-- .../eclipse/jgit/transport/BaseReceivePack.java | 10 +++--- .../jgit/transport/BundleFetchConnection.java | 8 ++--- .../org/eclipse/jgit/transport/BundleWriter.java | 10 +++--- .../transport/ChainingCredentialsProvider.java | 2 +- .../transport/CredentialsProviderUserInfo.java | 2 +- .../org/eclipse/jgit/transport/FetchProcess.java | 18 +++++----- .../org/eclipse/jgit/transport/FetchResult.java | 2 +- .../org/eclipse/jgit/transport/HttpAuthMethod.java | 4 +-- .../jgit/transport/JschConfigSessionFactory.java | 2 +- .../src/org/eclipse/jgit/transport/LongMap.java | 2 +- .../src/org/eclipse/jgit/transport/NetRC.java | 2 +- .../org/eclipse/jgit/transport/OpenSshConfig.java | 4 +-- .../eclipse/jgit/transport/OperationResult.java | 2 +- .../src/org/eclipse/jgit/transport/PackParser.java | 16 ++++----- .../org/eclipse/jgit/transport/PushProcess.java | 4 +-- .../org/eclipse/jgit/transport/RefAdvertiser.java | 4 +-- .../org/eclipse/jgit/transport/RemoteConfig.java | 16 ++++----- .../org/eclipse/jgit/transport/TestProtocol.java | 6 ++-- .../org/eclipse/jgit/transport/TransferConfig.java | 2 +- .../src/org/eclipse/jgit/transport/Transport.java | 16 ++++----- .../eclipse/jgit/transport/TransportAmazonS3.java | 6 ++-- .../jgit/transport/TransportBundleFile.java | 2 +- .../eclipse/jgit/transport/TransportGitSsh.java | 4 +-- .../org/eclipse/jgit/transport/TransportHttp.java | 8 ++--- .../org/eclipse/jgit/transport/TransportLocal.java | 4 +-- .../org/eclipse/jgit/transport/TransportSftp.java | 8 ++--- .../src/org/eclipse/jgit/transport/UploadPack.java | 20 +++++------ .../jgit/transport/WalkFetchConnection.java | 22 ++++++------ .../eclipse/jgit/transport/WalkPushConnection.java | 14 ++++---- .../jgit/transport/WalkRemoteObjectDatabase.java | 2 +- .../jgit/transport/resolver/FileResolver.java | 4 +-- .../src/org/eclipse/jgit/treewalk/TreeWalk.java | 2 +- .../eclipse/jgit/treewalk/WorkingTreeIterator.java | 4 +-- .../jgit/treewalk/filter/IndexDiffFilter.java | 8 ++--- .../org/eclipse/jgit/util/CachedAuthenticator.java | 2 +- org.eclipse.jgit/src/org/eclipse/jgit/util/FS.java | 8 ++--- .../src/org/eclipse/jgit/util/FS_POSIX.java | 2 +- .../src/org/eclipse/jgit/util/FS_Win32.java | 2 +- .../src/org/eclipse/jgit/util/FS_Win32_Cygwin.java | 2 +- .../src/org/eclipse/jgit/util/FileUtils.java | 4 +-- .../src/org/eclipse/jgit/util/GitDateParser.java | 4 +-- org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java | 2 +- .../src/org/eclipse/jgit/util/RefList.java | 12 +++---- .../src/org/eclipse/jgit/util/TemporaryBuffer.java | 2 +- .../org/eclipse/jgit/util/io/UnionInputStream.java | 2 +- 168 files changed, 481 insertions(+), 481 deletions(-) (limited to 'org.eclipse.jgit') 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 { */ public AddCommand(Repository repo) { super(repo); - filepatterns = new LinkedList(); + 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 { private void apply(File f, FileHeader fh) throws IOException, PatchApplyException { RawText rt = new RawText(f); - List oldLines = new ArrayList(rt.size()); + List oldLines = new ArrayList<>(rt.size()); for (int i = 0; i < rt.size(); i++) oldLines.add(rt.getString(i)); - List newLines = new ArrayList(oldLines); + List 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 { b.length); RawText hrt = new RawText(b); - List hunkLines = new ArrayList(hrt.size()); + List 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 updatedFiles = new ArrayList(); + private List 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 { * the --format= option) */ private static final ConcurrentMap formats = - new ConcurrentHashMap(); + new ConcurrentHashMap<>(); /** * Replaces the entry for a key only if currently mapped to a given @@ -377,7 +377,7 @@ public class ArchiveCommand extends GitCommand { private String prefix; private String format; private Map formatOptions = new HashMap<>(); - private List paths = new ArrayList(); + private List 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 { public BlameCommand reverse(AnyObjectId start, Collection end) throws IOException { startCommit = start.toObjectId(); - reverseEndCommits = new ArrayList(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 { */ protected CheckoutCommand(Repository repo) { super(repo); - this.paths = new LinkedList(); + this.paths = new LinkedList<>(); } /** @@ -320,10 +320,10 @@ public class CheckoutCommand extends GitCommand { if (!dco.getToBeDeleted().isEmpty()) { status = new CheckoutResult(Status.NONDELETED, dco.getToBeDeleted(), - new ArrayList(dco.getUpdated().keySet()), + new ArrayList<>(dco.getUpdated().keySet()), dco.getRemoved()); } else - status = new CheckoutResult(new ArrayList(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(0); + this.conflictList = new ArrayList<>(0); if (status == Status.NONDELETED) this.undeletedList = fileList; else - this.undeletedList = new ArrayList(0); + this.undeletedList = new ArrayList<>(0); this.modifiedList = modified; this.removedList = removed; @@ -160,8 +160,8 @@ public class CheckoutResult { CheckoutResult(List modified, List removed) { myStatus = Status.OK; - this.conflictList = new ArrayList(0); - this.undeletedList = new ArrayList(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 { private String reflogPrefix = "cherry-pick:"; //$NON-NLS-1$ - private List commits = new LinkedList(); + private List commits = new LinkedList<>(); private String ourCommitName = null; @@ -121,7 +121,7 @@ public class CherryPickCommand extends GitCommand { UnmergedPathsException, ConcurrentRefUpdateException, WrongRepositoryStateException, NoHeadException { RevCommit newHead = null; - List cherryPickedRefs = new LinkedList(); + List 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> { */ @Override public Set call() throws NoWorkTreeException, GitAPIException { - Set files = new TreeSet(); + Set files = new TreeSet<>(); try { StatusCommand command = new StatusCommand(repo); Status status = command.call(); - Set untrackedAndIgnoredFiles = new TreeSet( + Set untrackedAndIgnoredFiles = new TreeSet<>( status.getUntracked()); - Set untrackedAndIgnoredDirs = new TreeSet( + Set untrackedAndIgnoredDirs = new TreeSet<>( status.getUntrackedFolders()); FS fs = getRepository().getFS(); @@ -192,7 +192,7 @@ public class CleanCommand extends GitCommand> { private Set filterIgnorePaths(Set inputPaths, Set ignoredNotInIndex, boolean exact) { if (ignore) { - Set filtered = new TreeSet(inputPaths); + Set 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> { private Set filterFolders(Set untracked, Set untrackedFolders) { - Set filtered = new TreeSet(untracked); + Set 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 { RefSpec wcrs = new RefSpec(); wcrs = wcrs.setForceUpdate(true); wcrs = wcrs.setSourceDestination(Constants.R_HEADS + "*", dst); //$NON-NLS-1$ - List specs = new ArrayList(); + List 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 { private boolean all; - private List only = new ArrayList(); + private List only = new ArrayList<>(); private boolean[] onlyProcessed; @@ -124,7 +124,7 @@ public class CommitCommand extends GitCommand { * parents this commit should have. The current HEAD will be in this list * and also all commits mentioned in .git/MERGE_HEAD */ - private List parents = new LinkedList(); + private List 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 */ public class DeleteBranchCommand extends GitCommand> { - private final Set branchNames = new HashSet(); + private final Set branchNames = new HashSet<>(); private boolean force; @@ -101,7 +101,7 @@ public class DeleteBranchCommand extends GitCommand> { public List call() throws GitAPIException, NotMergedException, CannotDeleteCurrentBranchException { checkCallable(); - List result = new ArrayList(); + List 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> { - private final Set tags = new HashSet(); + private final Set tags = new HashSet<>(); /** * @param repo @@ -83,7 +83,7 @@ public class DeleteTagCommand extends GitCommand> { @Override public List call() throws GitAPIException { checkCallable(); - List result = new ArrayList(); + List 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 { if (target == null) setTarget(Constants.HEAD); - Map tags = new HashMap(); + Map 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 { } } - List candidates = new ArrayList(); // all the candidates we find + List 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 { */ protected FetchCommand(Repository repo) { super(repo); - refSpecs = new ArrayList(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> { checkCallable(); List resultRefs; try { - Collection refs = new ArrayList(); + Collection 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> { refs.addAll(getRefs(Constants.R_HEADS)); refs.addAll(getRefs(Constants.R_REMOTES)); } - resultRefs = new ArrayList(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> { @Override public List call() throws GitAPIException { checkCallable(); - List notes = new ArrayList(); + List 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> { public List call() throws GitAPIException { checkCallable(); Map refList; - List tags = new ArrayList(); + List 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> { private RevFilter revFilter; - private final List pathFilters = new ArrayList(); + private final List 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 refSpecs = new ArrayList(1); + Collection 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 refs; - Map refmap = new HashMap(); + Map 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 { private MergeStrategy mergeStrategy = MergeStrategy.RECURSIVE; - private List commits = new LinkedList(); + private List 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(); + conflicts = new HashMap<>(); conflicts.put(path, conflictingRanges); } @@ -428,7 +428,7 @@ public class MergeResult { if (!lowLevelResult.containsConflicts()) return; if (conflicts == null) - conflicts = new HashMap(); + 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> { protected NameRevCommand(Repository repo) { super(repo); mergeCost = MERGE_COST; - prefixes = new ArrayList(2); - revs = new ArrayList(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> { @Override public Map call() throws GitAPIException { try { - Map nonCommits = new HashMap(); + Map nonCommits = new HashMap<>(); FIFORevQueue pending = new FIFORevQueue(); if (refs != null) { for (Ref ref : refs) @@ -170,7 +170,7 @@ public class NameRevCommand extends GitCommand> { } Map result = - new LinkedHashMap(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> { public NameRevCommand addAnnotatedTags() { checkCallable(); if (refs == null) - refs = new ArrayList(); + 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> { public NameRevCommand addRef(Ref ref) { checkCallable(); if (refs == null) - refs = new ArrayList(); + 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(3); + refSpecs = new ArrayList<>(3); refLeaseSpecs = new HashMap<>(); } @@ -132,7 +132,7 @@ public class PushCommand extends org.eclipse.jgit.api.errors.TransportException { checkCallable(); - ArrayList pushResults = new ArrayList(3); + ArrayList pushResults = new ArrayList<>(3); try { if (refSpecs.isEmpty()) { @@ -283,7 +283,7 @@ public class PushCommand extends * @since 4.7 */ public List getRefLeaseSpecs() { - return new ArrayList(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 { org.eclipse.jgit.api.Status status = Git.wrap(repo) .status().setIgnoreSubmodules(IgnoreSubmoduleMode.ALL).call(); if (status.hasUncommittedChanges()) { - List list = new ArrayList(); + List list = new ArrayList<>(); list.addAll(status.getUncommittedChanges()); return RebaseResult.uncommittedChanges(list); } @@ -650,7 +650,7 @@ public class RebaseCommand extends GitCommand { // Get the rewritten equivalents for the parents of the given commit private List getNewParents(RevCommit commitToPick) throws IOException { - List newParents = new ArrayList(); + List 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 { private void popSteps(int numSteps) throws IOException { if (numSteps == 0) return; - List todoLines = new LinkedList(); - List poppedLines = new LinkedList(); + List todoLines = new LinkedList<>(); + List poppedLines = new LinkedList<>(); for (RebaseTodoLine line : repo.readRebaseTodo( rebaseState.getPath(GIT_REBASE_TODO), true)) { @@ -1122,7 +1122,7 @@ public class RebaseCommand extends GitCommand { } rebaseState.createFile(QUIET, ""); //$NON-NLS-1$ - ArrayList toDoSteps = new ArrayList(); + ArrayList 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 { LogCommand cmd = git.log().addRange(upstreamCommit, headCommit); commitsToUse = cmd.call(); } - List cherryPickList = new ArrayList(); + List cherryPickList = new ArrayList<>(); for (RevCommit commit : commitsToUse) { if (preserveMerges || commit.getParentCount() == 1) cherryPickList.add(commit); @@ -1605,7 +1605,7 @@ public class RebaseCommand extends GitCommand { if (raw.length == 0) return null; - Map keyValueMap = new HashMap(); + Map 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 { private ResetType mode; - private Collection filepaths = new LinkedList(); + private Collection 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 */ public class RevertCommand extends GitCommand { - private List commits = new LinkedList(); + private List commits = new LinkedList<>(); private String ourCommitName = null; - private List revertedRefs = new LinkedList(); + private List 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 { */ public RmCommand(Repository repo) { super(repo); - filepatterns = new LinkedList(); + 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 { return null; MutableObjectId id = new MutableObjectId(); - List wtEdits = new ArrayList(); - List wtDeletes = new ArrayList(); - List untracked = new ArrayList(); + List wtEdits = new ArrayList<>(); + List wtDeletes = new ArrayList<>(); + List 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> { if (stashEntries.isEmpty()) return Collections.emptyList(); - final List stashCommits = new ArrayList( + final List 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 getUncommittedChanges() { - Set uncommittedChanges = new HashSet(); + Set 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 { */ public StatusCommand addPath(String path) { if (paths == null) - paths = new LinkedList(); + 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> { */ public SubmoduleInitCommand(final Repository repo) { super(repo); - paths = new ArrayList(); + paths = new ArrayList<>(); } /** @@ -99,7 +99,7 @@ public class SubmoduleInitCommand extends GitCommand> { if (!paths.isEmpty()) generator.setFilter(PathFilterGroup.createFromStrings(paths)); StoredConfig config = repo.getConfig(); - List initialized = new ArrayList(); + List 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(); + 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 statuses = new HashMap(); + Map 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> { */ public SubmoduleSyncCommand(final Repository repo) { super(repo); - paths = new ArrayList(); + paths = new ArrayList<>(); } /** @@ -115,7 +115,7 @@ public class SubmoduleSyncCommand extends GitCommand> { try (SubmoduleWalk generator = SubmoduleWalk.forIndex(repo)) { if (!paths.isEmpty()) generator.setFilter(PathFilterGroup.createFromStrings(paths)); - Map synced = new HashMap(); + Map 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(); + 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 updated = new ArrayList(); + List 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(); + 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(); + 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 parseAttributes(String attributesLine) { // the C implementation oddly enough allows \r between attributes too. - ArrayList result = new ArrayList(); + ArrayList 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 cs = new SubsequenceComparator(cmp); + SubsequenceComparator cs = new SubsequenceComparator<>(cmp); Subsequence as = Subsequence.a(a, region); Subsequence 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 r = new ArrayList(); + List 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 { /** @return obtain a comparator that uses the cached hash codes. */ public HashedSequenceComparator getComparator() { - return new HashedSequenceComparator(cmp); + return new HashedSequenceComparator<>(cmp); } /** @return wrapper around A that includes cached hash codes. */ @@ -103,6 +103,6 @@ public class HashedSequencePair { final int[] hashes = new int[end]; for (int ptr = 0; ptr < end; ptr++) hashes[ptr] = cmp.hash(base, ptr); - return new HashedSequence(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 void diffNonCommon(EditList edits, HashedSequenceComparator cmp, HashedSequence a, HashedSequence b, Edit region) { - new State(edits, cmp, a, b).diffRegion(region); + new State<>(edits, cmp, a, b).diffRegion(region); } private class State { private final HashedSequenceComparator cmp; private final HashedSequence a; private final HashedSequence b; - private final List queue = new ArrayList(); + private final List 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(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> subcmp() { - return new SubsequenceComparator>(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 EditList diffNonCommon( SequenceComparator cmp, S a, S b) { - HashedSequencePair p = new HashedSequencePair(cmp, a, b); + HashedSequencePair p = new HashedSequencePair<>(cmp, a, b); HashedSequenceComparator hc = p.getComparator(); HashedSequence ha = p.getA(); HashedSequence 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(); - deleted = new ArrayList(); - added = new ArrayList(); + entries = new ArrayList<>(); + deleted = new ArrayList<>(); + added = new ArrayList<>(); done = false; } private void breakModifies(ContentSource.Pair reader, ProgressMonitor pm) throws IOException { - ArrayList newEntries = new ArrayList(entries.size()); + ArrayList 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 nameMap = new HashMap(); - ArrayList newAdded = new ArrayList(added.size()); + HashMap nameMap = new HashMap<>(); + ArrayList 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(nameMap.values()); + deleted = new ArrayList<>(nameMap.values()); } private int calculateModifyScore(ContentSource.Pair reader, DiffEntry d) @@ -508,8 +508,8 @@ public class RenameDetector { HashMap deletedMap = populateMap(deleted, pm); HashMap addedMap = populateMap(added, pm); - ArrayList uniqueAdds = new ArrayList(added.size()); - ArrayList> nonUniqueAdds = new ArrayList>(); + ArrayList uniqueAdds = new ArrayList<>(added.size()); + ArrayList> nonUniqueAdds = new ArrayList<>(); for (Object o : addedMap.values()) { if (o instanceof DiffEntry) @@ -518,7 +518,7 @@ public class RenameDetector { nonUniqueAdds.add((List) o); } - ArrayList left = new ArrayList(added.size()); + ArrayList 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(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 populateMap( List diffEntries, ProgressMonitor pm) { - HashMap map = new HashMap(); + HashMap map = new HashMap<>(); for (DiffEntry de : diffEntries) { Object old = map.put(id(de), de); if (old instanceof DiffEntry) { - ArrayList list = new ArrayList(2); + ArrayList 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(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 compactSrcList(List in) { - ArrayList r = new ArrayList(in.size()); + ArrayList 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 compactDstList(List in) { - ArrayList r = new ArrayList(in.size()); + ArrayList 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 extends Sequence { * @return subsequence of {@code base} as described by A in {@code region}. */ public static Subsequence a(S a, Edit region) { - return new Subsequence(a, region.beginA, region.endA); + return new Subsequence<>(a, region.beginA, region.endA); } /** @@ -81,7 +81,7 @@ public final class Subsequence extends Sequence { * @return subsequence of {@code base} as described by B in {@code region}. */ public static Subsequence b(S b, Edit region) { - return new Subsequence(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 paths = new ArrayList(128); + List 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 updated = new HashMap(); + private HashMap updated = new HashMap<>(); - private ArrayList conflicts = new ArrayList(); + private ArrayList conflicts = new ArrayList<>(); - private ArrayList removed = new ArrayList(); + private ArrayList removed = new ArrayList<>(); private ObjectId mergeCommitTree; @@ -147,7 +147,7 @@ public class DirCacheCheckout { private boolean failOnConflict = true; - private ArrayList toBeDeleted = new ArrayList(); + private ArrayList 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(); + 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 why) { super(format(why)); - causeList = Collections.unmodifiableList(new ArrayList(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, CopyOnWriteArrayList> lists = new ConcurrentHashMap, CopyOnWriteArrayList>(); + private final ConcurrentMap, CopyOnWriteArrayList> lists = new ConcurrentHashMap<>(); /** * Register an IndexChangedListener. @@ -126,7 +126,7 @@ public class ListenerList { if (list == null) { CopyOnWriteArrayList newList; - newList = new CopyOnWriteArrayList(); + 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 headsStartValue, final List heads) { this.headsStartValue = headsStartValue; - this.heads = new ArrayList(heads.size()); + this.heads = new ArrayList<>(heads.size()); this.heads.addAll(heads); - this.listForLocalUseage = new ArrayList(heads.size()); + this.listForLocalUseage = new ArrayList<>(heads.size()); } /** @@ -158,7 +158,7 @@ public class FileNameMatcher { final List allHeads = parseHeads(patternString, invalidWildgetCharacter); - List nextHeadsSuggestion = new ArrayList(2); + List 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(2); + nextHeadsSuggestion = new ArrayList<>(2); nextHeadsSuggestion.add(head); } } @@ -236,7 +236,7 @@ public class FileNameMatcher { throws InvalidPatternException { int currentIndex = 0; - List heads = new ArrayList(); + List 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 createSimpleHeads( final String patternPart, final Character invalidWildgetCharacter) { - final List heads = new ArrayList( + final List heads = new ArrayList<>( patternPart.length()); boolean escaped = false; @@ -375,7 +375,7 @@ public class FileNameMatcher { * reset and start point. */ public FileNameMatcher createMatcherForSuffix() { - final List copyOfHeads = new ArrayList(heads.size()); + final List 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(); + 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(); - minusGroups = new HashSet(); + 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(); - projects = new ArrayList(); - filteredProjects = new ArrayList(); + 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 remoteUrls = new HashMap(); + Map 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 { } if (repo.isBare()) { - bareProjects = new ArrayList(); + 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 { this.remote = remote; this.groups = groups; this.recommendShallow = recommendShallow; - copyfiles = new ArrayList(); + 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(); + 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 createMatchers(List segments, Character pathSeparator, boolean dirOnly) throws InvalidPatternException { - List matchers = new ArrayList(segments.size()); + List 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 segments = new ArrayList(count); + List 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(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(new DfsPackKey(), -1, 0, null); + clockHand = new Ref<>(new DfsPackKey(), -1, 0, null); clockHand.next = clockHand; - packCache = new ConcurrentHashMap( + 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 ref = new Ref(key, position, v.size(), v); + Ref 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(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(4); - newPackStats = new ArrayList(4); - newPackObj = new ArrayList(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(); - nonHeads = new HashSet(); - txnHeads = new HashSet(); - tagTargets = new HashSet(); + 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(packs.length); - expiredGarbagePacks = new ArrayList(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 toPrune() { int cnt = packsBefore.size(); - List all = new ArrayList(cnt); + List 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(); - objectMap = new ObjectIdOwnerMap(); + 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 r = new HashSet(stored.size() + 2); + Set 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(NO_PACKS); + this.packList = new AtomicReference<>(NO_PACKS); this.readerOptions = options; } @@ -458,7 +458,7 @@ public abstract class DfsObjDatabase extends ObjectDatabase { List scanned = listPacks(); Collections.sort(scanned); - List list = new ArrayList(scanned.size()); + List 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 reuseMap(PackList old) { Map forReuse - = new HashMap(); + = 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(); - exclude = new ArrayList(4); - newPacks = new ArrayList(1); - newStats = new ArrayList(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 toPrune() { int cnt = srcPacks.size(); - List all = new ArrayList(cnt); + List 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 baseObjects = new BlockList(); + List baseObjects = new BlockList<>(); pm.beginTask(JGitText.get().countingObjects, ProgressMonitor.UNKNOWN); for (DfsPackFile src : srcPacks) { @@ -346,7 +346,7 @@ public class DfsPackCompactor { private List toInclude(DfsPackFile src, DfsReader ctx) throws IOException { PackIndex srcIdx = src.getPackIndex(ctx); - List want = new BlockList( + List 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 { this.repoDesc = repoDesc; int dot = name.lastIndexOf('.'); this.packName = (dot < 0) ? name : name.substring(0, dot); - this.sizeMap = new HashMap(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 matches = new HashSet(4); + HashSet 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)); + 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, 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, 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 findAllFromPack(DfsPackFile pack, Iterable objects) throws IOException { - List tmp = new BlockList(); + List 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(); + 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 packed = RefList.emptyList(); RefList loose = curr.ids; - RefList.Builder sym = new RefList.Builder(curr.sym.size()); + RefList.Builder 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 packs = new ArrayList(); + private List packs = new ArrayList<>(); MemObjDatabase(DfsRepository repo) { super(repo, new DfsReaderOptions()); @@ -132,7 +132,7 @@ public class InMemoryRepository extends DfsRepository { Collection desc, Collection replace) { List n; - n = new ArrayList(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 - fileMap = new HashMap(); + 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 refs = new ConcurrentHashMap(); + private final ConcurrentMap 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 ids = new RefList.Builder(); - RefList.Builder sym = new RefList.Builder(); + RefList.Builder ids = new RefList.Builder<>(); + RefList.Builder 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 - revMap = new ObjectIdOwnerMap(); + revMap = new ObjectIdOwnerMap<>(); private final BlockList - revList = new BlockList(); + 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 scanLoose() { - ObjectIdOwnerMap m = new ObjectIdOwnerMap(); + ObjectIdOwnerMap 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(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(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 getAdditionalHaves() { - HashSet r = new HashSet(); + HashSet 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 deletionCandidates = new HashMap(); + Map deletionCandidates = new HashMap<>(); Set indexObjects = null; File objects = repo.getObjectsDirectory(); String[] fanout = objects.list(); @@ -694,7 +694,7 @@ public class GC { */ public void packRefs() throws IOException { Collection refs = repo.getRefDatabase().getRefs(Constants.R_REFS).values(); - List refsToBePacked = new ArrayList(refs.size()); + List 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 refsBefore = getAllRefs(); - Set allHeads = new HashSet(); - Set nonHeads = new HashSet(); - Set txnHeads = new HashSet(); - Set tagTargets = new HashSet(); + Set allHeads = new HashSet<>(); + Set nonHeads = new HashSet<>(); + Set txnHeads = new HashSet<>(); + Set tagTargets = new HashSet<>(); Set indexObjects = listNonHEADIndexObjects(); RefDatabase refdb = repo.getRefDatabase(); @@ -751,7 +751,7 @@ public class GC { tagTargets.add(ref.getPeeledObjectId()); } - List excluded = new LinkedList(); + List 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 ret = new ArrayList(2); + List ret = new ArrayList<>(2); PackFile heads = null; if (!allHeads.isEmpty()) { heads = writePack(allHeads, Collections. emptySet(), @@ -863,7 +863,7 @@ public class GC { .getReverseEntries(); if (rlEntries == null || rlEntries.isEmpty()) return Collections. emptySet(); - Set ret = new HashSet(); + Set 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 ret = new HashSet(); + Set ret = new HashSet<>(); while (treeWalk.next()) { checkCancelled(); @@ -965,7 +965,7 @@ public class GC { List excludeObjects) throws IOException { checkCancelled(); File tmpPack = null; - Map tmpExts = new TreeMap( + Map tmpExts = new TreeMap<>( new Comparator() { @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(NO_PACKS); + packList = new AtomicReference<>(NO_PACKS); unpackedObjectCache = new UnpackedObjectCache(); this.fs = fs; this.shallowFile = shallowFile; - alternates = new AtomicReference(); + 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(); + shallowCommitsIds = new HashSet<>(); final BufferedReader reader = open(shallowFile); try { @@ -797,7 +797,7 @@ public class ObjectDirectory extends FileObjectDatabase { final Map forReuse = reuseMap(old); final FileSnapshot snapshot = FileSnapshot.save(packDirectory); final Set names = listPackDirectory(); - final List list = new ArrayList(names.size() >> 2); + final List 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 reuseMap(final PackList old) { - final Map forReuse = new HashMap(); + final Map 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 nameSet = new HashSet(nameList.length << 1); + final Set 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 l = new ArrayList(4); + final List 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 byOffset; final BlockList - byAddOrder = new BlockList(); + byAddOrder = new BlockList<>(); final ObjectIdOwnerMap - positionEntries = new ObjectIdOwnerMap(); + 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(); + 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> looseRefs = new AtomicReference>(); + private final AtomicReference> looseRefs = new AtomicReference<>(); /** Immutable sorted list of packed references. */ - final AtomicReference packedRefs = new AtomicReference(); + final AtomicReference packedRefs = new AtomicReference<>(); /** * Number of modifications made to this database. @@ -352,7 +352,7 @@ public class RefDirectory extends RefDatabase { @Override public List getAdditionalRefs() throws IOException { - List ret = new LinkedList(); + List 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 symbolic = new RefList.Builder(4); + final RefList.Builder symbolic = new RefList.Builder<>(4); RefList.Builder newLoose; @@ -819,7 +819,7 @@ public class RefDirectory extends RefDatabase { private RefList parsePackedRefs(final BufferedReader br) throws IOException { - RefList.Builder all = new RefList.Builder(); + RefList.Builder 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 ret = new ArrayList(); + List 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(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(); + queue = new ReferenceQueue<>(); clock = new AtomicLong(1); - table = new AtomicReferenceArray(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 matches = new HashSet(4); + HashSet 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(); + 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(); + 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 { Block(int threads, PackConfig config, ObjectReader reader, DeltaCache dc, ThreadSafeProgressMonitor pm, ObjectToPack[] list, int begin, int end) { - this.tasks = new ArrayList(threads); + this.tasks = new ArrayList<>(threads); this.threads = threads; this.config = config; this.templateReader = reader; @@ -176,7 +176,7 @@ final class DeltaTask implements Callable { } private ArrayList computeTopPaths() { - ArrayList topPaths = new ArrayList( + ArrayList topPaths = new ArrayList<>( threads); int cp = beginIndex; int ch = list[cp].getPathHash(); @@ -277,7 +277,7 @@ final class DeltaTask implements Callable { DeltaTask(Block b) { this.block = b; - this.slices = new LinkedList(); + 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 NONE = Collections.emptySet(); private static final Map, Boolean> instances = - new ConcurrentHashMap, Boolean>(); + new ConcurrentHashMap<>(); private static final Iterable instancesIterable = new Iterable() { @Override @@ -217,21 +217,21 @@ public class PackWriter implements AutoCloseable { @SuppressWarnings("unchecked") BlockList objectsLists[] = new BlockList[OBJ_TAG + 1]; { - objectsLists[OBJ_COMMIT] = new BlockList(); - objectsLists[OBJ_TREE] = new BlockList(); - objectsLists[OBJ_BLOB] = new BlockList(); - objectsLists[OBJ_TAG] = new BlockList(); + objectsLists[OBJ_COMMIT] = new BlockList<>(); + objectsLists[OBJ_TREE] = new BlockList<>(); + objectsLists[OBJ_BLOB] = new BlockList<>(); + objectsLists[OBJ_TAG] = new BlockList<>(); } - private ObjectIdOwnerMap objectsMap = new ObjectIdOwnerMap(); + private ObjectIdOwnerMap objectsMap = new ObjectIdOwnerMap<>(); // edge objects for thin packs - private List edgeObjects = new BlockList(); + private List edgeObjects = new BlockList<>(); // Objects the client is known to have already. private BitmapBuilder haveObjects; - private List cachedPacks = new ArrayList(2); + private List cachedPacks = new ArrayList<>(2); private Set 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(this); + selfRef = new WeakReference<>(this); instances.put(selfRef, Boolean.TRUE); } @@ -387,7 +387,7 @@ public class PackWriter implements AutoCloseable { */ public void setClientShallowCommits(Set clientShallowCommits) { stats.clientShallowCommits = Collections - .unmodifiableSet(new HashSet(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(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 tmp = new BlockList((int) cnt); + BlockList 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 errors) throws IOException { - List> futures = new ArrayList>(tb.tasks.size()); + List> 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 all = new ArrayList(want.size() + have.size()); + List 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 wantObjs = new ArrayList(want.size()); - List haveObjs = new ArrayList(haveEst); - List wantTags = new ArrayList(want.size()); + List wantObjs = new ArrayList<>(want.size()); + List haveObjs = new ArrayList<>(haveEst); + List 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(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 baseTrees = new HashSet(); - BlockList commits = new BlockList(); + Set baseTrees = new HashSet<>(); + BlockList commits = new BlockList<>(); Set 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 selections = new BlockList( + BlockList 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> chains = - new ArrayList>(); + 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(); + 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 reuseCommits = new ArrayList(); + List 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 tipCommitBitmaps = new ArrayList( + List tipCommitBitmaps = new ArrayList<>( want.size()); - Set peeledWant = new HashSet(want.size()); + Set 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(); + alternateObjectDirectories = new LinkedList<>(); alternateObjectDirectories.add(other); } return self(); @@ -429,7 +429,7 @@ public class BaseRepositoryBuilder(); + 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(); + this.commands = new ArrayList<>(); this.atomic = refdb.performsAtomicTransactions(); } @@ -400,7 +400,7 @@ public class BatchRefUpdate { } monitor.beginTask(JGitText.get().updatingReferences, commands.size()); - List commands2 = new ArrayList( + List 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 takenNames = new HashSet(refdb.getRefs( + Collection takenNames = new HashSet<>(refdb.getRefs( RefDatabase.ALL).keySet()); Collection takenPrefixes = getTakenPrefixes(takenNames); @@ -525,7 +525,7 @@ public class BatchRefUpdate { private static Collection getTakenPrefixes( final Collection names) { - Collection ref = new HashSet(); + Collection ref = new HashSet<>(); for (String name : names) ref.addAll(getPrefixes(name)); return ref; @@ -539,7 +539,7 @@ public class BatchRefUpdate { } static Collection getPrefixes(String s) { - Collection ret = new HashSet(); + Collection 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(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 r = new ArrayList(max); + final ArrayList 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 r = new ArrayList(max); + final ArrayList 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 newEntries = new ArrayList(); + final List 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 entries, ConfigSnapshot base) { entryList = entries; - cache = new ConcurrentHashMap(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 m = new LinkedHashMap(); + Map 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 sort(List in) { - List sorted = new ArrayList(in.size()); + List 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> subsections; SectionNames(ConfigSnapshot cfg) { - Map sec = new LinkedHashMap(); - Map> sub = new HashMap>(); + Map sec = new LinkedHashMap<>(); + Map> sub = new HashMap<>(); while (cfg != null) { for (ConfigLine e : cfg.entryList) { if (e.section == null) @@ -253,7 +253,7 @@ class ConfigSnapshot { Set m = sub.get(l1); if (m == null) { - m = new LinkedHashSet(); + 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 added = new HashSet(); + private Set added = new HashSet<>(); - private Set changed = new HashSet(); + private Set changed = new HashSet<>(); - private Set removed = new HashSet(); + private Set removed = new HashSet<>(); - private Set missing = new HashSet(); + private Set missing = new HashSet<>(); - private Set modified = new HashSet(); + private Set modified = new HashSet<>(); - private Set untracked = new HashSet(); + private Set untracked = new HashSet<>(); - private Map conflicts = new HashMap(); + private Map conflicts = new HashMap<>(); private Set ignored; @@ -275,11 +275,11 @@ public class IndexDiff { private IndexDiffFilter indexDiffFilter; - private Map submoduleIndexDiffs = new HashMap(); + private Map submoduleIndexDiffs = new HashMap<>(); private IgnoreSubmoduleMode ignoreSubmoduleMode = null; - private Map> fileModes = new HashMap>(); + private Map> 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 filters = new ArrayList(4); + Collection 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(); + values = new HashSet<>(); values.add(path); fileModes.put(treeWalk.getFileMode(i), values); } @@ -687,7 +687,7 @@ public class IndexDiff { */ public Set getAssumeUnchanged() { if (assumeUnchanged == null) { - HashSet unchanged = new HashSet(); + HashSet 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 getUntrackedFolders() { return ((indexDiffFilter == null) ? Collections. emptySet() - : new HashSet(indexDiffFilter.getUntrackedFolders())); + : new HashSet<>(indexDiffFilter.getUntrackedFolders())); } /** @@ -727,7 +727,7 @@ public class IndexDiff { public Set getPathsWithIndexMode(final FileMode mode) { Set paths = fileModes.get(mode); if (paths == null) - paths = new HashSet(); + 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 normalized = windows || macosx - ? new HashSet() + ? 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 matches = resolve(abbrev); while (1 < matches.size() && len < Constants.OBJECT_ID_STRING_LENGTH) { abbrev = objectId.abbreviate(++len); - List n = new ArrayList(8); + List 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 r = new LinkedList(); + List 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 { * @return sorted collection of refs */ public static Collection sort(final Collection refs) { - final List r = new ArrayList(refs); + final List 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 conflicting = new ArrayList(); + List 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(); + 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(); + return new HashMap<>(); } } @@ -1102,7 +1102,7 @@ public abstract class Repository implements AutoCloseable { @NonNull public Map> getAllRefsByPeeledObjectId() { Map allRefs = getAllRefs(); - Map> ret = new HashMap>(allRefs.size()); + Map> 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(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 heads = new LinkedList(); + LinkedList 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 getKeys() { - return new ArrayList(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 MergeResult merge( SequenceComparator cmp, S base, S ours, S theirs) { - List sequences = new ArrayList(3); + List sequences = new ArrayList<>(3); sequences.add(base); sequences.add(ours); sequences.add(theirs); - MergeResult result = new MergeResult(sequences); + MergeResult result = new MergeResult<>(sequences); if (ours.size() == 0) { if (theirs.size() != 0) { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java index ee6095aa71..43876a6227 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeFormatter.java @@ -105,7 +105,7 @@ public class MergeFormatter { @SuppressWarnings("unchecked") public void formatMerge(OutputStream out, MergeResult res, String baseName, String oursName, String theirsName, String charsetName) throws IOException { - List names = new ArrayList(3); + List names = new ArrayList<>(3); names.add(baseName); names.add(oursName); names.add(theirsName); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java index 82cbf368c7..ca0e18a0ef 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeMessageFormatter.java @@ -71,11 +71,11 @@ public class MergeMessageFormatter { StringBuilder sb = new StringBuilder(); sb.append("Merge "); //$NON-NLS-1$ - List branches = new ArrayList(); - List remoteBranches = new ArrayList(); - List tags = new ArrayList(); - List commits = new ArrayList(); - List others = new ArrayList(); + List branches = new ArrayList<>(); + List remoteBranches = new ArrayList<>(); + List tags = new ArrayList<>(); + List commits = new ArrayList<>(); + List others = new ArrayList<>(); for (Ref ref : refsToMerge) { if (ref.getName().startsWith(Constants.R_HEADS)) { branches.add("'" + Repository.shortenRefName(ref.getName()) //$NON-NLS-1$ @@ -95,7 +95,7 @@ public class MergeMessageFormatter { } } - List listings = new ArrayList(); + List listings = new ArrayList<>(); if (!branches.isEmpty()) listings.add(joinNames(branches, "branch", "branches")); //$NON-NLS-1$//$NON-NLS-2$ diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeStrategy.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeStrategy.java index c5e615ed87..656480e468 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeStrategy.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/MergeStrategy.java @@ -80,7 +80,7 @@ public abstract class MergeStrategy { */ public static final ThreeWayMergeStrategy RECURSIVE = new StrategyRecursive(); - private static final HashMap STRATEGIES = new HashMap(); + private static final HashMap STRATEGIES = new HashMap<>(); static { register(OURS); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/RecursiveMerger.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/RecursiveMerger.java index e0556447ce..f8e1998ed7 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/RecursiveMerger.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/RecursiveMerger.java @@ -147,7 +147,7 @@ public class RecursiveMerger extends ResolveMerger { */ protected RevCommit getBaseCommit(RevCommit a, RevCommit b, int callDepth) throws IOException { - ArrayList baseCommits = new ArrayList(); + ArrayList baseCommits = new ArrayList<>(); walk.reset(); walk.setRevFilter(RevFilter.MERGE_BASE); walk.markStart(a); @@ -181,7 +181,7 @@ public class RecursiveMerger extends ResolveMerger { dircache = DirCache.read(reader, currentBase.getTree()); inCore = true; - List parents = new ArrayList(); + List parents = new ArrayList<>(); parents.add(currentBase); for (int commitIdx = 1; commitIdx < baseCommits.size(); commitIdx++) { RevCommit nextBase = baseCommits.get(commitIdx); diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java index fd5e7ef7ba..f667af278a 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java @@ -180,14 +180,14 @@ public class ResolveMerger extends ThreeWayMerger { * * @since 3.4 */ - protected List unmergedPaths = new ArrayList(); + protected List unmergedPaths = new ArrayList<>(); /** * Files modified during this merge operation. * * @since 3.4 */ - protected List modifiedFiles = new LinkedList(); + protected List modifiedFiles = new LinkedList<>(); /** * If the merger has nothing to do for a file but check it out at the end of @@ -195,7 +195,7 @@ public class ResolveMerger extends ThreeWayMerger { * * @since 3.4 */ - protected Map toBeCheckedOut = new HashMap(); + protected Map toBeCheckedOut = new HashMap<>(); /** * Paths in this list will be deleted from the local copy at the end of the @@ -203,7 +203,7 @@ public class ResolveMerger extends ThreeWayMerger { * * @since 3.4 */ - protected List toBeDeleted = new ArrayList(); + protected List toBeDeleted = new ArrayList<>(); /** * Low-level textual merge results. Will be passed on to the callers in case @@ -211,14 +211,14 @@ public class ResolveMerger extends ThreeWayMerger { * * @since 3.4 */ - protected Map> mergeResults = new HashMap>(); + protected Map> mergeResults = new HashMap<>(); /** * Paths for which the merge failed altogether. * * @since 3.4 */ - protected Map failingPaths = new HashMap(); + protected Map failingPaths = new HashMap<>(); /** * Updated as we merge entries of the tree walk. Tells us whether we should @@ -518,7 +518,7 @@ public class ResolveMerger extends ThreeWayMerger { unmergedPaths.add(tw.getPathString()); mergeResults.put( tw.getPathString(), - new MergeResult(Collections + new MergeResult<>(Collections . emptyList())); } return true; 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> cachedBundles - = new HashMap>(); + = new HashMap<>(); /** * Looks up for a translation bundle in the global cache. If found returns @@ -87,7 +87,7 @@ class GlobalBundleCache { try { Map bundles = cachedBundles.get(locale); if (bundles == null) { - bundles = new HashMap(); + 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 map = new ConcurrentHashMap(); + final private ConcurrentHashMap 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 ids = new ArrayList(); + final List 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(); + 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(); - errors = new ArrayList(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 extends private int positionsAllocated; - private final TreeSet freePositions = new TreeSet(); + private final TreeSet freePositions = new TreeSet<>(); - private final HashSet activeLanes = new HashSet(32); + private final HashSet activeLanes = new HashSet<>(32); /** number of (child) commits on a lane */ - private final HashMap laneLength = new HashMap( + private final HashMap 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(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 ret = new LinkedList(); + private LinkedList 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(); + 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(); + 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 r = new ArrayList(4); + final ArrayList 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 src = getFooterLines(); if (src.isEmpty()) return Collections.emptyList(); - final ArrayList r = new ArrayList(src.size()); + final ArrayList 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 { /** Create an empty set of flags. */ public RevFlagSet() { - active = new ArrayList(); + active = new ArrayList<>(); } /** @@ -72,7 +72,7 @@ public class RevFlagSet extends AbstractSet { */ public RevFlagSet(final RevFlagSet s) { mask = s.mask; - active = new ArrayList(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, AutoCloseable { private RevWalk(ObjectReader or, boolean closeReader) { reader = or; idBuffer = new MutableObjectId(); - objects = new ObjectIdOwnerMap(); - roots = new ArrayList(); + 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, AutoCloseable { */ public AsyncRevObjectQueue parseAny( Iterable objectIds, boolean reportMissing) { - List need = new ArrayList(); - List have = new ArrayList(); + List need = new ArrayList<>(); + List 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 commits = new ArrayList(); + List 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 result = new ArrayList(); + List 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(); + 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> reqHdr = c.getRequestProperties(); - final SortedMap sigHdr = new TreeMap(); + final SortedMap sigHdr = new TreeMap<>(); for (final Map.Entry> 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 entries = new ArrayList(); + final List entries = new ArrayList<>(); private final String bucket; @@ -680,7 +680,7 @@ public class AmazonS3 { } void list() throws IOException { - final Map args = new TreeMap(); + final Map 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 remoteCapablities = new HashSet(); + private final Set remoteCapablities = new HashSet<>(); /** Extra objects the remote has, but which aren't offered as refs. */ - protected final Set additionalHaves = new HashSet(); + protected final Set 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 avail = new LinkedHashMap(); + final LinkedHashMap 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(); + 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 refUpdates, final ProgressMonitor monitor) throws IOException { - Set remoteObjects = new HashSet(); - Set newObjects = new HashSet(); + Set remoteObjects = new HashSet<>(); + Set 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 caps = new HashSet(); + final HashSet 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(); - clientShallowCommits = new HashSet(); + 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(); - commands = new ArrayList(); + 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 prereqs = new HashMap(); + final Map 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 avail = new LinkedHashMap(); + final LinkedHashMap 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 missing = new HashMap(); - final List commits = new ArrayList(); + final Map missing = new HashMap<>(); + final List commits = new ArrayList<>(); for (final Map.Entry 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(); - assume = new HashSet(); - tagTargets = new HashSet(); + 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 inc = new HashSet(); - final HashSet exc = new HashSet(); + final HashSet inc = new HashSet<>(); + final HashSet 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( + 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 items = new ArrayList(); + List 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 toFetch; /** Set of refs we will actually wind up asking to obtain. */ - private final HashMap askFor = new HashMap(); + private final HashMap askFor = new HashMap<>(); /** Objects we know we have locally. */ - private final HashSet have = new HashSet(); + private final HashSet have = new HashSet<>(); /** Updates to local tracking branches (if any). */ - private final ArrayList localUpdates = new ArrayList(); + private final ArrayList localUpdates = new ArrayList<>(); /** Records to be recorded into FETCH_HEAD. */ - private final ArrayList fetchHeadUpdates = new ArrayList(); + private final ArrayList fetchHeadUpdates = new ArrayList<>(); - private final ArrayList packLocks = new ArrayList(); + private final ArrayList 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 matched = new HashSet(); + final Set 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 avail = new HashMap(); + final HashMap avail = new HashMap<>(); for (final Ref r : conn.getRefs()) avail.put(r.getObjectId(), r); - final Collection wants = new ArrayList(askFor.values()); + final Collection 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 expandAutoFollowTags() throws TransportException { - final Collection additionalTags = new ArrayList(); + final Collection additionalTags = new ArrayList<>(); final Map 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 forMerge; FetchResult() { - forMerge = new ArrayList(); + 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 r = new LinkedHashMap(); + final Map 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 parse(String auth) { - Map p = new HashMap(); + Map 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 byIdentityFile = new HashMap(); + private final Map 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 { if (++size == growAt) grow(); - insert(new Node(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 hosts = new HashMap(); + private Map hosts = new HashMap<>(); private static final TreeMap STATE = new TreeMap() { 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 parse(final InputStream in) throws IOException { - final Map m = new LinkedHashMap(); + final Map m = new LinkedHashMap<>(); final BufferedReader br = new BufferedReader(new InputStreamReader(in)); - final List current = new ArrayList(4); + final List 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 updates = new TreeMap(); + final SortedMap 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(); + newObjectIds = new ObjectIdSubclassMap<>(); else newObjectIds = null; } @@ -333,14 +333,14 @@ public abstract class PackParser { public ObjectIdSubclassMap getNewObjectIds() { if (newObjectIds != null) return newObjectIds; - return new ObjectIdSubclassMap(); + return new ObjectIdSubclassMap<>(); } /** @return set of objects the incoming pack assumed for delta purposes */ public ObjectIdSubclassMap getBaseObjectIds() { if (baseObjectIds != null) return baseObjectIds; - return new ObjectIdSubclassMap(); + return new ObjectIdSubclassMap<>(); } /** @@ -527,9 +527,9 @@ public abstract class PackParser { readPackHeader(); entries = new PackedObjectInfo[(int) objectCount]; - baseById = new ObjectIdOwnerMap(); - baseByPos = new LongMap(); - deferredCheckBlobs = new BlockList(); + 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(); + baseObjectIds = new ObjectIdSubclassMap<>(); - final List missing = new ArrayList(64); + final List 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(); + this.toPush = new HashMap<>(); this.out = out; this.pushOptions = transport.getPushOptions(); for (final RemoteRefUpdate rru : toPush) { @@ -190,7 +190,7 @@ class PushProcess { private Map prepareRemoteUpdates() throws TransportException { boolean atomic = transport.isPushAtomic(); - final Map result = new HashMap(); + final Map 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 capablities = new LinkedHashSet(); + final Set capablities = new LinkedHashSet<>(); - private final Set sent = new HashSet(); + private final Set 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 getAllRemoteConfigs(final Config rc) throws URISyntaxException { - final List names = new ArrayList(rc + final List names = new ArrayList<>(rc .getSubsections(SECTION)); Collections.sort(names); - final List result = new ArrayList(names + final List 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 insteadOf = getReplacements(rc, KEY_INSTEADOF); - uris = new ArrayList(vlst.length); + uris = new ArrayList<>(vlst.length); for (final String s : vlst) uris.add(new URIish(replaceUri(s, insteadOf))); Map pushInsteadOf = getReplacements(rc, KEY_PUSHINSTEADOF); vlst = rc.getStringList(SECTION, name, KEY_PUSHURL); - pushURIs = new ArrayList(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(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(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 vlst = new ArrayList(); + final List vlst = new ArrayList<>(); vlst.clear(); for (final URIish u : getURIs()) @@ -272,7 +272,7 @@ public class RemoteConfig implements Serializable { private Map getReplacements(final Config config, final String keyName) { - final Map replacements = new HashMap(); + final Map 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 extends TransportProtocol { ReceivePackFactory receivePackFactory) { this.uploadPackFactory = uploadPackFactory; this.receivePackFactory = receivePackFactory; - this.handles = new HashMap(); + this.handles = new HashMap<>(); } @Override @@ -174,7 +174,7 @@ public class TestProtocol extends TransportProtocol { public FetchConnection openFetch() throws NotSupportedException, TransportException { handle.remote.incrementOpen(); - return new InternalFetchConnection( + return new InternalFetchConnection<>( this, uploadPackFactory, handle.req, handle.remote); } @@ -182,7 +182,7 @@ public class TestProtocol extends TransportProtocol { public PushConnection openPush() throws NotSupportedException, TransportException { handle.remote.incrementOpen(); - return new InternalPushConnection( + 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 filter(Map refs) { - Map result = new HashMap(); + Map result = new HashMap<>(); for (Map.Entry 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> protocols = - new CopyOnWriteArrayList>(); + 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(proto)); + protocols.add(0, new WeakReference<>(proto)); } /** @@ -256,7 +256,7 @@ public abstract class Transport implements AutoCloseable { */ public static List getTransportProtocols() { int cnt = protocols.size(); - List res = new ArrayList(cnt); + List res = new ArrayList<>(cnt); for (WeakReference 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 transports = new ArrayList(1); + final ArrayList 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 uris = getURIs(cfg, op); - final List transports = new ArrayList(uris.size()); + final List 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 fetchSpecs) throws IOException { if (fetchSpecs == null) fetchSpecs = Collections.emptyList(); - final List result = new LinkedList(); + final List result = new LinkedList<>(); final Collection procRefs = expandPushWildcardsFor(db, specs); for (final RefSpec spec : procRefs) { @@ -698,7 +698,7 @@ public abstract class Transport implements AutoCloseable { final Repository db, final Collection specs) throws IOException { final Map localRefs = db.getRefDatabase().getRefs(ALL); - final Collection procRefs = new HashSet(); + final Collection 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 tmp = new ArrayList(toFetch); + final Collection 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 getPackNames() throws IOException { - final HashSet have = new HashSet(); + final HashSet have = new HashSet<>(); have.addAll(s3.list(bucket, resolveKey("pack"))); //$NON-NLS-1$ - final Collection packs = new ArrayList(); + final Collection 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 readAdvertisedRefs() throws TransportException { - final TreeMap avail = new TreeMap(); + final TreeMap 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 schemeSet = Collections - .unmodifiableSet(new LinkedHashSet(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 schemeSet = Collections - .unmodifiableSet(new LinkedHashSet(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 args = new ArrayList(); + List 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 schemeSet = Collections - .unmodifiableSet(new LinkedHashSet(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(); + ignoreTypes = new HashSet<>(); } ignoreTypes.add(authMethod.getType()); @@ -726,7 +726,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport, @Override Collection getPackNames() throws IOException { - final Collection packs = new ArrayList(); + final Collection packs = new ArrayList<>(); try { final BufferedReader br = openReader(INFO_PACKS); try { @@ -779,7 +779,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport, Map readAdvertisedImpl(final BufferedReader br) throws IOException, PackProtocolException { - final TreeMap avail = new TreeMap(); + final TreeMap 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(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(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 getPackNames() throws IOException { - final List packs = new ArrayList(); + final List packs = new ArrayList<>(); try { @SuppressWarnings("unchecked") final Collection list = ftp.ls("pack"); //$NON-NLS-1$ final HashMap files; final HashMap mtimes; - files = new HashMap(); - mtimes = new HashMap(); + 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 readAdvertisedRefs() throws TransportException { - final TreeMap avail = new TreeMap(); + final TreeMap 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 opts = new HashSet(); + final HashSet 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 wantIds = new HashSet(); + private final Set wantIds = new HashSet<>(); /** Objects the client wants to obtain. */ - private final Set wantAll = new HashSet(); + private final Set wantAll = new HashSet<>(); /** Objects on both sides, these don't have to be sent. */ - private final Set commonBase = new HashSet(); + private final Set commonBase = new HashSet<>(); /** Shallow commits the client already has. */ - private final Set clientShallowCommits = new HashSet(); + private final Set clientShallowCommits = new HashSet<>(); /** Shallow commits on the client which are now becoming unshallow */ - private final List unshallowCommits = new ArrayList(); + private final List 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 refIdSet(Collection refs) { - Set ids = new HashSet(refs.size()); + Set 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 peerHas = new ArrayList(64); + List 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(); + notAdvertisedWants = new ArrayList<>(); notAdvertisedWants.add(obj); } } @@ -1488,7 +1488,7 @@ public class UploadPack { pw.setReuseValidatingObjects(false); if (commonBase.isEmpty() && refs != null) { - Set tagTargets = new HashSet(); + Set 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(); + remotes = new ArrayList<>(); remotes.add(w); - unfetchedPacks = new LinkedList(); - packsConsidered = new HashSet(); + unfetchedPacks = new LinkedList<>(); + packsConsidered = new HashSet<>(); - noPacksYet = new LinkedList(); + noPacksYet = new LinkedList<>(); noPacksYet.add(w); - noAlternatesYet = new LinkedList(); + noAlternatesYet = new LinkedList<>(); noAlternatesYet.add(w); - fetchErrors = new HashMap>(); - packLocks = new ArrayList(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(); + workQueue = new LinkedList<>(); } @Override @@ -273,7 +273,7 @@ class WalkFetchConnection extends BaseFetchConnection { private void queueWants(final Collection want) throws TransportException { - final HashSet inWorkQueue = new HashSet(); + final HashSet 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 swapFetchQueue() { final Iterator r = workQueue.iterator(); - workQueue = new LinkedList(); + workQueue = new LinkedList<>(); return r; } @@ -794,7 +794,7 @@ class WalkFetchConnection extends BaseFetchConnection { final ObjectId objId = id.copy(); List errors = fetchErrors.get(objId); if (errors == null) { - errors = new ArrayList(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(getRefsMap()); - packedRefUpdates = new ArrayList(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 updates = new ArrayList(); + final List 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 need = new HashSet(); - final Set have = new HashSet(); + final Set need = new HashSet<>(); + final Set 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(); + 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 infoPacks = new ArrayList(); + final ArrayList 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 alts = new ArrayList(); + final Collection 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 implements RepositoryResolver { /** Initialize an empty file based resolver. */ public FileResolver() { - exports = new ConcurrentHashMap(); - exportBase = new CopyOnWriteArrayList(); + 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 filterCommandsByNameDotType = new HashMap(); + private Map 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(cmd); + cleanFilterCommandHolder = new Holder<>(cmd); } return cleanFilterCommandHolder.get(); } @@ -1415,7 +1415,7 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator { break; } } - eolStreamTypeHolder = new Holder(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 ignoredPaths = new HashSet(); + private final Set ignoredPaths = new HashSet<>(); - private final LinkedList untrackedParentFolders = new LinkedList(); + private final LinkedList untrackedParentFolders = new LinkedList<>(); - private final LinkedList untrackedFolders = new LinkedList(); + private final LinkedList 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 getUntrackedFolders() { - LinkedList ret = new LinkedList(untrackedFolders); + LinkedList 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 cached = new CopyOnWriteArrayList(); + private static final Collection 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 p = userHome; if (p == null) { - p = new Holder(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(path); + userHome = new Holder<>(path); return this; } @@ -650,7 +650,7 @@ public abstract class FS { */ public File getGitSystemConfig() { if (gitSystemConfig == null) { - gitSystemConfig = new Holder(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(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 argv = new ArrayList(4 + args.length); + List 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 argv = new ArrayList(3 + args.length); + List 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 argv = new ArrayList(4 + args.length); + List 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 files = new ArrayList(); - List dirs = new ArrayList(); + List files = new ArrayList<>(); + List 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> initialValue() { - return new HashMap>(); + return new HashMap<>(); } }; @@ -91,7 +91,7 @@ public class GitDateParser { Map map = cache .get(locale); if (map == null) { - map = new HashMap(); + 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 readLines(final String s) { - List l = new ArrayList(); + List 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 implements Iterable { - private static final RefList EMPTY = new RefList(new Ref[0], 0); + private static final RefList EMPTY = new RefList<>(new Ref[0], 0); /** * @return an empty unmodifiable reference list. @@ -213,7 +213,7 @@ public class RefList implements Iterable { * @return a new builder with the first {@code n} elements already added. */ public final Builder copy(int n) { - Builder r = new Builder(Math.max(16, n)); + Builder r = new Builder<>(Math.max(16, n)); r.addAll(list, 0, n); return r; } @@ -234,7 +234,7 @@ public class RefList implements Iterable { Ref[] newList = new Ref[cnt]; System.arraycopy(list, 0, newList, 0, cnt); newList[idx] = ref; - return new RefList(newList, cnt); + return new RefList<>(newList, cnt); } /** @@ -261,7 +261,7 @@ public class RefList implements Iterable { newList[idx] = ref; if (idx < cnt) System.arraycopy(list, idx, newList, idx + 1, cnt - idx); - return new RefList(newList, cnt + 1); + return new RefList<>(newList, cnt + 1); } /** @@ -282,7 +282,7 @@ public class RefList implements Iterable { System.arraycopy(list, 0, newList, 0, idx); if (idx + 1 < cnt) System.arraycopy(list, idx + 1, newList, idx, cnt - (idx + 1)); - return new RefList(newList, cnt - 1); + return new RefList<>(newList, cnt - 1); } /** @@ -431,7 +431,7 @@ public class RefList implements Iterable { /** @return an unmodifiable list using this collection's backing array. */ public RefList toRefList() { - return new RefList(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(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 streams = new LinkedList(); + private final LinkedList streams = new LinkedList<>(); /** Create an empty InputStream that is currently at EOF state. */ public UnionInputStream() { -- cgit v1.2.3