From 3b4448637fbb9d74e0c9d44048ba76bb7c1214ce Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Mon, 20 Feb 2017 13:17:27 +0900 Subject: [PATCH] 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 +- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../eclipse/jgit/archive/ArchiveFormats.java | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../http/apache/HttpClientConnection.java | 4 +- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../eclipse/jgit/http/server/GitFilter.java | 4 +- .../jgit/http/server/glue/MetaFilter.java | 4 +- .../http/server/glue/ServletBinderImpl.java | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../http/test/DumbClientDumbServerTest.java | 2 +- .../http/test/DumbClientSmartServerTest.java | 2 +- .../jgit/http/test/FileResolverTest.java | 10 ++--- .../http/test/SetAdditionalHeadersTest.java | 2 +- .../http/test/SmartClientSmartServerTest.java | 6 +-- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../eclipse/jgit/junit/http/AccessEvent.java | 4 +- .../eclipse/jgit/junit/http/AppServer.java | 4 +- .../eclipse/jgit/junit/http/HttpTestCase.java | 6 +-- .../jgit/junit/http/MockServletConfig.java | 2 +- .../jgit/junit/http/RecordingLogger.java | 4 +- .../jgit/junit/http/TestRequestLog.java | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../junit/LocalDiskRepositoryTestCase.java | 6 +-- .../eclipse/jgit/junit/MockSystemReader.java | 2 +- .../eclipse/jgit/junit/TestRepository.java | 4 +- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../jgit/lfs/server/s3/S3Repository.java | 10 ++--- .../eclipse/jgit/lfs/server/s3/SignerV4.java | 6 +-- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../jgit/lib/CLIRepositoryTestCase.java | 4 +- .../org/eclipse/jgit/pgm/CLIGitCommand.java | 2 +- .../tst/org/eclipse/jgit/pgm/ArchiveTest.java | 12 +++--- .../tst/org/eclipse/jgit/pgm/ConfigTest.java | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../src/org/eclipse/jgit/pgm/Add.java | 2 +- .../src/org/eclipse/jgit/pgm/Blame.java | 6 +-- .../src/org/eclipse/jgit/pgm/Branch.java | 2 +- .../src/org/eclipse/jgit/pgm/Checkout.java | 2 +- .../org/eclipse/jgit/pgm/CommandCatalog.java | 4 +- .../src/org/eclipse/jgit/pgm/Commit.java | 2 +- .../src/org/eclipse/jgit/pgm/Daemon.java | 12 +++--- .../src/org/eclipse/jgit/pgm/DiffTree.java | 2 +- .../src/org/eclipse/jgit/pgm/Log.java | 4 +- .../src/org/eclipse/jgit/pgm/LsRemote.java | 2 +- .../src/org/eclipse/jgit/pgm/LsTree.java | 2 +- .../src/org/eclipse/jgit/pgm/Main.java | 2 +- .../src/org/eclipse/jgit/pgm/MergeBase.java | 2 +- .../src/org/eclipse/jgit/pgm/Push.java | 2 +- .../src/org/eclipse/jgit/pgm/RevParse.java | 2 +- .../eclipse/jgit/pgm/RevWalkTextBuiltin.java | 4 +- .../src/org/eclipse/jgit/pgm/Rm.java | 2 +- .../src/org/eclipse/jgit/pgm/Status.java | 14 +++---- .../jgit/pgm/debug/DiffAlgorithms.java | 6 +-- .../jgit/pgm/debug/RebuildCommitGraph.java | 10 ++--- .../jgit/pgm/debug/TextHashFunctions.java | 14 +++---- .../eclipse/jgit/pgm/opt/CmdLineParser.java | 2 +- .../jgit/pgm/opt/PathTreeFilterHandler.java | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../jgit/patch/EGitPatchHistoryTest.java | 6 +-- .../src/org/eclipse/jgit/lib/Sets.java | 2 +- .../eclipse/jgit/api/ArchiveCommandTest.java | 2 +- .../eclipse/jgit/api/CleanCommandTest.java | 2 +- .../eclipse/jgit/api/CloneCommandTest.java | 2 +- .../org/eclipse/jgit/api/LogCommandTest.java | 6 +-- .../eclipse/jgit/api/MergeCommandTest.java | 2 +- .../eclipse/jgit/api/NameRevCommandTest.java | 2 +- .../attributes/TreeWalkAttributeTest.java | 6 +-- .../eclipse/jgit/diff/DiffFormatterTest.java | 2 +- .../eclipse/jgit/diff/RenameDetectorTest.java | 2 +- .../DirCacheCGitCompatabilityTest.java | 6 +-- .../jgit/dircache/DirCachePathEditTest.java | 2 +- .../jgit/gitrepo/ManifestParserTest.java | 2 +- .../internal/storage/dfs/DfsInserterTest.java | 2 +- .../storage/file/AbbreviationTest.java | 4 +- .../storage/file/FileSnapshotTest.java | 2 +- .../internal/storage/file/GcTestCase.java | 2 +- .../internal/storage/file/PackFileTest.java | 4 +- .../internal/storage/file/PackWriterTest.java | 18 ++++----- .../storage/file/RefDirectoryTest.java | 8 ++-- .../storage/file/WindowCacheGetTest.java | 2 +- .../jgit/lib/BranchTrackingStatusTest.java | 2 +- .../tst/org/eclipse/jgit/lib/ConfigTest.java | 2 +- .../jgit/lib/DirCacheCheckoutTest.java | 12 +++--- .../org/eclipse/jgit/lib/IndexDiffTest.java | 16 ++++---- .../jgit/lib/ObjectIdOwnerMapTest.java | 14 +++---- .../jgit/lib/ObjectIdSubclassMapTest.java | 14 +++---- .../org/eclipse/jgit/lib/RacyGitTests.java | 4 +- .../lib/RefDatabaseConflictingNamesTest.java | 6 +-- .../tst/org/eclipse/jgit/lib/RefTest.java | 2 +- .../jgit/merge/RecursiveMergerTest.java | 6 +-- .../jgit/notes/DefaultNoteMergerTest.java | 2 +- .../eclipse/jgit/notes/NoteMapMergerTest.java | 2 +- .../org/eclipse/jgit/notes/NoteMapTest.java | 2 +- .../revplot/AbstractPlotRendererTest.java | 4 +- .../jgit/revplot/PlotCommitListTest.java | 32 +++++++-------- .../jgit/revwalk/FIFORevQueueTest.java | 2 +- .../jgit/revwalk/LIFORevQueueTest.java | 2 +- .../jgit/revwalk/RevCommitListTest.java | 2 +- .../jgit/revwalk/RevWalkFollowFilterTest.java | 2 +- .../revwalk/RevWalkPathFilter6012Test.java | 2 +- .../eclipse/jgit/revwalk/RevWalkTestCase.java | 2 +- .../jgit/submodule/SubmoduleWalkTest.java | 2 +- .../eclipse/jgit/transport/HttpAuthTest.java | 2 +- .../eclipse/jgit/transport/LongMapTest.java | 2 +- .../jgit/transport/PackParserTest.java | 2 +- .../jgit/transport/PushProcessTest.java | 6 +-- .../ReceivePackAdvertiseRefsHookTest.java | 14 +++---- .../jgit/transport/TestProtocolTest.java | 8 ++-- .../jgit/transport/WalkEncryptionTest.java | 14 +++---- .../treewalk/filter/PathSuffixFilterTest.java | 2 +- .../org/eclipse/jgit/util/BlockListTest.java | 32 +++++++-------- .../org/eclipse/jgit/util/ReadLinesTest.java | 2 +- .../org/eclipse/jgit/util/RefListTest.java | 18 ++++----- .../tst/org/eclipse/jgit/util/RefMapTest.java | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../eclipse/jgit/awtui/SwingCommitList.java | 2 +- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../src/org/eclipse/jgit/api/AddCommand.java | 2 +- .../org/eclipse/jgit/api/ApplyCommand.java | 6 +-- .../src/org/eclipse/jgit/api/ApplyResult.java | 2 +- .../org/eclipse/jgit/api/ArchiveCommand.java | 4 +- .../org/eclipse/jgit/api/BlameCommand.java | 2 +- .../org/eclipse/jgit/api/CheckoutCommand.java | 6 +-- .../org/eclipse/jgit/api/CheckoutResult.java | 8 ++-- .../eclipse/jgit/api/CherryPickCommand.java | 4 +- .../org/eclipse/jgit/api/CleanCommand.java | 10 ++--- .../org/eclipse/jgit/api/CloneCommand.java | 2 +- .../org/eclipse/jgit/api/CommitCommand.java | 4 +- .../eclipse/jgit/api/DeleteBranchCommand.java | 4 +- .../eclipse/jgit/api/DeleteTagCommand.java | 4 +- .../org/eclipse/jgit/api/DescribeCommand.java | 4 +- .../org/eclipse/jgit/api/FetchCommand.java | 2 +- .../eclipse/jgit/api/ListBranchCommand.java | 4 +- .../eclipse/jgit/api/ListNotesCommand.java | 2 +- .../org/eclipse/jgit/api/ListTagCommand.java | 2 +- .../src/org/eclipse/jgit/api/LogCommand.java | 2 +- .../org/eclipse/jgit/api/LsRemoteCommand.java | 4 +- .../org/eclipse/jgit/api/MergeCommand.java | 2 +- .../src/org/eclipse/jgit/api/MergeResult.java | 4 +- .../org/eclipse/jgit/api/NameRevCommand.java | 12 +++--- .../src/org/eclipse/jgit/api/PushCommand.java | 6 +-- .../org/eclipse/jgit/api/RebaseCommand.java | 14 +++---- .../org/eclipse/jgit/api/ResetCommand.java | 2 +- .../org/eclipse/jgit/api/RevertCommand.java | 4 +- .../src/org/eclipse/jgit/api/RmCommand.java | 2 +- .../eclipse/jgit/api/StashCreateCommand.java | 6 +-- .../eclipse/jgit/api/StashListCommand.java | 2 +- .../src/org/eclipse/jgit/api/Status.java | 2 +- .../org/eclipse/jgit/api/StatusCommand.java | 2 +- .../jgit/api/SubmoduleInitCommand.java | 4 +- .../jgit/api/SubmoduleStatusCommand.java | 4 +- .../jgit/api/SubmoduleSyncCommand.java | 4 +- .../jgit/api/SubmoduleUpdateCommand.java | 4 +- .../api/errors/CheckoutConflictException.java | 2 +- .../jgit/attributes/AttributesNode.java | 2 +- .../jgit/attributes/AttributesRule.java | 2 +- .../org/eclipse/jgit/diff/DiffAlgorithm.java | 2 +- .../src/org/eclipse/jgit/diff/DiffEntry.java | 2 +- .../eclipse/jgit/diff/HashedSequencePair.java | 4 +- .../org/eclipse/jgit/diff/HistogramDiff.java | 8 ++-- .../jgit/diff/LowLevelDiffAlgorithm.java | 2 +- .../org/eclipse/jgit/diff/RenameDetector.java | 26 ++++++------ .../jgit/diff/SimilarityRenameDetector.java | 6 +-- .../org/eclipse/jgit/diff/Subsequence.java | 4 +- .../org/eclipse/jgit/dircache/DirCache.java | 2 +- .../jgit/dircache/DirCacheCheckout.java | 8 ++-- .../eclipse/jgit/dircache/DirCacheEditor.java | 2 +- .../jgit/errors/CompoundException.java | 2 +- .../org/eclipse/jgit/events/ListenerList.java | 4 +- .../eclipse/jgit/fnmatch/FileNameMatcher.java | 14 +++---- .../org/eclipse/jgit/fnmatch/GroupHead.java | 2 +- .../eclipse/jgit/gitrepo/ManifestParser.java | 12 +++--- .../org/eclipse/jgit/gitrepo/RepoCommand.java | 2 +- .../org/eclipse/jgit/gitrepo/RepoProject.java | 2 +- .../org/eclipse/jgit/ignore/IgnoreNode.java | 2 +- .../jgit/ignore/internal/PathMatcher.java | 2 +- .../eclipse/jgit/ignore/internal/Strings.java | 2 +- .../internal/storage/dfs/DfsBlockCache.java | 10 ++--- .../storage/dfs/DfsGarbageCollector.java | 20 +++++----- .../internal/storage/dfs/DfsInserter.java | 6 +-- .../internal/storage/dfs/DfsObjDatabase.java | 6 +-- .../storage/dfs/DfsPackCompactor.java | 14 +++---- .../storage/dfs/DfsPackDescription.java | 2 +- .../jgit/internal/storage/dfs/DfsReader.java | 10 ++--- .../internal/storage/dfs/DfsRefDatabase.java | 4 +- .../storage/dfs/InMemoryRepository.java | 12 +++--- .../storage/file/BitmapIndexImpl.java | 4 +- .../storage/file/CachedObjectDirectory.java | 2 +- .../internal/storage/file/DeltaBaseCache.java | 4 +- .../internal/storage/file/FileRepository.java | 2 +- .../jgit/internal/storage/file/GC.java | 22 +++++----- .../storage/file/ObjectDirectory.java | 14 +++---- .../storage/file/PackBitmapIndexBuilder.java | 4 +- .../storage/file/PackBitmapIndexRemapper.java | 2 +- .../internal/storage/file/RefDirectory.java | 10 ++--- .../storage/file/ReflogReaderImpl.java | 2 +- .../storage/file/UnpackedObjectCache.java | 2 +- .../internal/storage/file/WindowCache.java | 4 +- .../internal/storage/file/WindowCursor.java | 2 +- .../internal/storage/pack/BaseSearch.java | 2 +- .../internal/storage/pack/DeltaCache.java | 2 +- .../jgit/internal/storage/pack/DeltaTask.java | 6 +-- .../internal/storage/pack/PackWriter.java | 40 +++++++++---------- .../pack/PackWriterBitmapPreparer.java | 12 +++--- .../jgit/lib/BaseRepositoryBuilder.java | 4 +- .../org/eclipse/jgit/lib/BatchRefUpdate.java | 10 ++--- .../src/org/eclipse/jgit/lib/Config.java | 8 ++-- .../org/eclipse/jgit/lib/ConfigSnapshot.java | 12 +++--- .../src/org/eclipse/jgit/lib/IndexDiff.java | 28 ++++++------- .../org/eclipse/jgit/lib/ObjectChecker.java | 2 +- .../org/eclipse/jgit/lib/ObjectReader.java | 2 +- .../org/eclipse/jgit/lib/RebaseTodoFile.java | 2 +- .../org/eclipse/jgit/lib/RefComparator.java | 2 +- .../src/org/eclipse/jgit/lib/RefDatabase.java | 2 +- .../src/org/eclipse/jgit/lib/Repository.java | 10 ++--- .../org/eclipse/jgit/lib/RepositoryCache.java | 2 +- .../eclipse/jgit/merge/MergeAlgorithm.java | 4 +- .../eclipse/jgit/merge/MergeFormatter.java | 2 +- .../jgit/merge/MergeMessageFormatter.java | 12 +++--- .../org/eclipse/jgit/merge/MergeStrategy.java | 2 +- .../eclipse/jgit/merge/RecursiveMerger.java | 4 +- .../org/eclipse/jgit/merge/ResolveMerger.java | 14 +++---- .../eclipse/jgit/nls/GlobalBundleCache.java | 4 +- .../src/org/eclipse/jgit/nls/NLS.java | 2 +- .../jgit/patch/CombinedFileHeader.java | 2 +- .../org/eclipse/jgit/patch/FileHeader.java | 2 +- .../src/org/eclipse/jgit/patch/Patch.java | 4 +- .../eclipse/jgit/revplot/PlotCommitList.java | 6 +-- .../org/eclipse/jgit/revplot/PlotWalk.java | 2 +- .../jgit/revwalk/MergeBaseGenerator.java | 2 +- .../org/eclipse/jgit/revwalk/ObjectWalk.java | 4 +- .../org/eclipse/jgit/revwalk/RevCommit.java | 4 +- .../org/eclipse/jgit/revwalk/RevFlagSet.java | 4 +- .../src/org/eclipse/jgit/revwalk/RevWalk.java | 8 ++-- .../eclipse/jgit/revwalk/RevWalkUtils.java | 4 +- .../org/eclipse/jgit/transport/AmazonS3.java | 8 ++-- .../jgit/transport/BasePackConnection.java | 6 +-- .../transport/BasePackFetchConnection.java | 2 +- .../transport/BasePackPushConnection.java | 4 +- .../jgit/transport/BaseReceivePack.java | 10 ++--- .../jgit/transport/BundleFetchConnection.java | 8 ++-- .../eclipse/jgit/transport/BundleWriter.java | 10 ++--- .../ChainingCredentialsProvider.java | 2 +- .../CredentialsProviderUserInfo.java | 2 +- .../eclipse/jgit/transport/FetchProcess.java | 18 ++++----- .../eclipse/jgit/transport/FetchResult.java | 2 +- .../jgit/transport/HttpAuthMethod.java | 4 +- .../transport/JschConfigSessionFactory.java | 2 +- .../org/eclipse/jgit/transport/LongMap.java | 2 +- .../src/org/eclipse/jgit/transport/NetRC.java | 2 +- .../eclipse/jgit/transport/OpenSshConfig.java | 4 +- .../jgit/transport/OperationResult.java | 2 +- .../eclipse/jgit/transport/PackParser.java | 16 ++++---- .../eclipse/jgit/transport/PushProcess.java | 4 +- .../eclipse/jgit/transport/RefAdvertiser.java | 4 +- .../eclipse/jgit/transport/RemoteConfig.java | 16 ++++---- .../eclipse/jgit/transport/TestProtocol.java | 6 +-- .../jgit/transport/TransferConfig.java | 2 +- .../org/eclipse/jgit/transport/Transport.java | 16 ++++---- .../jgit/transport/TransportAmazonS3.java | 6 +-- .../jgit/transport/TransportBundleFile.java | 2 +- .../jgit/transport/TransportGitSsh.java | 4 +- .../eclipse/jgit/transport/TransportHttp.java | 8 ++-- .../jgit/transport/TransportLocal.java | 4 +- .../eclipse/jgit/transport/TransportSftp.java | 8 ++-- .../eclipse/jgit/transport/UploadPack.java | 20 +++++----- .../jgit/transport/WalkFetchConnection.java | 22 +++++----- .../jgit/transport/WalkPushConnection.java | 14 +++---- .../transport/WalkRemoteObjectDatabase.java | 2 +- .../jgit/transport/resolver/FileResolver.java | 4 +- .../org/eclipse/jgit/treewalk/TreeWalk.java | 2 +- .../jgit/treewalk/WorkingTreeIterator.java | 4 +- .../jgit/treewalk/filter/IndexDiffFilter.java | 8 ++-- .../jgit/util/CachedAuthenticator.java | 2 +- .../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 +- .../eclipse/jgit/util/FS_Win32_Cygwin.java | 2 +- .../src/org/eclipse/jgit/util/FileUtils.java | 4 +- .../org/eclipse/jgit/util/GitDateParser.java | 4 +- .../src/org/eclipse/jgit/util/IO.java | 2 +- .../src/org/eclipse/jgit/util/RefList.java | 12 +++--- .../eclipse/jgit/util/TemporaryBuffer.java | 2 +- .../jgit/util/io/UnionInputStream.java | 2 +- 289 files changed, 765 insertions(+), 765 deletions(-) diff --git a/org.eclipse.jgit.ant.test/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.ant.test/.settings/org.eclipse.jdt.core.prefs index 47cca3692..64f74989e 100644 --- a/org.eclipse.jgit.ant.test/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.jgit.ant.test/.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.ant/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.ant/.settings/org.eclipse.jdt.core.prefs index adfb7aa3b..4d260cf48 100644 --- a/org.eclipse.jgit.ant/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.jgit.ant/.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.archive/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.archive/.settings/org.eclipse.jdt.core.prefs index 763144c86..06ddbabb4 100644 --- a/org.eclipse.jgit.archive/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.jgit.archive/.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.archive/src/org/eclipse/jgit/archive/ArchiveFormats.java b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/ArchiveFormats.java index 1be126aa8..9d3decd93 100644 --- a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/ArchiveFormats.java +++ b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/ArchiveFormats.java @@ -55,7 +55,7 @@ * that performs the same registration automatically. */ public class ArchiveFormats { - private static final List myFormats = new ArrayList(); + private static final List myFormats = new ArrayList<>(); private static final void register(String name, ArchiveCommand.Format fmt) { myFormats.add(name); diff --git a/org.eclipse.jgit.http.apache/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.http.apache/.settings/org.eclipse.jdt.core.prefs index adfb7aa3b..4d260cf48 100644 --- a/org.eclipse.jgit.http.apache/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.jgit.http.apache/.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.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java b/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java index 9285d1766..945ecd581 100644 --- a/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java +++ b/org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java @@ -264,9 +264,9 @@ private void execute() throws IOException, ClientProtocolException { @Override public Map> getHeaderFields() { - Map> ret = new HashMap>(); + Map> ret = new HashMap<>(); for (Header hdr : resp.getAllHeaders()) { - List list = new LinkedList(); + List list = new LinkedList<>(); for (HeaderElement hdrElem : hdr.getElements()) list.add(hdrElem.toString()); ret.put(hdr.getName(), list); diff --git a/org.eclipse.jgit.http.server/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.http.server/.settings/org.eclipse.jdt.core.prefs index adfb7aa3b..4d260cf48 100644 --- a/org.eclipse.jgit.http.server/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.jgit.http.server/.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.http.server/src/org/eclipse/jgit/http/server/GitFilter.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitFilter.java index 529b8391f..807037155 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitFilter.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitFilter.java @@ -95,9 +95,9 @@ public class GitFilter extends MetaFilter { private ReceivePackFactory receivePackFactory = new DefaultReceivePackFactory(); - private final List uploadPackFilters = new LinkedList(); + private final List uploadPackFilters = new LinkedList<>(); - private final List receivePackFilters = new LinkedList(); + private final List receivePackFilters = new LinkedList<>(); /** * New servlet that will load its base directory from {@code web.xml}. diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaFilter.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaFilter.java index 800c5d4fe..adb6c425d 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaFilter.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/MetaFilter.java @@ -89,7 +89,7 @@ public class MetaFilter implements Filter { /** Empty filter with no bindings. */ public MetaFilter() { - this.bindings = new ArrayList(); + this.bindings = new ArrayList<>(); } /** @@ -144,7 +144,7 @@ public void destroy() { } private static Set newIdentitySet() { - final Map m = new IdentityHashMap(); + final Map m = new IdentityHashMap<>(); return new AbstractSet() { @Override public boolean add(Object o) { diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinderImpl.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinderImpl.java index c2b037097..4e879a976 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinderImpl.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/glue/ServletBinderImpl.java @@ -58,7 +58,7 @@ abstract class ServletBinderImpl implements ServletBinder { private HttpServlet httpServlet; ServletBinderImpl() { - this.filters = new ArrayList(); + this.filters = new ArrayList<>(); } @Override diff --git a/org.eclipse.jgit.http.test/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.http.test/.settings/org.eclipse.jdt.core.prefs index 47cca3692..64f74989e 100644 --- a/org.eclipse.jgit.http.test/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.jgit.http.test/.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.http.test/tst/org/eclipse/jgit/http/test/DumbClientDumbServerTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientDumbServerTest.java index 822df7175..ab6dc35f7 100644 --- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientDumbServerTest.java +++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientDumbServerTest.java @@ -213,7 +213,7 @@ public void testInitialClone_Loose() throws Exception { @Test public void testInitialClone_Packed() throws Exception { - new TestRepository(remoteRepository).packAndPrune(); + new TestRepository<>(remoteRepository).packAndPrune(); Repository dst = createBareRepository(); assertFalse(dst.hasObject(A_txt)); diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientSmartServerTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientSmartServerTest.java index ab4ac131e..06bfd7988 100644 --- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientSmartServerTest.java +++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DumbClientSmartServerTest.java @@ -241,7 +241,7 @@ public void testInitialClone_Small() throws Exception { @Test public void testInitialClone_Packed() throws Exception { - new TestRepository(remoteRepository).packAndPrune(); + new TestRepository<>(remoteRepository).packAndPrune(); Repository dst = createBareRepository(); assertFalse(dst.hasObject(A_txt)); diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/FileResolverTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/FileResolverTest.java index 7c6d59151..82e79b8e5 100644 --- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/FileResolverTest.java +++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/FileResolverTest.java @@ -83,7 +83,7 @@ public void testUnreasonableNames() throws ServiceNotEnabledException { private static void assertUnreasonable(String name) throws ServiceNotEnabledException { - FileResolver r = new FileResolver( + FileResolver r = new FileResolver<>( new File("."), false); try { r.open(null, name); @@ -103,7 +103,7 @@ public void testExportOk() throws IOException { FileResolver resolver; assertFalse("no git-daemon-export-ok", export.exists()); - resolver = new FileResolver(base, false /* + resolver = new FileResolver<>(base, false /* * require * flag */); @@ -114,7 +114,7 @@ public void testExportOk() throws IOException { assertEquals("Service not enabled", e.getMessage()); } - resolver = new FileResolver(base, true /* + resolver = new FileResolver<>(base, true /* * export * all */); @@ -125,7 +125,7 @@ public void testExportOk() throws IOException { } FileUtils.createNewFile(export); - resolver = new FileResolver(base, false /* + resolver = new FileResolver<>(base, false /* * require * flag */); @@ -142,7 +142,7 @@ public void testNotAGitRepository() throws IOException, final Repository a = createBareRepository(); final String name = a.getDirectory().getName() + "-not-a-git"; final File base = a.getDirectory().getParentFile(); - FileResolver resolver = new FileResolver( + FileResolver resolver = new FileResolver<>( base, false); try { diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SetAdditionalHeadersTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SetAdditionalHeadersTest.java index 0a68ed261..ef8daec31 100644 --- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SetAdditionalHeadersTest.java +++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SetAdditionalHeadersTest.java @@ -112,7 +112,7 @@ public void testSetHeaders() throws IOException { assertTrue("isa TransportHttp", t instanceof TransportHttp); assertTrue("isa HttpTransport", t instanceof HttpTransport); - HashMap headers = new HashMap(); + HashMap headers = new HashMap<>(); headers.put("Cookie", "someTokenValue=23gBog34"); headers.put("AnotherKey", "someValue"); ((TransportHttp) t).setAdditionalHeaders(headers); diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java index f887da4c7..ed223c96e 100644 --- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java +++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java @@ -437,7 +437,7 @@ public void testFetch_FewLocalCommits() throws Exception { // Create a new commit on the remote. // - b = new TestRepository(remoteRepository).branch(master); + b = new TestRepository<>(remoteRepository).branch(master); RevCommit Z = b.commit().message("Z").create(); // Now incrementally update. @@ -497,7 +497,7 @@ public void testFetch_TooManyLocalCommits() throws Exception { // Create a new commit on the remote. // - b = new TestRepository(remoteRepository).branch(master); + b = new TestRepository<>(remoteRepository).branch(master); RevCommit Z = b.commit().message("Z").create(); // Now incrementally update. @@ -614,7 +614,7 @@ public void testFetch_RefsUnreadableOnUpload() throws Exception { final String repoName = "refs-unreadable"; RefsUnreadableInMemoryRepository badRefsRepo = new RefsUnreadableInMemoryRepository( new DfsRepositoryDescription(repoName)); - final TestRepository repo = new TestRepository( + final TestRepository repo = new TestRepository<>( badRefsRepo); ServletContextHandler app = noRefServer.addContext("/git"); diff --git a/org.eclipse.jgit.junit.http/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.junit.http/.settings/org.eclipse.jdt.core.prefs index 47cca3692..64f74989e 100644 --- a/org.eclipse.jgit.junit.http/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.jgit.junit.http/.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.junit.http/src/org/eclipse/jgit/junit/http/AccessEvent.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AccessEvent.java index 6580ade8e..6b7853d73 100644 --- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AccessEvent.java +++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AccessEvent.java @@ -76,7 +76,7 @@ public class AccessEvent { } private static Map cloneHeaders(final Request req) { - Map r = new TreeMap(); + Map r = new TreeMap<>(); Enumeration hn = req.getHeaderNames(); while (hn.hasMoreElements()) { String key = (String) hn.nextElement(); @@ -88,7 +88,7 @@ private static Map cloneHeaders(final Request req) { } private static Map cloneHeaders(final Response rsp) { - Map r = new TreeMap(); + Map r = new TreeMap<>(); Enumeration hn = rsp.getHttpFields().getFieldNames(); while (hn.hasMoreElements()) { String key = hn.nextElement(); diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java index 1575cb650..e9480fa9f 100644 --- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java +++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/AppServer.java @@ -262,7 +262,7 @@ public int getPort() { /** @return all requests since the server was started. */ public List getRequests() { - return new ArrayList(log.getEvents()); + return new ArrayList<>(log.getEvents()); } /** @@ -282,7 +282,7 @@ public List getRequests(URIish base, String path) { * @return all requests which match the given path. */ public List getRequests(String path) { - ArrayList r = new ArrayList(); + ArrayList r = new ArrayList<>(); for (AccessEvent event : log.getEvents()) { if (event.getPath().equals(path)) { r.add(event); diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/HttpTestCase.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/HttpTestCase.java index 5db76eb7b..1b94e02fa 100644 --- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/HttpTestCase.java +++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/HttpTestCase.java @@ -88,7 +88,7 @@ public void tearDown() throws Exception { protected TestRepository createTestRepository() throws IOException { - return new TestRepository(createBareRepository()); + return new TestRepository<>(createBareRepository()); } protected URIish toURIish(String path) throws URISyntaxException { @@ -120,12 +120,12 @@ protected List getRequests(String path) { protected static void fsck(Repository db, RevObject... tips) throws Exception { TestRepository tr = - new TestRepository(db); + new TestRepository<>(db); tr.fsck(tips); } protected static Set mirror(String... refs) { - HashSet r = new HashSet(); + HashSet r = new HashSet<>(); for (String name : refs) { RefSpec rs = new RefSpec(name); rs = rs.setDestination(name); diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/MockServletConfig.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/MockServletConfig.java index 4f11ea8fc..9defcd983 100644 --- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/MockServletConfig.java +++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/MockServletConfig.java @@ -52,7 +52,7 @@ import javax.servlet.ServletContext; public class MockServletConfig implements ServletConfig { - private final Map parameters = new HashMap(); + private final Map parameters = new HashMap<>(); public void setInitParameter(String name, String value) { parameters.put(name, value); diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java index 5fed12263..f28ef893b 100644 --- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java +++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/RecordingLogger.java @@ -53,7 +53,7 @@ /** Logs warnings into an array for later inspection. */ public class RecordingLogger implements Logger { - private static List warnings = new ArrayList(); + private static List warnings = new ArrayList<>(); /** Clear the warnings, automatically done by {@link AppServer#setUp()} */ public static void clear() { @@ -65,7 +65,7 @@ public static void clear() { /** @return the warnings (if any) from the last execution */ public static List getWarnings() { synchronized (warnings) { - ArrayList copy = new ArrayList(warnings); + ArrayList copy = new ArrayList<>(warnings); return Collections.unmodifiableList(copy); } } diff --git a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/TestRequestLog.java b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/TestRequestLog.java index 14ea03a92..c218c07a6 100644 --- a/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/TestRequestLog.java +++ b/org.eclipse.jgit.junit.http/src/org/eclipse/jgit/junit/http/TestRequestLog.java @@ -61,7 +61,7 @@ class TestRequestLog extends HandlerWrapper { private static final int MAX = 16; - private final List events = new ArrayList(); + private final List events = new ArrayList<>(); private final Semaphore active = new Semaphore(MAX); diff --git a/org.eclipse.jgit.junit/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.junit/.settings/org.eclipse.jdt.core.prefs index 47cca3692..64f74989e 100644 --- a/org.eclipse.jgit.junit/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.jgit.junit/.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.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java index b7929424f..933faf9bf 100644 --- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java +++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java @@ -286,7 +286,7 @@ public static String indexState(Repository repo, int includedOptions) throws IllegalStateException, IOException { DirCache dc = repo.readDirCache(); StringBuilder sb = new StringBuilder(); - TreeSet timeStamps = new TreeSet(); + TreeSet timeStamps = new TreeSet<>(); // iterate once over the dircache just to collect all time stamps if (0 != (includedOptions & MOD_TIME)) { @@ -552,7 +552,7 @@ private static String[] toEnvArray(final Map env) { } private static HashMap cloneEnv() { - return new HashMap(System.getenv()); + return new HashMap<>(System.getenv()); } private static final class CleanupThread extends Thread { @@ -574,7 +574,7 @@ static void removed(File tmp) { } } - private final List toDelete = new ArrayList(); + private final List toDelete = new ArrayList<>(); @Override public void run() { diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java index 6faa2ece4..68482c6c2 100644 --- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java +++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java @@ -88,7 +88,7 @@ public boolean isOutdated() { long now = 1250379778668L; // Sat Aug 15 20:12:58 GMT-03:30 2009 - final Map values = new HashMap(); + final Map values = new HashMap<>(); FileBasedConfig userGitConfig; diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java index a44e99937..d1358ee2a 100644 --- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java +++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java @@ -876,7 +876,7 @@ public void packAndPrune() throws Exception { final File pack, idx; try (PackWriter pw = new PackWriter(db)) { - Set all = new HashSet(); + Set all = new HashSet<>(); for (Ref r : db.getAllRefs().values()) all.add(r.getObjectId()); pw.preparePack(m, all, PackWriter.NONE); @@ -992,7 +992,7 @@ public class CommitBuilder { private ObjectId topLevelTree; - private final List parents = new ArrayList(2); + private final List parents = new ArrayList<>(2); private int tick = 1; diff --git a/org.eclipse.jgit.lfs.server.test/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.lfs.server.test/.settings/org.eclipse.jdt.core.prefs index 47cca3692..64f74989e 100644 --- a/org.eclipse.jgit.lfs.server.test/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.jgit.lfs.server.test/.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.lfs.server/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.lfs.server/.settings/org.eclipse.jdt.core.prefs index 2db1c4f21..ede0f7d55 100644 --- a/org.eclipse.jgit.lfs.server/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.jgit.lfs.server/.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.lfs.server/src/org/eclipse/jgit/lfs/server/s3/S3Repository.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/S3Repository.java index c229758d4..ed896adff 100644 --- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/S3Repository.java +++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/S3Repository.java @@ -94,10 +94,10 @@ public S3Repository(S3Config config) { @Override public Response.Action getDownloadAction(AnyLongObjectId oid) { URL endpointUrl = getObjectUrl(oid); - Map queryParams = new HashMap(); + Map queryParams = new HashMap<>(); queryParams.put(X_AMZ_EXPIRES, Integer.toString(s3Config.getExpirationSeconds())); - Map headers = new HashMap(); + Map headers = new HashMap<>(); String authorizationQueryParameters = SignerV4.createAuthorizationQuery( s3Config, endpointUrl, METHOD_GET, headers, queryParams, UNSIGNED_PAYLOAD); @@ -111,7 +111,7 @@ public Response.Action getDownloadAction(AnyLongObjectId oid) { public Response.Action getUploadAction(AnyLongObjectId oid, long size) { cacheObjectMetaData(oid, size); URL objectUrl = getObjectUrl(oid); - Map headers = new HashMap(); + Map headers = new HashMap<>(); headers.put(X_AMZ_CONTENT_SHA256, oid.getName()); headers.put(HDR_CONTENT_LENGTH, Long.toString(size)); headers.put(X_AMZ_STORAGE_CLASS, s3Config.getStorageClass()); @@ -134,10 +134,10 @@ public Action getVerifyAction(AnyLongObjectId id) { @Override public long getSize(AnyLongObjectId oid) throws IOException { URL endpointUrl = getObjectUrl(oid); - Map queryParams = new HashMap(); + Map queryParams = new HashMap<>(); queryParams.put(X_AMZ_EXPIRES, Integer.toString(s3Config.getExpirationSeconds())); - Map headers = new HashMap(); + Map headers = new HashMap<>(); String authorizationQueryParameters = SignerV4.createAuthorizationQuery( s3Config, endpointUrl, METHOD_HEAD, headers, queryParams, diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/SignerV4.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/SignerV4.java index 4149484c8..a9b0ec46e 100644 --- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/SignerV4.java +++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/SignerV4.java @@ -240,7 +240,7 @@ private static void addHostHeader(URL url, private static String canonicalizeHeaderNames( Map headers) { - List sortedHeaders = new ArrayList(); + List sortedHeaders = new ArrayList<>(); sortedHeaders.addAll(headers.keySet()); Collections.sort(sortedHeaders, String.CASE_INSENSITIVE_ORDER); @@ -260,7 +260,7 @@ private static String canonicalizeHeaderString( return ""; //$NON-NLS-1$ } - List sortedHeaders = new ArrayList(); + List sortedHeaders = new ArrayList<>(); sortedHeaders.addAll(headers.keySet()); Collections.sort(sortedHeaders, String.CASE_INSENSITIVE_ORDER); @@ -305,7 +305,7 @@ private static String canonicalizeQueryString( return ""; //$NON-NLS-1$ } - SortedMap sorted = new TreeMap(); + SortedMap sorted = new TreeMap<>(); Iterator> pairs = parameters.entrySet() .iterator(); diff --git a/org.eclipse.jgit.lfs.test/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.lfs.test/.settings/org.eclipse.jdt.core.prefs index 47cca3692..64f74989e 100644 --- a/org.eclipse.jgit.lfs.test/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.jgit.lfs.test/.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.lfs/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.lfs/.settings/org.eclipse.jdt.core.prefs index 2db1c4f21..ede0f7d55 100644 --- a/org.eclipse.jgit.lfs/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.jgit.lfs/.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.pgm.test/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.pgm.test/.settings/org.eclipse.jdt.core.prefs index 47cca3692..64f74989e 100644 --- a/org.eclipse.jgit.pgm.test/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.jgit.pgm.test/.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.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java b/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java index 0bc2a3f8d..0eeababc5 100644 --- a/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java +++ b/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/lib/CLIRepositoryTestCase.java @@ -79,7 +79,7 @@ public void setUp() throws Exception { * @throws Exception */ protected String[] executeUnchecked(String... cmds) throws Exception { - List result = new ArrayList(cmds.length); + List result = new ArrayList<>(cmds.length); for (String cmd : cmds) { result.addAll(CLIGitCommand.executeUnchecked(cmd, db)); } @@ -97,7 +97,7 @@ protected String[] executeUnchecked(String... cmds) throws Exception { * @throws Exception */ protected String[] execute(String... cmds) throws Exception { - List result = new ArrayList(cmds.length); + List result = new ArrayList<>(cmds.length); for (String cmd : cmds) { Result r = CLIGitCommand.executeRaw(cmd, db); if (r.ex instanceof TerminatedByHelpException) { diff --git a/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/CLIGitCommand.java b/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/CLIGitCommand.java index 2d0c8974e..69eb1989d 100644 --- a/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/CLIGitCommand.java +++ b/org.eclipse.jgit.pgm.test/src/org/eclipse/jgit/pgm/CLIGitCommand.java @@ -189,7 +189,7 @@ void exit(int status, Exception t) throws Exception { * @return the array */ static String[] split(String commandLine) { - final List list = new ArrayList(); + final List list = new ArrayList<>(); boolean inquote = false; boolean inDblQuote = false; StringBuilder r = new StringBuilder(); diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ArchiveTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ArchiveTest.java index c0593a78f..18c49ea28 100644 --- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ArchiveTest.java +++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ArchiveTest.java @@ -529,7 +529,7 @@ public void testTarPreservesMode() throws Exception { @Test public void testArchiveWithLongFilename() throws Exception { StringBuilder filename = new StringBuilder(); - List l = new ArrayList(); + List l = new ArrayList<>(); for (int i = 0; i < 20; i++) { filename.append("1234567890/"); l.add(filename.toString()); @@ -549,7 +549,7 @@ public void testArchiveWithLongFilename() throws Exception { @Test public void testTarWithLongFilename() throws Exception { StringBuilder filename = new StringBuilder(); - List l = new ArrayList(); + List l = new ArrayList<>(); for (int i = 0; i < 20; i++) { filename.append("1234567890/"); l.add(filename.toString()); @@ -691,7 +691,7 @@ private void writeRaw(String filename, byte[] data) } private static String[] listZipEntries(byte[] zipData) throws IOException { - List l = new ArrayList(); + List l = new ArrayList<>(); ZipInputStream in = new ZipInputStream( new ByteArrayInputStream(zipData)); @@ -719,7 +719,7 @@ public Object call() throws IOException { } private String[] listTarEntries(byte[] tarData) throws Exception { - List l = new ArrayList(); + List l = new ArrayList<>(); Process proc = spawnAssumingCommandPresent("tar", "tf", "-"); BufferedReader reader = readFromProcess(proc); OutputStream out = proc.getOutputStream(); @@ -750,7 +750,7 @@ private static String[] zipEntryContent(byte[] zipData, String path) continue; // found! - List l = new ArrayList(); + List l = new ArrayList<>(); BufferedReader reader = new BufferedReader( new InputStreamReader(in, "UTF-8")); String line; @@ -765,7 +765,7 @@ private static String[] zipEntryContent(byte[] zipData, String path) private String[] tarEntryContent(byte[] tarData, String path) throws Exception { - List l = new ArrayList(); + List l = new ArrayList<>(); Process proc = spawnAssumingCommandPresent("tar", "Oxf", "-", path); BufferedReader reader = readFromProcess(proc); OutputStream out = proc.getOutputStream(); diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ConfigTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ConfigTest.java index 23aa97eee..c43accdb6 100644 --- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ConfigTest.java +++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/ConfigTest.java @@ -73,7 +73,7 @@ public void testListConfig() throws Exception { .equals("Mac OS X"); String[] output = execute("git config --list"); - List expect = new ArrayList(); + List expect = new ArrayList<>(); expect.add("core.filemode=" + !isWindows); expect.add("core.logallrefupdates=true"); if (isMac) diff --git a/org.eclipse.jgit.pgm/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.pgm/.settings/org.eclipse.jdt.core.prefs index 763144c86..06ddbabb4 100644 --- a/org.eclipse.jgit.pgm/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.jgit.pgm/.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.pgm/src/org/eclipse/jgit/pgm/Add.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Add.java index c36c48519..3c1359030 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Add.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Add.java @@ -58,7 +58,7 @@ class Add extends TextBuiltin { private boolean update = false; @Argument(required = true, metaVar = "metaVar_filepattern", usage = "usage_filesToAddContentFrom") - private List filepatterns = new ArrayList(); + private List filepatterns = new ArrayList<>(); @Override protected void run() throws Exception { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java index 0f541715a..419325405 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java @@ -114,7 +114,7 @@ void ignoreAllSpace(@SuppressWarnings("unused") boolean on) { private String rangeString; @Option(name = "--reverse", metaVar = "metaVar_blameReverse", usage = "usage_blameReverse") - private List reverseRange = new ArrayList(2); + private List reverseRange = new ArrayList<>(2); @Argument(index = 0, required = false, metaVar = "metaVar_revision") private String revision; @@ -124,7 +124,7 @@ void ignoreAllSpace(@SuppressWarnings("unused") boolean on) { private ObjectReader reader; - private final Map abbreviatedCommits = new HashMap(); + private final Map abbreviatedCommits = new HashMap<>(); private SimpleDateFormat dateFmt; @@ -163,7 +163,7 @@ protected void run() throws Exception { if (!reverseRange.isEmpty()) { RevCommit rangeStart = null; - List rangeEnd = new ArrayList(2); + List rangeEnd = new ArrayList<>(2); for (RevCommit c : reverseRange) { if (c.has(RevFlag.UNINTERESTING)) rangeStart = c; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java index 5f3740cbb..f6e3810a8 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Branch.java @@ -149,7 +149,7 @@ public void moveRename(List currentAndNew) { @Argument(metaVar = "metaVar_name") private String branch; - private final Map printRefs = new LinkedHashMap(); + private final Map printRefs = new LinkedHashMap<>(); /** Only set for verbose branch listing at-the-moment */ private RevWalk rw; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java index 0c3b720fb..c2f3c4675 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Checkout.java @@ -78,7 +78,7 @@ class Checkout extends TextBuiltin { private String name; @Option(name = "--", metaVar = "metaVar_paths", multiValued = true, handler = RestOfArgumentsHandler.class) - private List paths = new ArrayList(); + private List paths = new ArrayList<>(); @Override protected void run() throws Exception { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java index 99ba3b4b4..cf4c6e333 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java @@ -100,7 +100,7 @@ public static CommandRef[] all() { * @return all common commands, sorted by command name. */ public static CommandRef[] common() { - final ArrayList common = new ArrayList(); + final ArrayList common = new ArrayList<>(); for (final CommandRef c : INSTANCE.commands.values()) if (c.isCommon()) common.add(c); @@ -124,7 +124,7 @@ public int compare(final CommandRef o1, final CommandRef o2) { private CommandCatalog() { ldr = Thread.currentThread().getContextClassLoader(); - commands = new HashMap(); + commands = new HashMap<>(); final Enumeration catalogs = catalogs(); while (catalogs.hasMoreElements()) diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java index 2cfbd86fa..befc4ec27 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Commit.java @@ -75,7 +75,7 @@ class Commit extends TextBuiltin { private boolean amend; @Argument(metaVar = "metaVar_commitPaths", usage = "usage_CommitPaths") - private List paths = new ArrayList(); + private List paths = new ArrayList<>(); @Override protected void run() throws NoHeadException, NoMessageException, diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java index a7bdde9f6..1008593be 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java @@ -87,16 +87,16 @@ class Daemon extends TextBuiltin { int timeout = -1; @Option(name = "--enable", metaVar = "metaVar_service", usage = "usage_enableTheServiceInAllRepositories", multiValued = true) - final List enable = new ArrayList(); + final List enable = new ArrayList<>(); @Option(name = "--disable", metaVar = "metaVar_service", usage = "usage_disableTheServiceInAllRepositories", multiValued = true) - final List disable = new ArrayList(); + final List disable = new ArrayList<>(); @Option(name = "--allow-override", metaVar = "metaVar_service", usage = "usage_configureTheServiceInDaemonServicename", multiValued = true) - final List canOverride = new ArrayList(); + final List canOverride = new ArrayList<>(); @Option(name = "--forbid-override", metaVar = "metaVar_service", usage = "usage_configureTheServiceInDaemonServicename", multiValued = true) - final List forbidOverride = new ArrayList(); + final List forbidOverride = new ArrayList<>(); @Option(name = "--export-all", usage = "usage_exportWithoutGitDaemonExportOk") boolean exportAll; @@ -109,7 +109,7 @@ enum KetchServerType { } @Argument(required = true, metaVar = "metaVar_directory", usage = "usage_directoriesToExport") - final List directory = new ArrayList(); + final List directory = new ArrayList<>(); @Override protected boolean requiresRepository() { @@ -139,7 +139,7 @@ protected void run() throws Exception { if (1 < threads) packConfig.setExecutor(Executors.newFixedThreadPool(threads)); - final FileResolver resolver = new FileResolver(); + final FileResolver resolver = new FileResolver<>(); for (final File f : directory) { outw.println(MessageFormat.format(CLIText.get().exporting, f.getAbsolutePath())); resolver.exportDirectory(f); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java index 95c213243..56b62418c 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/DiffTree.java @@ -67,7 +67,7 @@ void tree_0(final AbstractTreeIterator c) { } @Argument(index = 1, metaVar = "metaVar_treeish", required = true) - private final List trees = new ArrayList(); + private final List trees = new ArrayList<>(); @Option(name = "--", metaVar = "metaVar_path", multiValued = true, handler = PathTreeFilterHandler.class) private TreeFilter pathFilter = TreeFilter.ALL; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java index 82c401ff8..1108ddd10 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Log.java @@ -94,7 +94,7 @@ class Log extends RevWalkTextBuiltin { @Option(name = "--no-standard-notes", usage = "usage_noShowStandardNotes") private boolean noStandardNotes; - private List additionalNoteRefs = new ArrayList(); + private List additionalNoteRefs = new ArrayList<>(); @Option(name = "--show-notes", usage = "usage_showNotes", metaVar = "metaVar_ref") void addAdditionalNoteRef(String notesRef) { @@ -204,7 +204,7 @@ protected void run() throws Exception { if (!noStandardNotes || !additionalNoteRefs.isEmpty()) { createWalk(); - noteMaps = new LinkedHashMap(); + noteMaps = new LinkedHashMap<>(); if (!noStandardNotes) { addNoteMap(Constants.R_NOTES_COMMITS); } diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java index f35d4fdba..7a5f3d811 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsRemote.java @@ -74,7 +74,7 @@ class LsRemote extends TextBuiltin { protected void run() throws Exception { LsRemoteCommand command = Git.lsRemoteRepository().setRemote(remote) .setTimeout(timeout).setHeads(heads).setTags(tags); - TreeSet refs = new TreeSet(new Comparator() { + TreeSet refs = new TreeSet<>(new Comparator() { @Override public int compare(Ref r1, Ref r2) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java index 872ea6777..02d61e53e 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/LsTree.java @@ -68,7 +68,7 @@ class LsTree extends TextBuiltin { @Argument(index = 1) @Option(name = "--", metaVar = "metaVar_paths", multiValued = true, handler = StopOptionHandler.class) - private List paths = new ArrayList(); + private List paths = new ArrayList<>(); @Override protected void run() throws Exception { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java index 7d111ffcc..3addecb2f 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java @@ -91,7 +91,7 @@ public class Main { private TextBuiltin subcommand; @Argument(index = 1, metaVar = "metaVar_arg") - private List arguments = new ArrayList(); + private List arguments = new ArrayList<>(); PrintWriter writer; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeBase.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeBase.java index 9dcd5129b..f8bae1d8b 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeBase.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeBase.java @@ -63,7 +63,7 @@ void commit_0(final RevCommit c) { } @Argument(index = 1, metaVar = "metaVar_commitish", required = true) - private final List commits = new ArrayList(); + private final List commits = new ArrayList<>(); @Override protected void run() throws Exception { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java index 98af186b2..1b805d16f 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java @@ -77,7 +77,7 @@ class Push extends TextBuiltin { private String remote = Constants.DEFAULT_REMOTE_NAME; @Argument(index = 1, metaVar = "metaVar_refspec") - private final List refSpecs = new ArrayList(); + private final List refSpecs = new ArrayList<>(); @Option(name = "--all") private boolean all; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java index 6833ad3c0..a66b7fa63 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevParse.java @@ -68,7 +68,7 @@ class RevParse extends TextBuiltin { boolean verify; @Argument(index = 0, metaVar = "metaVar_commitish") - private final List commits = new ArrayList(); + private final List commits = new ArrayList<>(); @Override protected void run() throws Exception { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java index 154358680..74135e4ba 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/RevWalkTextBuiltin.java @@ -124,12 +124,12 @@ void enableBoundary(final boolean on) { private String followPath; @Argument(index = 0, metaVar = "metaVar_commitish") - private final List commits = new ArrayList(); + private final List commits = new ArrayList<>(); @Option(name = "--", metaVar = "metaVar_path", multiValued = true, handler = PathTreeFilterHandler.class) protected TreeFilter pathFilter = TreeFilter.ALL; - private final List revLimiter = new ArrayList(); + private final List revLimiter = new ArrayList<>(); @Option(name = "--author") void addAuthorRevFilter(final String who) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java index f4f864b39..79c3f094e 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Rm.java @@ -58,7 +58,7 @@ class Rm extends TextBuiltin { @Argument(metaVar = "metaVar_path", usage = "usage_path", multiValued = true, required = true) @Option(name = "--", handler = StopOptionHandler.class) - private List paths = new ArrayList(); + private List paths = new ArrayList<>(); @Override diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java index 43b292e39..b7f5e5828 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Status.java @@ -117,7 +117,7 @@ private void printPorcelainStatus(org.eclipse.jgit.api.Status status) Map conflicting = status.getConflictingStageState(); // build a sorted list of all paths except untracked and ignored - TreeSet sorted = new TreeSet(); + TreeSet sorted = new TreeSet<>(); sorted.addAll(added); sorted.addAll(changed); sorted.addAll(removed); @@ -185,7 +185,7 @@ else if (missing.contains(path)) // untracked are always at the end of the list if ("all".equals(untrackedFilesMode)) { //$NON-NLS-1$ - TreeSet untracked = new TreeSet( + TreeSet untracked = new TreeSet<>( status.getUntracked()); for (String path : untracked) printPorcelainLine('?', '?', path); @@ -221,7 +221,7 @@ private void printLongStatus(org.eclipse.jgit.api.Status status) Collection untracked = status.getUntracked(); Map unmergedStates = status .getConflictingStageState(); - Collection toBeCommitted = new ArrayList(added); + Collection toBeCommitted = new ArrayList<>(added); toBeCommitted.addAll(changed); toBeCommitted.addAll(removed); int nbToBeCommitted = toBeCommitted.size(); @@ -232,7 +232,7 @@ private void printLongStatus(org.eclipse.jgit.api.Status status) toBeCommitted, added, changed, removed); firstHeader = false; } - Collection notStagedForCommit = new ArrayList(modified); + Collection notStagedForCommit = new ArrayList<>(modified); notStagedForCommit.addAll(missing); int nbNotStagedForCommit = notStagedForCommit.size(); if (nbNotStagedForCommit > 0) { @@ -274,7 +274,7 @@ protected void printSectionHeader(String pattern, Object... arguments) protected int printList(Collection list) throws IOException { if (!list.isEmpty()) { - List sortedList = new ArrayList(list); + List sortedList = new ArrayList<>(list); java.util.Collections.sort(sortedList); for (String filename : sortedList) { outw.println(CLIText.formatLine(String.format( @@ -291,7 +291,7 @@ protected int printList(String status1, String status2, String status3, Collection set2, @SuppressWarnings("unused") Collection set3) throws IOException { - List sortedList = new ArrayList(list); + List sortedList = new ArrayList<>(list); java.util.Collections.sort(sortedList); for (String filename : sortedList) { String prefix; @@ -311,7 +311,7 @@ else if (set2.contains(filename)) private void printUnmerged(Map unmergedStates) throws IOException { - List paths = new ArrayList(unmergedStates.keySet()); + List paths = new ArrayList<>(unmergedStates.keySet()); Collections.sort(paths); for (String path : paths) { StageState state = unmergedStates.get(path); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java index f8dd46187..44ec3f413 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java @@ -115,13 +115,13 @@ DiffAlgorithm create() { // @Option(name = "--algorithm", multiValued = true, metaVar = "NAME", usage = "Enable algorithm(s)") - List algorithms = new ArrayList(); + List algorithms = new ArrayList<>(); @Option(name = "--text-limit", metaVar = "LIMIT", usage = "Maximum size in KiB to scan per file revision") int textLimit = 15 * 1024; // 15 MiB as later we do * 1024. @Option(name = "--repository", aliases = { "-r" }, multiValued = true, metaVar = "GIT_DIR", usage = "Repository to scan") - List gitDirs = new ArrayList(); + List gitDirs = new ArrayList<>(); @Option(name = "--count", metaVar = "LIMIT", usage = "Number of file revisions to be compared") int count = 0; // unlimited @@ -324,7 +324,7 @@ private void testOne(Test test, RawText a, RawText b) { } private List init() { - List all = new ArrayList(); + List all = new ArrayList<>(); try { for (Field f : DiffAlgorithms.class.getDeclaredFields()) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java index 8cfcba911..da602d0b8 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java @@ -112,7 +112,7 @@ class RebuildCommitGraph extends TextBuiltin { private final ProgressMonitor pm = new TextProgressMonitor(errw); - private Map rewrites = new HashMap(); + private Map rewrites = new HashMap<>(); @Override protected void run() throws Exception { @@ -137,8 +137,8 @@ protected void run() throws Exception { } private void recreateCommitGraph() throws IOException { - final Map toRewrite = new HashMap(); - List queue = new ArrayList(); + final Map toRewrite = new HashMap<>(); + List queue = new ArrayList<>(); try (RevWalk rw = new RevWalk(db); final BufferedReader br = new BufferedReader( new InputStreamReader(new FileInputStream(graph), @@ -176,7 +176,7 @@ private void recreateCommitGraph() throws IOException { while (!queue.isEmpty()) { final ListIterator itr = queue .listIterator(queue.size()); - queue = new ArrayList(); + queue = new ArrayList<>(); REWRITE: while (itr.hasPrevious()) { final ToRewrite t = itr.previous(); final ObjectId[] newParents = new ObjectId[t.oldParents.length]; @@ -278,7 +278,7 @@ protected void writeFile(final String name, final byte[] content) } private Map computeNewRefs() throws IOException { - final Map refs = new HashMap(); + final Map refs = new HashMap<>(); try (RevWalk rw = new RevWalk(db); BufferedReader br = new BufferedReader( new InputStreamReader(new FileInputStream(refList), diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java index 28d92aeca..0eb4e05c5 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java @@ -251,16 +251,16 @@ public int fold(int hash, int bits) { // @Option(name = "--hash", multiValued = true, metaVar = "NAME", usage = "Enable hash function(s)") - List hashFunctions = new ArrayList(); + List hashFunctions = new ArrayList<>(); @Option(name = "--fold", multiValued = true, metaVar = "NAME", usage = "Enable fold function(s)") - List foldFunctions = new ArrayList(); + List foldFunctions = new ArrayList<>(); @Option(name = "--text-limit", metaVar = "LIMIT", usage = "Maximum size in KiB to scan") int textLimit = 15 * 1024; // 15 MiB as later we do * 1024. @Option(name = "--repository", aliases = { "-r" }, multiValued = true, metaVar = "GIT_DIR", usage = "Repository to scan") - List gitDirs = new ArrayList(); + List gitDirs = new ArrayList<>(); @Override protected boolean requiresRepository() { @@ -327,7 +327,7 @@ private void run(Repository repo) throws Exception { RawText txt = new RawText(raw); int[] lines = new int[txt.size()]; int cnt = 0; - HashSet u = new HashSet(); + HashSet u = new HashSet<>(); for (int i = 0; i < txt.size(); i++) { if (u.add(new Line(txt, i))) lines[cnt++] = i; @@ -386,8 +386,8 @@ private static void testOne(Function fun, RawText txt, int[] elements, } private List init() { - List hashes = new ArrayList(); - List folds = new ArrayList(); + List hashes = new ArrayList<>(); + List folds = new ArrayList<>(); try { for (Field f : TextHashFunctions.class.getDeclaredFields()) { @@ -410,7 +410,7 @@ private List init() { throw new RuntimeException("Cannot determine names", e); //$NON-NLS-1$ } - List all = new ArrayList(); + List all = new ArrayList<>(); for (Hash cmp : hashes) { if (include(cmp.name, hashFunctions)) { for (Fold f : folds) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java index b531ba65a..020b62580 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/CmdLineParser.java @@ -141,7 +141,7 @@ public CmdLineParser(final Object bean, Repository repo) { @Override public void parseArgument(final String... args) throws CmdLineException { - final ArrayList tmp = new ArrayList(args.length); + final ArrayList tmp = new ArrayList<>(args.length); for (int argi = 0; argi < args.length; argi++) { final String str = args[argi]; if (str.equals("--")) { //$NON-NLS-1$ diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/PathTreeFilterHandler.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/PathTreeFilterHandler.java index e46802344..b873c3dc2 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/PathTreeFilterHandler.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/PathTreeFilterHandler.java @@ -81,7 +81,7 @@ public PathTreeFilterHandler(final CmdLineParser parser, @Override public int parseArguments(final Parameters params) throws CmdLineException { - final List filters = new ArrayList(); + final List filters = new ArrayList<>(); for (int idx = 0;; idx++) { final String path; try { diff --git a/org.eclipse.jgit.test/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.test/.settings/org.eclipse.jdt.core.prefs index 47cca3692..64f74989e 100644 --- a/org.eclipse.jgit.test/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.jgit.test/.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.test/exttst/org/eclipse/jgit/patch/EGitPatchHistoryTest.java b/org.eclipse.jgit.test/exttst/org/eclipse/jgit/patch/EGitPatchHistoryTest.java index 76930f2b8..7c0ea44c3 100644 --- a/org.eclipse.jgit.test/exttst/org/eclipse/jgit/patch/EGitPatchHistoryTest.java +++ b/org.eclipse.jgit.test/exttst/org/eclipse/jgit/patch/EGitPatchHistoryTest.java @@ -89,7 +89,7 @@ static class PatchReader extends CommitReader { super(new String[] { "-p" }); stats = s; - offBy1 = new HashSet(); + offBy1 = new HashSet<>(); offBy1.add("9bda5ece6806cd797416eaa47c7b927cc6e9c3b2"); } @@ -158,7 +158,7 @@ private static void dump(final byte[] buf) { } static class NumStatReader extends CommitReader { - final HashMap> stats = new HashMap>(); + final HashMap> stats = new HashMap<>(); NumStatReader() throws IOException { super(new String[] { "--numstat" }); @@ -166,7 +166,7 @@ static class NumStatReader extends CommitReader { @Override void onCommit(String commitId, byte[] buf) { - final HashMap files = new HashMap(); + final HashMap files = new HashMap<>(); final MutableInteger ptr = new MutableInteger(); while (ptr.value < buf.length) { if (buf[ptr.value] == '\n') diff --git a/org.eclipse.jgit.test/src/org/eclipse/jgit/lib/Sets.java b/org.eclipse.jgit.test/src/org/eclipse/jgit/lib/Sets.java index 4454e1a39..5a01eae9b 100644 --- a/org.eclipse.jgit.test/src/org/eclipse/jgit/lib/Sets.java +++ b/org.eclipse.jgit.test/src/org/eclipse/jgit/lib/Sets.java @@ -49,7 +49,7 @@ public class Sets { @SafeVarargs public static Set of(T... elements) { - Set ret = new HashSet(); + Set ret = new HashSet<>(); for (T element : elements) ret.add(element); return ret; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ArchiveCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ArchiveCommandTest.java index 40545ce2a..edab96b97 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ArchiveCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ArchiveCommandTest.java @@ -192,7 +192,7 @@ public void archiveByDirectoryPath() throws GitAPIException, IOException { private class MockFormat implements ArchiveCommand.Format { - private Map entries = new HashMap(); + private Map entries = new HashMap<>(); private int size() { return entries.size(); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CleanCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CleanCommandTest.java index fd42ca5b3..85436db47 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CleanCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CleanCommandTest.java @@ -144,7 +144,7 @@ public void testCleanWithPaths() throws NoWorkTreeException, assertTrue(files.size() > 0); // run clean with setPaths - Set paths = new TreeSet(); + Set paths = new TreeSet<>(); paths.add("File3.txt"); Set cleanedFiles = git.clean().setPaths(paths).call(); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java index e7a84f2d1..ae0b8dd3c 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java @@ -88,7 +88,7 @@ public class CloneCommandTest extends RepositoryTestCase { @Override public void setUp() throws Exception { super.setUp(); - tr = new TestRepository(db); + tr = new TestRepository<>(db); git = new Git(db); // commit something diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LogCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LogCommandTest.java index 1310625a9..38178bfd0 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LogCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/LogCommandTest.java @@ -62,7 +62,7 @@ public class LogCommandTest extends RepositoryTestCase { @Test public void logAllCommits() throws Exception { - List commits = new ArrayList(); + List commits = new ArrayList<>(); Git git = Git.wrap(db); writeTrashFile("Test.txt", "Hello world"); @@ -94,7 +94,7 @@ public void logAllCommits() throws Exception { @Test public void logAllCommitsWithTag() throws Exception { - List commits = new ArrayList(); + List commits = new ArrayList<>(); Git git = Git.wrap(db); writeTrashFile("Test.txt", "Hello world"); @@ -123,7 +123,7 @@ public void logAllCommitsWithTag() throws Exception { } private List createCommits(Git git) throws Exception { - List commits = new ArrayList(); + List commits = new ArrayList<>(); writeTrashFile("Test.txt", "Hello world"); git.add().addFilepattern("Test.txt").call(); commits.add(git.commit().setMessage("commit#1").call()); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java index cb3dbf1bc..4b23349fa 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java @@ -1556,7 +1556,7 @@ public void testFastForwardOnlyNotPossible() throws Exception { @Test public void testRecursiveMergeWithConflict() throws Exception { - TestRepository db_t = new TestRepository(db); + TestRepository db_t = new TestRepository<>(db); BranchBuilder master = db_t.branch("master"); RevCommit m0 = master.commit().add("f", "1\n2\n3\n4\n5\n6\n7\n8\n9\n") .message("m0").create(); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/NameRevCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/NameRevCommandTest.java index bd62200fc..138b7afcd 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/NameRevCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/NameRevCommandTest.java @@ -64,7 +64,7 @@ public class NameRevCommandTest extends RepositoryTestCase { @Before public void setUp() throws Exception { super.setUp(); - tr = new TestRepository(db); + tr = new TestRepository<>(db); git = new Git(db); } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/TreeWalkAttributeTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/TreeWalkAttributeTest.java index b044c01db..1d9cd7814 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/TreeWalkAttributeTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/TreeWalkAttributeTest.java @@ -204,7 +204,7 @@ public void testCheckinCheckoutDifferences() throws IOException, @Test public void testIndexOnly() throws IOException, NoFilepatternException, GitAPIException { - List attrFiles = new ArrayList(); + List attrFiles = new ArrayList<>(); attrFiles.add(writeGlobalAttributeFile("globalAttributesFile", "*.txt -custom2")); attrFiles.add(writeAttributesFile(".git/info/attributes", @@ -813,7 +813,7 @@ private void assertEntry(FileMode type, String pathName, } private static Set asSet(Collection attributes) { - Set ret = new HashSet(); + Set ret = new HashSet<>(); for (Attribute a : attributes) { ret.add(a); } @@ -853,7 +853,7 @@ private File writeGlobalAttributeFile(String fileName, String... attributes) } static Set asSet(Attribute... attrs) { - HashSet result = new HashSet(); + HashSet result = new HashSet<>(); for (Attribute attr : attrs) result.add(attr); return result; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterTest.java index b4234dcba..fabf03440 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterTest.java @@ -89,7 +89,7 @@ public class DiffFormatterTest extends RepositoryTestCase { @Before public void setUp() throws Exception { super.setUp(); - testDb = new TestRepository(db); + testDb = new TestRepository<>(db); df = new DiffFormatter(DisabledOutputStream.INSTANCE); df.setRepository(db); df.setAbbreviationLength(8); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/RenameDetectorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/RenameDetectorTest.java index 4315be9e4..64eb1c9ba 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/RenameDetectorTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/RenameDetectorTest.java @@ -75,7 +75,7 @@ public class RenameDetectorTest extends RepositoryTestCase { @Before public void setUp() throws Exception { super.setUp(); - testDb = new TestRepository(db); + testDb = new TestRepository<>(db); rd = new RenameDetector(db); } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java index 3e780467b..92ce4e178 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java @@ -178,7 +178,7 @@ public void testReadIndex_DirCacheTree() throws Exception { .getObjectId()); assertEquals(cList.size(), jTree.getEntrySpan()); - final ArrayList subtrees = new ArrayList(); + final ArrayList subtrees = new ArrayList<>(); for (final CGitLsTreeRecord r : cTree.values()) { if (FileMode.TREE.equals(r.mode)) subtrees.add(r); @@ -233,7 +233,7 @@ private static File pathOf(final String name) { } private static Map readLsFiles() throws Exception { - final LinkedHashMap r = new LinkedHashMap(); + final LinkedHashMap r = new LinkedHashMap<>(); final BufferedReader br = new BufferedReader(new InputStreamReader( new FileInputStream(pathOf("gitgit.lsfiles")), "UTF-8")); try { @@ -249,7 +249,7 @@ private static Map readLsFiles() throws Exception { } private static Map readLsTree() throws Exception { - final LinkedHashMap r = new LinkedHashMap(); + final LinkedHashMap r = new LinkedHashMap<>(); final BufferedReader br = new BufferedReader(new InputStreamReader( new FileInputStream(pathOf("gitgit.lstree")), "UTF-8")); try { diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCachePathEditTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCachePathEditTest.java index c85e15635..20897a8ba 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCachePathEditTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCachePathEditTest.java @@ -72,7 +72,7 @@ public void apply(DirCacheEntry ent) { } private static final class RecordingEdit extends PathEdit { - final List entries = new ArrayList(); + final List entries = new ArrayList<>(); public RecordingEdit(String entryPath) { super(entryPath); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/ManifestParserTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/ManifestParserTest.java index b1138f04c..c97b31880 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/ManifestParserTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/ManifestParserTest.java @@ -57,7 +57,7 @@ public class ManifestParserTest { public void testManifestParser() throws Exception { String baseUrl = "https://git.google.com/"; StringBuilder xmlContent = new StringBuilder(); - Set results = new HashSet(); + Set results = new HashSet<>(); xmlContent.append("\n") .append("") .append("") diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsInserterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsInserterTest.java index b738f7ea7..e71ee6d25 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsInserterTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/dfs/DfsInserterTest.java @@ -206,7 +206,7 @@ public void testInserterIgnoresUnreachable() throws IOException { // Verify that we have a foo in both packs, and 1 of them is garbage. DfsReader reader = new DfsReader(db.getObjectDatabase()); DfsPackFile packs[] = db.getObjectDatabase().getPacks(); - Set pack_sources = new HashSet(); + Set pack_sources = new HashSet<>(); assertEquals(2, packs.length); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/AbbreviationTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/AbbreviationTest.java index 29da63f0b..343120ef5 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/AbbreviationTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/AbbreviationTest.java @@ -87,7 +87,7 @@ public void setUp() throws Exception { super.setUp(); db = createBareRepository(); reader = db.newObjectReader(); - test = new TestRepository(db); + test = new TestRepository<>(db); } @Override @@ -171,7 +171,7 @@ public void testAbbreviateIsActuallyUnique() throws Exception { ObjectId id = id("9d5b926ed164e8ee88d3b8b1e525d699adda01ba"); byte[] idBuf = toByteArray(id); - List objects = new ArrayList(); + List objects = new ArrayList<>(); for (int i = 0; i < 256; i++) { idBuf[9] = (byte) i; objects.add(new PackedObjectInfo(ObjectId.fromRaw(idBuf))); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileSnapshotTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileSnapshotTest.java index 98a950176..999866605 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileSnapshotTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/FileSnapshotTest.java @@ -57,7 +57,7 @@ public class FileSnapshotTest { - private List files = new ArrayList(); + private List files = new ArrayList<>(); private File trash; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcTestCase.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcTestCase.java index fc91bd038..d16998db5 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcTestCase.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcTestCase.java @@ -67,7 +67,7 @@ public abstract class GcTestCase extends LocalDiskRepositoryTestCase { public void setUp() throws Exception { super.setUp(); repo = createWorkRepository(); - tr = new TestRepository(repo, new RevWalk(repo), + tr = new TestRepository<>(repo, new RevWalk(repo), mockSystemReader); gc = new GC(repo); } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackFileTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackFileTest.java index 986bfe51d..91bd52397 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackFileTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackFileTest.java @@ -117,7 +117,7 @@ public void setUp() throws Exception { cfg.install(); repo = createBareRepository(); - tr = new TestRepository(repo); + tr = new TestRepository<>(repo); wc = (WindowCursor) repo.newObjectReader(); } @@ -291,7 +291,7 @@ public void testDelta_FailsOver2GiB() throws Exception { f = new FileOutputStream(idxName); try { - List list = new ArrayList(); + List list = new ArrayList<>(); list.add(a); list.add(b); Collections.sort(list); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java index 76df03876..c817dc3d7 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java @@ -469,7 +469,7 @@ public void testWritePack4SizeThinVsNoThin() throws Exception { public void testDeltaStatistics() throws Exception { config.setDeltaCompress(true); FileRepository repo = createBareRepository(); - TestRepository testRepo = new TestRepository(repo); + TestRepository testRepo = new TestRepository<>(repo); ArrayList blobs = new ArrayList<>(); blobs.add(testRepo.blob(genDeltableData(1000))); blobs.add(testRepo.blob(genDeltableData(1005))); @@ -538,7 +538,7 @@ public void testWriteIndex() throws Exception { public void testExclude() throws Exception { FileRepository repo = createBareRepository(); - TestRepository testRepo = new TestRepository( + TestRepository testRepo = new TestRepository<>( repo); BranchBuilder bb = testRepo.branch("refs/heads/master"); contentA = testRepo.blob("A"); @@ -663,7 +663,7 @@ public void testShallowFetchShallowAncestorDepth2() throws Exception { private FileRepository setupRepoForShallowFetch() throws Exception { FileRepository repo = createBareRepository(); - TestRepository r = new TestRepository(repo); + TestRepository r = new TestRepository<>(repo); BranchBuilder bb = r.branch("refs/heads/master"); contentA = r.blob("A"); contentB = r.blob("B"); @@ -731,7 +731,7 @@ private static PackIndex writePack(FileRepository repo, RevWalk walk, // TODO: testWritePackDeltasDepth() private void writeVerifyPack1() throws IOException { - final HashSet interestings = new HashSet(); + final HashSet interestings = new HashSet<>(); interestings.add(ObjectId .fromString("82c6b885ff600be425b4ea96dee75dca255b69e7")); createVerifyOpenPack(interestings, NONE, false, false); @@ -754,10 +754,10 @@ private void writeVerifyPack1() throws IOException { private void writeVerifyPack2(boolean deltaReuse) throws IOException { config.setReuseDeltas(deltaReuse); - final HashSet interestings = new HashSet(); + final HashSet interestings = new HashSet<>(); interestings.add(ObjectId .fromString("82c6b885ff600be425b4ea96dee75dca255b69e7")); - final HashSet uninterestings = new HashSet(); + final HashSet uninterestings = new HashSet<>(); uninterestings.add(ObjectId .fromString("540a36d136cf413e4b064c2b0e0a4db60f77feab")); createVerifyOpenPack(interestings, uninterestings, false, false); @@ -786,10 +786,10 @@ private static void swap(ObjectId[] arr, int a, int b) { } private void writeVerifyPack4(final boolean thin) throws IOException { - final HashSet interestings = new HashSet(); + final HashSet interestings = new HashSet<>(); interestings.add(ObjectId .fromString("82c6b885ff600be425b4ea96dee75dca255b69e7")); - final HashSet uninterestings = new HashSet(); + final HashSet uninterestings = new HashSet<>(); uninterestings.add(ObjectId .fromString("c59759f143fb1fe21c197981df75a7ee00290799")); createVerifyOpenPack(interestings, uninterestings, thin, false); @@ -878,7 +878,7 @@ private PackParser index(final byte[] packData) throws IOException { } private void verifyObjectsOrder(final ObjectId objectsOrder[]) { - final List entries = new ArrayList(); + final List entries = new ArrayList<>(); for (MutableEntry me : pack) { entries.add(me.cloneEntry()); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefDirectoryTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefDirectoryTest.java index b5df7a66c..53db123d3 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefDirectoryTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/RefDirectoryTest.java @@ -108,7 +108,7 @@ public void setUp() throws Exception { diskRepo = createBareRepository(); refdir = (RefDirectory) diskRepo.getRefDatabase(); - repo = new TestRepository(diskRepo); + repo = new TestRepository<>(diskRepo); A = repo.commit().create(); B = repo.commit(repo.getRevWalk().parseCommit(A)); v1_0 = repo.tag("v1_0", B); @@ -1023,7 +1023,7 @@ public void test_repack() throws Exception { assertEquals(v0_1.getId(), all.get("refs/tags/v0.1").getObjectId()); all = refdir.getRefs(RefDatabase.ALL); - refdir.pack(new ArrayList(all.keySet())); + refdir.pack(new ArrayList<>(all.keySet())); all = refdir.getRefs(RefDatabase.ALL); assertEquals(5, all.size()); @@ -1267,8 +1267,8 @@ public void testRefsChangedStackOverflow() throws Exception { final RefDatabase refDb = newRepo.getRefDatabase(); File packedRefs = new File(newRepo.getDirectory(), "packed-refs"); assertTrue(packedRefs.createNewFile()); - final AtomicReference error = new AtomicReference(); - final AtomicReference exception = new AtomicReference(); + final AtomicReference error = new AtomicReference<>(); + final AtomicReference exception = new AtomicReference<>(); final AtomicInteger changeCount = new AtomicInteger(); newRepo.getListenerList().addRefsChangedListener( new RefsChangedListener() { diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/WindowCacheGetTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/WindowCacheGetTest.java index aa061bafc..cc348388c 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/WindowCacheGetTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/WindowCacheGetTest.java @@ -73,7 +73,7 @@ public class WindowCacheGetTest extends SampleDataRepositoryTestCase { public void setUp() throws Exception { super.setUp(); - toLoad = new ArrayList(); + toLoad = new ArrayList<>(); final BufferedReader br = new BufferedReader(new InputStreamReader( new FileInputStream(JGitTestUtil .getTestResourceFile("all_packed_objects.txt")), diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/BranchTrackingStatusTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/BranchTrackingStatusTest.java index e261b9673..8e5641930 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/BranchTrackingStatusTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/BranchTrackingStatusTest.java @@ -60,7 +60,7 @@ public class BranchTrackingStatusTest extends RepositoryTestCase { @Override public void setUp() throws Exception { super.setUp(); - util = new TestRepository(db); + util = new TestRepository<>(db); StoredConfig config = util.getRepository().getConfig(); config.setString(ConfigConstants.CONFIG_BRANCH_SECTION, "master", ConfigConstants.CONFIG_KEY_REMOTE, "origin"); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java index aebbafeff..e9505f67d 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java @@ -139,7 +139,7 @@ public void test004_PutGetSimple() { @Test public void test005_PutGetStringList() { Config c = new Config(); - final LinkedList values = new LinkedList(); + final LinkedList values = new LinkedList<>(); values.add("value1"); values.add("value2"); c.setStringList("my", null, "somename", values); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java index 388456f94..75b574e92 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutTest.java @@ -130,7 +130,7 @@ private static HashMap mkmap(String... args) { if ((args.length % 2) > 0) throw new IllegalArgumentException("needs to be pairs"); - HashMap map = new HashMap(); + HashMap map = new HashMap<>(); for (int i = 0; i < args.length; i += 2) { map.put(args[i], args[i + 1]); } @@ -228,7 +228,7 @@ public void testResetHardFromIndexEntryWithoutFileToTreeWithoutFile() @Test public void testInitialCheckout() throws Exception { try (Git git = new Git(db)) { - TestRepository db_t = new TestRepository(db); + TestRepository db_t = new TestRepository<>(db); BranchBuilder master = db_t.branch("master"); master.commit().add("f", "1").message("m0").create(); assertFalse(new File(db.getWorkTree(), "f").exists()); @@ -377,7 +377,7 @@ public void testRules4thru13_IndexEntryNotInHead() throws IOException { // rules 4 and 5 HashMap idxMap; - idxMap = new HashMap(); + idxMap = new HashMap<>(); idxMap.put("foo", "foo"); setupCase(null, null, idxMap); go(); @@ -387,7 +387,7 @@ public void testRules4thru13_IndexEntryNotInHead() throws IOException { assertTrue(getConflicts().isEmpty()); // rules 6 and 7 - idxMap = new HashMap(); + idxMap = new HashMap<>(); idxMap.put("foo", "foo"); setupCase(null, idxMap, idxMap); go(); @@ -396,7 +396,7 @@ public void testRules4thru13_IndexEntryNotInHead() throws IOException { // rules 8 and 9 HashMap mergeMap; - mergeMap = new HashMap(); + mergeMap = new HashMap<>(); mergeMap.put("foo", "merge"); setupCase(null, mergeMap, idxMap); @@ -408,7 +408,7 @@ public void testRules4thru13_IndexEntryNotInHead() throws IOException { // rule 10 - HashMap headMap = new HashMap(); + HashMap headMap = new HashMap<>(); headMap.put("foo", "foo"); setupCase(headMap, null, idxMap); go(); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/IndexDiffTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/IndexDiffTest.java index 3c1ff9860..2cb8f86fc 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/IndexDiffTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/IndexDiffTest.java @@ -210,7 +210,7 @@ public void testConflicting() throws Exception { diff.diff(); assertEquals("[b]", - new TreeSet(diff.getChanged()).toString()); + new TreeSet<>(diff.getChanged()).toString()); assertEquals("[]", diff.getAdded().toString()); assertEquals("[]", diff.getRemoved().toString()); assertEquals("[]", diff.getMissing().toString()); @@ -251,7 +251,7 @@ public void testConflictingDeletedAndModified() throws Exception { IndexDiff diff = new IndexDiff(db, Constants.HEAD, iterator); diff.diff(); - assertEquals("[]", new TreeSet(diff.getChanged()).toString()); + assertEquals("[]", new TreeSet<>(diff.getChanged()).toString()); assertEquals("[]", diff.getAdded().toString()); assertEquals("[]", diff.getRemoved().toString()); assertEquals("[]", diff.getMissing().toString()); @@ -291,7 +291,7 @@ public void testConflictingFromMultipleCreations() throws Exception { IndexDiff diff = new IndexDiff(db, Constants.HEAD, iterator); diff.diff(); - assertEquals("[]", new TreeSet(diff.getChanged()).toString()); + assertEquals("[]", new TreeSet<>(diff.getChanged()).toString()); assertEquals("[]", diff.getAdded().toString()); assertEquals("[]", diff.getRemoved().toString()); assertEquals("[]", diff.getMissing().toString()); @@ -444,7 +444,7 @@ public void testUntrackedFolders() throws Exception { diff = new IndexDiff(db, Constants.HEAD, new FileTreeIterator(db)); diff.diff(); - assertEquals(new HashSet(Arrays.asList("target")), + assertEquals(new HashSet<>(Arrays.asList("target")), diff.getUntrackedFolders()); writeTrashFile("src/tst/A.java", ""); @@ -452,7 +452,7 @@ public void testUntrackedFolders() throws Exception { diff = new IndexDiff(db, Constants.HEAD, new FileTreeIterator(db)); diff.diff(); - assertEquals(new HashSet(Arrays.asList("target", "src/tst")), + assertEquals(new HashSet<>(Arrays.asList("target", "src/tst")), diff.getUntrackedFolders()); git.rm().addFilepattern("src/com/B.java").addFilepattern("src/org") @@ -463,7 +463,7 @@ public void testUntrackedFolders() throws Exception { diff = new IndexDiff(db, Constants.HEAD, new FileTreeIterator(db)); diff.diff(); assertEquals( - new HashSet(Arrays.asList("src/org", "src/tst", + new HashSet<>(Arrays.asList("src/org", "src/tst", "target")), diff.getUntrackedFolders()); } @@ -497,7 +497,7 @@ public void testUntrackedNotIgnoredFolders() throws Exception { diff = new IndexDiff(db, Constants.HEAD, new FileTreeIterator(db)); diff.diff(); - assertEquals(new HashSet(Arrays.asList("src")), + assertEquals(new HashSet<>(Arrays.asList("src")), diff.getUntrackedFolders()); git.add().addFilepattern("src").call(); @@ -510,7 +510,7 @@ public void testUntrackedNotIgnoredFolders() throws Exception { diff = new IndexDiff(db, Constants.HEAD, new FileTreeIterator(db)); diff.diff(); assertEquals( - new HashSet(Arrays.asList("srcs/com", "sr", "src/tst", + new HashSet<>(Arrays.asList("srcs/com", "sr", "src/tst", "target")), diff.getUntrackedFolders()); } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectIdOwnerMapTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectIdOwnerMapTest.java index a36a5e942..898fcb668 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectIdOwnerMapTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectIdOwnerMapTest.java @@ -73,7 +73,7 @@ public void init() { @Test public void testEmptyMap() { - ObjectIdOwnerMap m = new ObjectIdOwnerMap(); + ObjectIdOwnerMap m = new ObjectIdOwnerMap<>(); assertTrue(m.isEmpty()); assertEquals(0, m.size()); @@ -86,7 +86,7 @@ public void testEmptyMap() { @Test public void testAddGetAndContains() { - ObjectIdOwnerMap m = new ObjectIdOwnerMap(); + ObjectIdOwnerMap m = new ObjectIdOwnerMap<>(); m.add(id_1); m.add(id_2); m.add(id_3); @@ -108,7 +108,7 @@ public void testAddGetAndContains() { @Test public void testClear() { - ObjectIdOwnerMap m = new ObjectIdOwnerMap(); + ObjectIdOwnerMap m = new ObjectIdOwnerMap<>(); m.add(id_1); assertSame(id_1, m.get(id_1)); @@ -126,7 +126,7 @@ public void testClear() { @Test public void testAddIfAbsent() { - ObjectIdOwnerMap m = new ObjectIdOwnerMap(); + ObjectIdOwnerMap m = new ObjectIdOwnerMap<>(); m.add(id_1); assertSame(id_1, m.addIfAbsent(new SubId(id_1))); @@ -145,7 +145,7 @@ public void testAddIfAbsent() { @Test public void testAddGrowsWithObjects() { int n = 16384; - ObjectIdOwnerMap m = new ObjectIdOwnerMap(); + ObjectIdOwnerMap m = new ObjectIdOwnerMap<>(); m.add(id_1); for (int i = 32; i < n; i++) m.add(new SubId(id(i))); @@ -159,7 +159,7 @@ public void testAddGrowsWithObjects() { @Test public void testAddIfAbsentGrowsWithObjects() { int n = 16384; - ObjectIdOwnerMap m = new ObjectIdOwnerMap(); + ObjectIdOwnerMap m = new ObjectIdOwnerMap<>(); m.add(id_1); for (int i = 32; i < n; i++) m.addIfAbsent(new SubId(id(i))); @@ -172,7 +172,7 @@ public void testAddIfAbsentGrowsWithObjects() { @Test public void testIterator() { - ObjectIdOwnerMap m = new ObjectIdOwnerMap(); + ObjectIdOwnerMap m = new ObjectIdOwnerMap<>(); m.add(id_1); m.add(id_2); m.add(id_3); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectIdSubclassMapTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectIdSubclassMapTest.java index 07561deac..adb2b1260 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectIdSubclassMapTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ObjectIdSubclassMapTest.java @@ -73,7 +73,7 @@ public void init() { @Test public void testEmptyMap() { - ObjectIdSubclassMap m = new ObjectIdSubclassMap(); + ObjectIdSubclassMap m = new ObjectIdSubclassMap<>(); assertTrue(m.isEmpty()); assertEquals(0, m.size()); @@ -86,7 +86,7 @@ public void testEmptyMap() { @Test public void testAddGetAndContains() { - ObjectIdSubclassMap m = new ObjectIdSubclassMap(); + ObjectIdSubclassMap m = new ObjectIdSubclassMap<>(); m.add(id_1); m.add(id_2); m.add(id_3); @@ -108,7 +108,7 @@ public void testAddGetAndContains() { @Test public void testClear() { - ObjectIdSubclassMap m = new ObjectIdSubclassMap(); + ObjectIdSubclassMap m = new ObjectIdSubclassMap<>(); m.add(id_1); assertSame(id_1, m.get(id_1)); @@ -126,7 +126,7 @@ public void testClear() { @Test public void testAddIfAbsent() { - ObjectIdSubclassMap m = new ObjectIdSubclassMap(); + ObjectIdSubclassMap m = new ObjectIdSubclassMap<>(); m.add(id_1); assertSame(id_1, m.addIfAbsent(new SubId(id_1))); @@ -144,7 +144,7 @@ public void testAddIfAbsent() { @Test public void testAddGrowsWithObjects() { - ObjectIdSubclassMap m = new ObjectIdSubclassMap(); + ObjectIdSubclassMap m = new ObjectIdSubclassMap<>(); m.add(id_1); for (int i = 32; i < 8000; i++) m.add(new SubId(id(i))); @@ -157,7 +157,7 @@ public void testAddGrowsWithObjects() { @Test public void testAddIfAbsentGrowsWithObjects() { - ObjectIdSubclassMap m = new ObjectIdSubclassMap(); + ObjectIdSubclassMap m = new ObjectIdSubclassMap<>(); m.add(id_1); for (int i = 32; i < 8000; i++) m.addIfAbsent(new SubId(id(i))); @@ -170,7 +170,7 @@ public void testAddIfAbsentGrowsWithObjects() { @Test public void testIterator() { - ObjectIdSubclassMap m = new ObjectIdSubclassMap(); + ObjectIdSubclassMap m = new ObjectIdSubclassMap<>(); m.add(id_1); m.add(id_2); m.add(id_3); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java index aa46d1a2b..2da144c87 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RacyGitTests.java @@ -60,7 +60,7 @@ public class RacyGitTests extends RepositoryTestCase { public void testIterator() throws IllegalStateException, IOException, InterruptedException { - TreeSet modTimes = new TreeSet(); + TreeSet modTimes = new TreeSet<>(); File lastFile = null; for (int i = 0; i < 10; i++) { lastFile = new File(db.getWorkTree(), "0." + i); @@ -123,7 +123,7 @@ public void testIterator() throws IllegalStateException, IOException, public void testRacyGitDetection() throws IOException, IllegalStateException, InterruptedException { - TreeSet modTimes = new TreeSet(); + TreeSet modTimes = new TreeSet<>(); File lastFile; // wait to ensure that modtimes of the file doesn't match last index diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefDatabaseConflictingNamesTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefDatabaseConflictingNamesTest.java index c88eb3bd9..1c2119424 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefDatabaseConflictingNamesTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefDatabaseConflictingNamesTest.java @@ -63,7 +63,7 @@ public class RefDatabaseConflictingNamesTest { @Override public Map getRefs(String prefix) throws IOException { if (ALL.equals(prefix)) { - Map existing = new HashMap(); + Map existing = new HashMap<>(); existing.put("refs/heads/a/b", null /* not used */); existing.put("refs/heads/q", null /* not used */); return existing; @@ -141,8 +141,8 @@ private void assertNoConflictingNames(String proposed) throws IOException { private void assertConflictingNames(String proposed, String... conflicts) throws IOException { - Set expected = new HashSet(Arrays.asList(conflicts)); + Set expected = new HashSet<>(Arrays.asList(conflicts)); assertEquals(expected, - new HashSet(refDatabase.getConflictingNames(proposed))); + new HashSet<>(refDatabase.getConflictingNames(proposed))); } } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefTest.java index 707757b34..7fb330998 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RefTest.java @@ -99,7 +99,7 @@ public void testRemoteNames() throws Exception { "ab/c", "dummy", true); config.save(); assertEquals("[ab/c, origin]", - new TreeSet(db.getRemoteNames()).toString()); + new TreeSet<>(db.getRemoteNames()).toString()); // one-level deep remote branch assertEquals("master", diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/RecursiveMergerTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/RecursiveMergerTest.java index 0e7109c58..039a6e8cf 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/RecursiveMergerTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/RecursiveMergerTest.java @@ -110,7 +110,7 @@ public enum WorktreeState { @Before public void setUp() throws Exception { super.setUp(); - db_t = new TestRepository(db); + db_t = new TestRepository<>(db); } @Theory @@ -778,7 +778,7 @@ void modifyIndex(IndexState indexState, String path, String other) db.close(); file.delete(); db = new FileRepository(db.getDirectory()); - db_t = new TestRepository(db); + db_t = new TestRepository<>(db); break; } } @@ -846,7 +846,7 @@ void modifyWorktree(WorktreeState worktreeState, String path, String other) db.getConfig().setBoolean("core", null, "bare", true); db.getDirectory().renameTo(new File(workTreeFile, "test.git")); db = new FileRepository(new File(workTreeFile, "test.git")); - db_t = new TestRepository(db); + db_t = new TestRepository<>(db); } } finally { if (fos != null) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/notes/DefaultNoteMergerTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/notes/DefaultNoteMergerTest.java index d3a6f1838..a8d3904c8 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/notes/DefaultNoteMergerTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/notes/DefaultNoteMergerTest.java @@ -75,7 +75,7 @@ public class DefaultNoteMergerTest extends RepositoryTestCase { @Before public void setUp() throws Exception { super.setUp(); - tr = new TestRepository(db); + tr = new TestRepository<>(db); reader = db.newObjectReader(); inserter = db.newObjectInserter(); merger = new DefaultNoteMerger(); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/notes/NoteMapMergerTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/notes/NoteMapMergerTest.java index be7bead6b..117ea0c7d 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/notes/NoteMapMergerTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/notes/NoteMapMergerTest.java @@ -97,7 +97,7 @@ public class NoteMapMergerTest extends RepositoryTestCase { @Before public void setUp() throws Exception { super.setUp(); - tr = new TestRepository(db); + tr = new TestRepository<>(db); reader = db.newObjectReader(); inserter = db.newObjectInserter(); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/notes/NoteMapTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/notes/NoteMapTest.java index 325c9e2eb..a4a4909bc 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/notes/NoteMapTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/notes/NoteMapTest.java @@ -83,7 +83,7 @@ public class NoteMapTest extends RepositoryTestCase { public void setUp() throws Exception { super.setUp(); - tr = new TestRepository(db); + tr = new TestRepository<>(db); reader = db.newObjectReader(); inserter = db.newObjectInserter(); } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/AbstractPlotRendererTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/AbstractPlotRendererTest.java index d32172ae0..f26531533 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/AbstractPlotRendererTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/AbstractPlotRendererTest.java @@ -96,7 +96,7 @@ private PlotCommitList createCommitList(ObjectId start) throws IOException { TestPlotWalk walk = new TestPlotWalk(db); walk.markStart(walk.parseCommit(start)); - PlotCommitList commitList = new PlotCommitList(); + PlotCommitList commitList = new PlotCommitList<>(); commitList.source(walk); commitList.fillTo(1000); return commitList; @@ -116,7 +116,7 @@ public TestPlotWalk(Repository repo) { private static class TestPlotRenderer extends AbstractPlotRenderer { - List indentations = new LinkedList(); + List indentations = new LinkedList<>(); @Override protected int drawLabel(int x, int y, Ref ref) { diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/PlotCommitListTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/PlotCommitListTest.java index ecc119b29..9a6043f32 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/PlotCommitListTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/PlotCommitListTest.java @@ -123,7 +123,7 @@ public CommitListAssert noMoreCommits() { } private static Set asSet(int... numbers) { - Set result = new HashSet(); + Set result = new HashSet<>(); for (int n : numbers) result.add(Integer.valueOf(n)); return result; @@ -138,7 +138,7 @@ public void testLinear() throws Exception { PlotWalk pw = new PlotWalk(db); pw.markStart(pw.lookupCommit(c.getId())); - PlotCommitList pcl = new PlotCommitList(); + PlotCommitList pcl = new PlotCommitList<>(); pcl.source(pw); pcl.fillTo(Integer.MAX_VALUE); @@ -159,7 +159,7 @@ public void testMerged() throws Exception { PlotWalk pw = new PlotWalk(db); pw.markStart(pw.lookupCommit(d.getId())); - PlotCommitList pcl = new PlotCommitList(); + PlotCommitList pcl = new PlotCommitList<>(); pcl.source(pw); pcl.fillTo(Integer.MAX_VALUE); @@ -181,7 +181,7 @@ public void testSideBranch() throws Exception { pw.markStart(pw.lookupCommit(b.getId())); pw.markStart(pw.lookupCommit(c.getId())); - PlotCommitList pcl = new PlotCommitList(); + PlotCommitList pcl = new PlotCommitList<>(); pcl.source(pw); pcl.fillTo(Integer.MAX_VALUE); @@ -205,7 +205,7 @@ public void test2SideBranches() throws Exception { pw.markStart(pw.lookupCommit(c.getId())); pw.markStart(pw.lookupCommit(d.getId())); - PlotCommitList pcl = new PlotCommitList(); + PlotCommitList pcl = new PlotCommitList<>(); pcl.source(pw); pcl.fillTo(Integer.MAX_VALUE); @@ -240,7 +240,7 @@ public void testBug300282_1() throws Exception { // pw.markStart(pw.lookupCommit(f.getId())); pw.markStart(pw.lookupCommit(g.getId())); - PlotCommitList pcl = new PlotCommitList(); + PlotCommitList pcl = new PlotCommitList<>(); pcl.source(pw); pcl.fillTo(Integer.MAX_VALUE); @@ -274,7 +274,7 @@ public void testBug368927() throws Exception { pw.markStart(pw.lookupCommit(i.getId())); pw.markStart(pw.lookupCommit(g.getId())); - PlotCommitList pcl = new PlotCommitList(); + PlotCommitList pcl = new PlotCommitList<>(); pcl.source(pw); pcl.fillTo(Integer.MAX_VALUE); Set childPositions = asSet(0, 1); @@ -333,7 +333,7 @@ public void testEgitHistory() throws Exception { PlotWalk pw = new PlotWalk(db); pw.markStart(pw.lookupCommit(merge_fixed_logged_npe.getId())); - PlotCommitList pcl = new PlotCommitList(); + PlotCommitList pcl = new PlotCommitList<>(); pcl.source(pw); pcl.fillTo(Integer.MAX_VALUE); @@ -406,7 +406,7 @@ public void testDuplicateParents() throws Exception { PlotWalk pw = new PlotWalk(db); pw.markStart(pw.lookupCommit(m3)); pw.markStart(pw.lookupCommit(s2)); - PlotCommitList pcl = new PlotCommitList(); + PlotCommitList pcl = new PlotCommitList<>(); pcl.source(pw); pcl.fillTo(Integer.MAX_VALUE); @@ -471,7 +471,7 @@ public void testBug419359() throws Exception { pw.markStart(pw.lookupCommit(e.getId())); pw.markStart(pw.lookupCommit(a5.getId())); - PlotCommitList pcl = new PlotCommitList(); + PlotCommitList pcl = new PlotCommitList<>(); pcl.source(pw); pcl.fillTo(Integer.MAX_VALUE); @@ -520,7 +520,7 @@ public void testMultipleMerges() throws Exception { PlotWalk pw = new PlotWalk(db); pw.markStart(pw.lookupCommit(a4)); pw.markStart(pw.lookupCommit(b3)); - PlotCommitList pcl = new PlotCommitList(); + PlotCommitList pcl = new PlotCommitList<>(); pcl.source(pw); pcl.fillTo(Integer.MAX_VALUE); @@ -565,7 +565,7 @@ public void testMergeBlockedBySelf() throws Exception { PlotWalk pw = new PlotWalk(db); pw.markStart(pw.lookupCommit(a4)); pw.markStart(pw.lookupCommit(b3)); - PlotCommitList pcl = new PlotCommitList(); + PlotCommitList pcl = new PlotCommitList<>(); pcl.source(pw); pcl.fillTo(Integer.MAX_VALUE); @@ -615,7 +615,7 @@ public void testMergeBlockedByOther() throws Exception { pw.markStart(pw.lookupCommit(a4)); pw.markStart(pw.lookupCommit(b2)); pw.markStart(pw.lookupCommit(c)); - PlotCommitList pcl = new PlotCommitList(); + PlotCommitList pcl = new PlotCommitList<>(); pcl.source(pw); pcl.fillTo(Integer.MAX_VALUE); @@ -654,7 +654,7 @@ public void testDanglingCommitShouldContinueLane() throws Exception { PlotWalk pw = new PlotWalk(db); pw.markStart(pw.lookupCommit(a3)); pw.markStart(pw.lookupCommit(b1)); - PlotCommitList pcl = new PlotCommitList(); + PlotCommitList pcl = new PlotCommitList<>(); pcl.source(pw); pcl.fillTo(2); // don't process a1 @@ -677,7 +677,7 @@ public void testTwoRoots1() throws Exception { PlotWalk pw = new PlotWalk(db); pw.markStart(pw.lookupCommit(a)); pw.markStart(pw.lookupCommit(b)); - PlotCommitList pcl = new PlotCommitList(); + PlotCommitList pcl = new PlotCommitList<>(); pcl.source(pw); pcl.fillTo(Integer.MAX_VALUE); @@ -696,7 +696,7 @@ public void testTwoRoots2() throws Exception { PlotWalk pw = new PlotWalk(db); pw.markStart(pw.lookupCommit(a)); pw.markStart(pw.lookupCommit(b2)); - PlotCommitList pcl = new PlotCommitList(); + PlotCommitList pcl = new PlotCommitList<>(); pcl.source(pw); pcl.fillTo(Integer.MAX_VALUE); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/FIFORevQueueTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/FIFORevQueueTest.java index a4252ee11..a280045d4 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/FIFORevQueueTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/FIFORevQueueTest.java @@ -72,7 +72,7 @@ public void testCloneEmpty() throws Exception { @Test public void testAddLargeBlocks() throws Exception { - final ArrayList lst = new ArrayList(); + final ArrayList lst = new ArrayList<>(); for (int i = 0; i < 3 * BlockRevQueue.Block.BLOCK_SIZE; i++) { final RevCommit c = commit(); lst.add(c); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/LIFORevQueueTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/LIFORevQueueTest.java index eaf0f8ad5..ed8bc70d9 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/LIFORevQueueTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/LIFORevQueueTest.java @@ -73,7 +73,7 @@ public void testCloneEmpty() throws Exception { @Test public void testAddLargeBlocks() throws Exception { - final ArrayList lst = new ArrayList(); + final ArrayList lst = new ArrayList<>(); for (int i = 0; i < 3 * BlockRevQueue.Block.BLOCK_SIZE; i++) { final RevCommit c = commit(); lst.add(c); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitListTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitListTest.java index 4d75322f4..c069ba841 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitListTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevCommitListTest.java @@ -62,7 +62,7 @@ public void setup(int count) throws Exception { for (int i = 0; i < count; i++) git.commit().setCommitter(committer).setAuthor(author) .setMessage("commit " + i).call(); - list = new RevCommitList(); + list = new RevCommitList<>(); w.markStart(w.lookupCommit(db.resolve(Constants.HEAD))); list.source(w); } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkFollowFilterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkFollowFilterTest.java index 05e552e41..186018549 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkFollowFilterTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkFollowFilterTest.java @@ -58,7 +58,7 @@ public class RevWalkFollowFilterTest extends RevWalkTestCase { private static class DiffCollector extends RenameCallback { - List diffs = new ArrayList(); + List diffs = new ArrayList<>(); @Override public void renamed(DiffEntry diff) { diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkPathFilter6012Test.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkPathFilter6012Test.java index 2ff08dd71..631e3956f 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkPathFilter6012Test.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkPathFilter6012Test.java @@ -95,7 +95,7 @@ public void setUp() throws Exception { h = commit(f.getTree(), g, f); i = commit(tree(file(pA, zS), file(pE, zY), file(pF, zF)), h); - byName = new HashMap(); + byName = new HashMap<>(); for (Field z : RevWalkPathFilter6012Test.class.getDeclaredFields()) { if (z.getType() == RevCommit.class) byName.put((RevCommit) z.get(this), z.getName()); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkTestCase.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkTestCase.java index 30586ee1e..f12cc0872 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkTestCase.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkTestCase.java @@ -62,7 +62,7 @@ public abstract class RevWalkTestCase extends RepositoryTestCase { @Override public void setUp() throws Exception { super.setUp(); - util = new TestRepository(db, createRevWalk()); + util = new TestRepository<>(db, createRevWalk()); rw = util.getRevWalk(); } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java index 2b032e13c..8998a8546 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/submodule/SubmoduleWalkTest.java @@ -91,7 +91,7 @@ public class SubmoduleWalkTest extends RepositoryTestCase { @Before public void setUp() throws Exception { super.setUp(); - testDb = new TestRepository(db); + testDb = new TestRepository<>(db); } @Test diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/HttpAuthTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/HttpAuthTest.java index 3dc022d38..ea15ebe7d 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/HttpAuthTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/HttpAuthTest.java @@ -113,7 +113,7 @@ private static String getAuthMethodName(HttpAuthMethod authMethod) { } private static class AuthHeadersResponse extends JDKHttpConnection { - Map> headerFields = new HashMap>(); + Map> headerFields = new HashMap<>(); public AuthHeadersResponse(String[] authHeaders) throws MalformedURLException, IOException { diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/LongMapTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/LongMapTest.java index 3e427e5df..1a86aaff3 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/LongMapTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/LongMapTest.java @@ -57,7 +57,7 @@ public class LongMapTest { @Before public void setUp() throws Exception { - map = new LongMap(); + map = new LongMap<>(); } @Test diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PackParserTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PackParserTest.java index c829be900..b2497b879 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PackParserTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PackParserTest.java @@ -169,7 +169,7 @@ public void testTinyThinPack() throws Exception { @Test public void testPackWithDuplicateBlob() throws Exception { final byte[] data = Constants.encode("0123456789abcdefg"); - TestRepository d = new TestRepository(db); + TestRepository d = new TestRepository<>(db); assertTrue(db.hasObject(d.blob(data))); TemporaryBuffer.Heap pack = new TemporaryBuffer.Heap(1024); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushProcessTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushProcessTest.java index bd3faf4ef..104a69c9f 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushProcessTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushProcessTest.java @@ -83,8 +83,8 @@ public class PushProcessTest extends SampleDataRepositoryTestCase { public void setUp() throws Exception { super.setUp(); transport = new MockTransport(db, new URIish()); - refUpdates = new HashSet(); - advertisedRefs = new HashSet(); + refUpdates = new HashSet<>(); + advertisedRefs = new HashSet<>(); connectionUpdateStatus = Status.OK; } @@ -421,7 +421,7 @@ public void close() { private class MockPushConnection extends BaseConnection implements PushConnection { MockPushConnection() { - final Map refsMap = new HashMap(); + final Map refsMap = new HashMap<>(); for (final Ref r : advertisedRefs) refsMap.put(r.getName(), r); available(refsMap); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java index 0fa266a65..341112288 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java @@ -108,7 +108,7 @@ public void setUp() throws Exception { // Fill dst with a some common history. // - TestRepository d = new TestRepository(dst); + TestRepository d = new TestRepository<>(dst); a = d.blob("a"); A = d.commit(d.tree(d.file("a", a))); B = d.commit().parent(A).create(); @@ -183,7 +183,7 @@ public void testSuccess() throws Exception { // Now use b but in a different commit than what is hidden. // - TestRepository s = new TestRepository(src); + TestRepository s = new TestRepository<>(src); RevCommit N = s.commit().parent(B).add("q", b).create(); s.update(R_MASTER, N); @@ -274,7 +274,7 @@ private static void receive(final ReceivePack rp, @Test public void testUsingHiddenDeltaBaseFails() throws Exception { byte[] delta = { 0x1, 0x1, 0x1, 'c' }; - TestRepository s = new TestRepository(src); + TestRepository s = new TestRepository<>(src); RevCommit N = s.commit().parent(B).add("q", s.blob(BinaryDelta.apply(dst.open(b).getCachedBytes(), delta))) .create(); @@ -327,7 +327,7 @@ public void testUsingHiddenDeltaBaseFails() throws Exception { public void testUsingHiddenCommonBlobFails() throws Exception { // Try to use the 'b' blob that is hidden. // - TestRepository s = new TestRepository(src); + TestRepository s = new TestRepository<>(src); RevCommit N = s.commit().parent(B).add("q", s.blob("b")).create(); // But don't include it in the pack. @@ -377,7 +377,7 @@ public void testUsingHiddenCommonBlobFails() throws Exception { public void testUsingUnknownBlobFails() throws Exception { // Try to use the 'n' blob that is not on the server. // - TestRepository s = new TestRepository(src); + TestRepository s = new TestRepository<>(src); RevBlob n = s.blob("n"); RevCommit N = s.commit().parent(B).add("q", n).create(); @@ -426,7 +426,7 @@ public void testUsingUnknownBlobFails() throws Exception { @Test public void testUsingUnknownTreeFails() throws Exception { - TestRepository s = new TestRepository(src); + TestRepository s = new TestRepository<>(src); RevCommit N = s.commit().parent(B).add("q", s.blob("a")).create(); RevTree t = s.parseBody(N).getTree(); @@ -548,7 +548,7 @@ private static PacketLineIn asPacketLineIn(TemporaryBuffer.Heap buf) private static final class HidePrivateHook extends AbstractAdvertiseRefsHook { @Override public Map getAdvertisedRefs(Repository r, RevWalk revWalk) { - Map refs = new HashMap(r.getAllRefs()); + Map refs = new HashMap<>(r.getAllRefs()); assertNotNull(refs.remove(R_PRIVATE)); return refs; } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TestProtocolTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TestProtocolTest.java index 31b64187c..b926e482f 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TestProtocolTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/TestProtocolTest.java @@ -98,10 +98,10 @@ public ReceivePack create(User req, Repository db) { @Before public void setUp() throws Exception { - protos = new ArrayList(); - local = new TestRepository( + protos = new ArrayList<>(); + local = new TestRepository<>( new InMemoryRepository(new DfsRepositoryDescription("local"))); - remote = new TestRepository( + remote = new TestRepository<>( new InMemoryRepository(new DfsRepositoryDescription("remote"))); } @@ -240,7 +240,7 @@ private TestProtocol registerDefault() { private TestProtocol registerProto(UploadPackFactory upf, ReceivePackFactory rpf) { - TestProtocol proto = new TestProtocol(upf, rpf); + TestProtocol proto = new TestProtocol<>(upf, rpf); protos.add(proto); Transport.register(proto); return proto; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java index a60bb39ce..def9d93a8 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/WalkEncryptionTest.java @@ -460,14 +460,14 @@ static String securityProviderName(String algorithm) throws Exception { static List cryptoCipherList(String regex) { Set source = Security.getAlgorithms("Cipher"); - Set target = new TreeSet(); + Set target = new TreeSet<>(); for (String algo : source) { algo = algo.toUpperCase(Locale.ROOT); if (algo.matches(regex)) { target.add(algo); } } - return new ArrayList(target); + return new ArrayList<>(target); } /** @@ -599,7 +599,7 @@ static void reportPolicy() { } static List product(List one, List two) { - List result = new ArrayList(); + List result = new ArrayList<>(); for (String s1 : one) { for (String s2 : two) { result.add(new Object[] { s1, s2 }); @@ -1241,10 +1241,10 @@ public static class TestablePBE extends Base { @Parameters(name = "Profile: {0} Version: {1}") public static Collection argsList() { - List algorithmList = new ArrayList(); + List algorithmList = new ArrayList<>(); algorithmList.addAll(cryptoCipherListPBE()); - List versionList = new ArrayList(); + List versionList = new ArrayList<>(); versionList.add("0"); versionList.add("1"); @@ -1284,10 +1284,10 @@ public static class TestableTransformation extends Base { @Parameters(name = "Profile: {0} Version: {1}") public static Collection argsList() { - List algorithmList = new ArrayList(); + List algorithmList = new ArrayList<>(); algorithmList.addAll(cryptoCipherListTrans()); - List versionList = new ArrayList(); + List versionList = new ArrayList<>(); versionList.add("1"); return product(algorithmList, versionList); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/PathSuffixFilterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/PathSuffixFilterTest.java index 3885c4168..38adda312 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/PathSuffixFilterTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/PathSuffixFilterTest.java @@ -118,7 +118,7 @@ private List getMatchingPaths(String suffixFilter, tw.setRecursive(recursiveWalk); tw.addTree(treeId); - List paths = new ArrayList(); + List paths = new ArrayList<>(); while (tw.next()) paths.add(tw.getPathString()); return paths; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/BlockListTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/BlockListTest.java index 8b042bd67..0a3de85f7 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/BlockListTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/BlockListTest.java @@ -57,22 +57,22 @@ public class BlockListTest { public void testEmptyList() { BlockList empty; - empty = new BlockList(); + empty = new BlockList<>(); assertEquals(0, empty.size()); assertTrue(empty.isEmpty()); assertFalse(empty.iterator().hasNext()); - empty = new BlockList(0); + empty = new BlockList<>(0); assertEquals(0, empty.size()); assertTrue(empty.isEmpty()); assertFalse(empty.iterator().hasNext()); - empty = new BlockList(1); + empty = new BlockList<>(1); assertEquals(0, empty.size()); assertTrue(empty.isEmpty()); assertFalse(empty.iterator().hasNext()); - empty = new BlockList(64); + empty = new BlockList<>(64); assertEquals(0, empty.size()); assertTrue(empty.isEmpty()); assertFalse(empty.iterator().hasNext()); @@ -80,7 +80,7 @@ public void testEmptyList() { @Test public void testGet() { - BlockList list = new BlockList(4); + BlockList list = new BlockList<>(4); try { list.get(-1); @@ -121,7 +121,7 @@ public void testGet() { @Test public void testSet() { - BlockList list = new BlockList(4); + BlockList list = new BlockList<>(4); try { list.set(-1, "foo"); @@ -168,7 +168,7 @@ public void testSet() { @Test public void testAddToEnd() { - BlockList list = new BlockList(4); + BlockList list = new BlockList<>(4); int cnt = BlockList.BLOCK_SIZE * 3; for (int i = 0; i < cnt; i++) @@ -192,7 +192,7 @@ public void testAddToEnd() { @Test public void testAddSlowPath() { - BlockList list = new BlockList(4); + BlockList list = new BlockList<>(4); String fooStr = "foo"; String barStr = "bar"; @@ -223,7 +223,7 @@ public void testAddSlowPath() { @Test public void testRemoveFromEnd() { - BlockList list = new BlockList(4); + BlockList list = new BlockList<>(4); String fooStr = "foo"; String barStr = "bar"; @@ -245,7 +245,7 @@ public void testRemoveFromEnd() { @Test public void testRemoveSlowPath() { - BlockList list = new BlockList(4); + BlockList list = new BlockList<>(4); String fooStr = "foo"; String barStr = "bar"; @@ -270,7 +270,7 @@ public void testRemoveSlowPath() { @Test public void testAddRemoveAdd() { - BlockList list = new BlockList(); + BlockList list = new BlockList<>(); for (int i = 0; i < BlockList.BLOCK_SIZE + 1; i++) list.add(Integer.valueOf(i)); assertEquals(Integer.valueOf(BlockList.BLOCK_SIZE), @@ -283,14 +283,14 @@ public void testAddRemoveAdd() { @Test public void testAddAllFromOtherList() { - BlockList src = new BlockList(4); + BlockList src = new BlockList<>(4); int cnt = BlockList.BLOCK_SIZE * 2; for (int i = 0; i < cnt; i++) src.add(Integer.valueOf(42 + i)); src.add(Integer.valueOf(1)); - BlockList dst = new BlockList(4); + BlockList dst = new BlockList<>(4); dst.add(Integer.valueOf(255)); dst.addAll(src); assertEquals(cnt + 2, dst.size()); @@ -301,7 +301,7 @@ public void testAddAllFromOtherList() { @Test public void testFastIterator() { - BlockList list = new BlockList(4); + BlockList list = new BlockList<>(4); int cnt = BlockList.BLOCK_SIZE * 3; for (int i = 0; i < cnt; i++) @@ -318,7 +318,7 @@ public void testFastIterator() { @Test public void testAddRejectsBadIndexes() { - BlockList list = new BlockList(4); + BlockList list = new BlockList<>(4); list.add(Integer.valueOf(41)); try { @@ -336,7 +336,7 @@ public void testAddRejectsBadIndexes() { @Test public void testRemoveRejectsBadIndexes() { - BlockList list = new BlockList(4); + BlockList list = new BlockList<>(4); list.add(Integer.valueOf(41)); try { diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/ReadLinesTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/ReadLinesTest.java index 1fe3dbd32..796af991c 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/ReadLinesTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/ReadLinesTest.java @@ -51,7 +51,7 @@ import org.junit.Test; public class ReadLinesTest { - List l = new ArrayList(); + List l = new ArrayList<>(); @Before public void clearList() { diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RefListTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RefListTest.java index 4b7ab26f4..5a1468a8b 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RefListTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RefListTest.java @@ -89,7 +89,7 @@ public void testEmpty() { @Test public void testEmptyBuilder() { - RefList list = new RefList.Builder().toRefList(); + RefList list = new RefList.Builder<>().toRefList(); assertEquals(0, list.size()); assertFalse(list.iterator().hasNext()); assertEquals(-1, list.find("a")); @@ -111,7 +111,7 @@ public void testEmptyBuilder() { @Test public void testBuilder_AddThenSort() { - RefList.Builder builder = new RefList.Builder(1); + RefList.Builder builder = new RefList.Builder<>(1); builder.add(REF_B); builder.add(REF_A); @@ -129,7 +129,7 @@ public void testBuilder_AddThenSort() { @Test public void testBuilder_AddAll() { - RefList.Builder builder = new RefList.Builder(1); + RefList.Builder builder = new RefList.Builder<>(1); Ref[] src = { REF_A, REF_B, REF_c, REF_A }; builder.addAll(src, 1, 2); @@ -141,7 +141,7 @@ public void testBuilder_AddAll() { @Test public void testBuilder_Set() { - RefList.Builder builder = new RefList.Builder(); + RefList.Builder builder = new RefList.Builder<>(); builder.add(REF_A); builder.add(REF_A); @@ -163,7 +163,7 @@ public void testBuilder_Set() { @Test public void testBuilder_Remove() { - RefList.Builder builder = new RefList.Builder(); + RefList.Builder builder = new RefList.Builder<>(); builder.add(REF_A); builder.add(REF_B); builder.remove(0); @@ -364,7 +364,7 @@ public void testBuilder_ToString() { exp.append(REF_B); exp.append("]"); - RefList.Builder list = new RefList.Builder(); + RefList.Builder list = new RefList.Builder<>(); list.add(REF_A); list.add(REF_B); assertEquals(exp.toString(), list.toString()); @@ -442,16 +442,16 @@ public void testCopyLeadingPrefix() { @Test public void testCopyConstructorReusesArray() { - RefList.Builder one = new RefList.Builder(); + RefList.Builder one = new RefList.Builder<>(); one.add(REF_A); - RefList two = new RefList(one.toRefList()); + RefList two = new RefList<>(one.toRefList()); one.set(0, REF_B); assertSame(REF_B, two.get(0)); } private static RefList toList(Ref... refs) { - RefList.Builder b = new RefList.Builder(refs.length); + RefList.Builder b = new RefList.Builder<>(refs.length); b.addAll(refs, 0, refs.length); return b.toRefList(); } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RefMapTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RefMapTest.java index 78ab27a85..e6402a46d 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RefMapTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RefMapTest.java @@ -481,7 +481,7 @@ public void testEntryTypeSet() { } private static RefList toList(Ref... refs) { - RefList.Builder b = new RefList.Builder(refs.length); + RefList.Builder b = new RefList.Builder<>(refs.length); b.addAll(refs, 0, refs.length); return b.toRefList(); } diff --git a/org.eclipse.jgit.ui/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.ui/.settings/org.eclipse.jdt.core.prefs index 2db1c4f21..ede0f7d55 100644 --- a/org.eclipse.jgit.ui/.settings/org.eclipse.jdt.core.prefs +++ b/org.eclipse.jgit.ui/.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.ui/src/org/eclipse/jgit/awtui/SwingCommitList.java b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/SwingCommitList.java index 7359093a1..fe0c486ae 100644 --- a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/SwingCommitList.java +++ b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/SwingCommitList.java @@ -53,7 +53,7 @@ class SwingCommitList extends PlotCommitList { final LinkedList colors; SwingCommitList() { - colors = new LinkedList(); + colors = new LinkedList<>(); repackColors(); } diff --git a/org.eclipse.jgit/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit/.settings/org.eclipse.jdt.core.prefs index 763144c86..06ddbabb4 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 0ef47a415..1ed79449e 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 45311f7f9..ba5673d97 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 @@ private File getFile(String path, boolean create) 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 @@ private void apply(File f, FileHeader fh) 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 558ef0f8a..2ef6650e9 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 @@ */ 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 6c7dca5c2..0d18eb3d0 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 FormatEntry(Format format, int refcnt) { * 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 @@ private static Format lookupFormat(String formatName) throws UnsupportedForma 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 ce73d0e6b..b1c81ff15 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 BlameCommand reverse(AnyObjectId start, AnyObjectId end) 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 bb94e5494..21d62837e 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 @@ private Stage(int number) { */ protected CheckoutCommand(Repository repo) { super(repo); - this.paths = new LinkedList(); + this.paths = new LinkedList<>(); } /** @@ -320,10 +320,10 @@ else if (orphan) { 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 92a67f46a..2186eb4b5 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 enum Status { 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 enum Status { 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 d3af7a619..eed7b2a25 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 @@ 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 CherryPickResult call() throws GitAPIException, NoMessageException, 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 153513aa0..c58efb147 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 @@ protected CleanCommand(Repository repo) { */ @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 @@ private Set cleanPath(String path, Set inFiles) 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 @@ private Set filterIgnorePaths(Set inputPaths, 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 baa6d7fce..4b815b439 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 @@ private List calculateRefSpecs(final String dst) { 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 f3bc91aed..274ece6dc 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 dcfad6a44..d7e7e5c29 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 @@ * >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 @@ protected DeleteBranchCommand(Repository repo) { 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 0d312dd40..77e353999 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 @@ */ public class DeleteTagCommand extends GitCommand> { - private final Set tags = new HashSet(); + private final Set tags = new HashSet<>(); /** * @param repo @@ -83,7 +83,7 @@ protected DeleteTagCommand(Repository repo) { @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 a119fcc84..389c511e1 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 String call() throws GitAPIException { 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 @@ String describe(ObjectId tip) throws IOException { } } - 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 1f4dcdd3e..a9dca4d7b 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 438ec89ff..961eeaadd 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 List call() throws GitAPIException { 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 List call() throws GitAPIException { 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 cdb32ca2f..476c10bdb 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 @@ protected ListNotesCommand(Repository repo) { @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 6d46cdf9a..d649a53db 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 @@ protected ListTagCommand(Repository repo) { 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 47b259981..f8fe95a88 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 9ad71250e..5157a411f 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 @@ private Map execute() throws GitAPIException, : 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 de7b604cf..b5d9e8a6b 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 aa8075d16..c487ef650 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 void setConflicts(Map conflicts) { */ 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 void addConflict(String path, org.eclipse.jgit.merge.MergeResult lowLe 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 fd28d0ec4..2a86fabed 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 String toString() { 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 NameRevCommit createCommit(AnyObjectId id) { @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 Map call() throws GitAPIException { } 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 NameRevCommand addPrefix(String prefix) { 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 NameRevCommand addAnnotatedTags() { 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 01b57bde8..bf8884261 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 Iterable call() throws GitAPIException, 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 PushCommand setProgressMonitor(ProgressMonitor monitor) { * @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 617c37d61..f704492fe 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 RebaseResult call() throws GitAPIException, NoHeadException, 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 @@ private void writeMergeInfo(RevCommit commitToPick, // 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 @@ String toAuthorScript(PersonIdent author) { 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 @@ else if (!isInteractive() && walk.isMergedInto(headCommit, upstream)) { } 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 @@ private List calculatePickList(RevCommit headCommit) 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 @@ PersonIdent parseAuthor(byte[] raw) { 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 412219cea..c5222c2d5 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 enum ResetType { 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 20683d5c0..c3152a93b 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 @@ * >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 069a9cfac..9e2cf3110 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 2cbfead8c..681f8e65a 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 RevCommit call() throws GitAPIException { 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 a2946f9c1..8420dd228 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 Collection call() throws GitAPIException, 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 48759c2d4..5b7c73b47 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 Set getIgnoredNotInIndex() { * @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 1d5f54213..8f7804a00 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 StatusCommand setIgnoreSubmodules(IgnoreSubmoduleMode mode) { */ 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 8f91b6792..4c5e317cb 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 Collection call() throws GitAPIException { 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 29d4b7375..8b27e4c41 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 Map call() throws GitAPIException { 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 8dc9ff9ab..f97dce983 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 Map call() throws GitAPIException { 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 bd2fb8668..29d5d49a4 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 Collection call() throws InvalidConfigurationException, 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 e31750713..7df35c925 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 List getConflictingPaths() { */ 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 719650211..13aeaee7d 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 0532250f9..c9c69db86 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 39421c6de..bd6e5c859 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 EditList diff( 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 24409ee59..e1dfcff6b 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 static List scan(TreeWalk walk, boolean includeTrees, 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 74bbca170..bf6d967c5 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 HashedSequencePair(SequenceComparator cmp, S a, S b) { /** @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 @@ private HashedSequence wrap(S base) { 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 80ac1b662..4ef58455a 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 void setMaxChainLength(int maxLen) { 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 @@ void diffRegion(Edit r) { } 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 @@ private void diff(Edit r) { } 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 e3861cd65..55ceec801 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 0e8399002..bc52473d9 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 List compute(ContentSource.Pair reader, ProgressMonitor pm) /** 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 @@ private void breakModifies(ContentSource.Pair reader, ProgressMonitor pm) } 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 @@ private void rejoinModifies(ProgressMonitor pm) { } added = newAdded; - deleted = new ArrayList(nameMap.values()); + deleted = new ArrayList<>(nameMap.values()); } private int calculateModifyScore(ContentSource.Pair reader, DiffEntry d) @@ -508,8 +508,8 @@ private void findExactRenames(ProgressMonitor pm) { 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 @@ private void findExactRenames(ProgressMonitor pm) { 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 @@ private void findExactRenames(ProgressMonitor pm) { } 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 @@ private static DiffEntry bestPathMatch(DiffEntry src, List list) { @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 6088d72f3..653658be3 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 @@ void compute(ProgressMonitor pm) throws IOException { 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 @@ boolean isTableOverflow() { } 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 @@ private static List compactSrcList(List in) { } 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 017fe6997..50ca613cc 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 static Subsequence a(S a, Edit region) { * @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 17ddd35e6..ce52fedcb 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 @@ private void registerIndexChangedListener(IndexChangedListener listener) { * @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 c3184437b..84f0da9e8 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 CheckoutMetadata(EolStreamType eolStreamType, 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 CheckoutMetadata(EolStreamType eolStreamType, 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 0cc2b7653..22bedcf91 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 int compare(final PathEdit o1, final PathEdit o2) { */ 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 55b64eeb9..3a7b2c66d 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 @@ private static String format(final Collection causes) { */ 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 6ac4b0f8b..12ef533ad 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 @@ /** 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 @@ private void add(ListenerHandle handle) { 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 f9c239431..856d74e99 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 @@ private FileNameMatcher(final List headsStartValue) { 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 @@ private static List createHeadsStartValues( 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 @@ private static List createHeadsStartValues( head.setNewHeads(nextHeadsSuggestion); } else { head.setNewHeads(nextHeadsSuggestion); - nextHeadsSuggestion = new ArrayList(2); + nextHeadsSuggestion = new ArrayList<>(2); nextHeadsSuggestion.add(head); } } @@ -236,7 +236,7 @@ private static List parseHeads(final String pattern, 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 @@ private static List parseHeads(final String pattern, 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 void reset() { * 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 a7bd2eafb..5c1875678 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 55ded92a1..7b600ee06 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 ManifestParser(IncludedFileReader includedReader, String filename, 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 ManifestParser(IncludedFileReader includedReader, String filename, } } - remotes = new HashMap(); - projects = new ArrayList(); - filteredProjects = new ArrayList(); + remotes = new HashMap<>(); + projects = new ArrayList<>(); + filteredProjects = new ArrayList<>(); } /** @@ -258,7 +258,7 @@ public void endDocument() throws SAXException { 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 c3c7714c1..dd68f6010 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 RevCommit call() throws GitAPIException { } 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 ff4a3ed1c..700cf1107 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 RepoProject(String name, String path, String revision, 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 8b1244ed1..6314c63d2 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 static enum MatchResult { /** 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 9bb93cd88..65224eab9 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 @@ private boolean isSimplePathWithSegments(String path) { 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 1c467fe71..da482fa50 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 static List split(String pattern, char slash) { 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 f7decf132..ef0b80c11 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 @@ private DfsBlockCache(final DfsBlockCacheConfig cfg) { 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 @@ private DfsBlockCache(final DfsBlockCacheConfig cfg) { 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 @@ DfsBlock getOrLoad(DfsPackFile pack, long position, DfsReader ctx) } 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 @@ Ref put(DfsPackKey key, long pos, int size, T v) { } 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 968313254..d3803024a 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 DfsGarbageCollector(DfsRepository repository) { 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 boolean pack(ProgressMonitor pm) throws IOException { 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 @@ private Collection getAllRefs() throws IOException { 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 List getNewPackStatistics() { 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 c179e7778..1551ad615 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 @@ private ObjectId endObject(ObjectId id, long offset) { } 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 Collection resolve(AbbreviatedObjectId id) 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 b68527544..b1cb72dec 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 static enum PackSource { 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 @@ private PackList scanPacksImpl(PackList old) throws IOException { 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 @@ private PackList scanPacksImpl(PackList old) throws IOException { 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 cc467853b..0a29ac515 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 List getNewPackStatistics() { 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 int compare(DfsPackFile a, DfsPackFile b) { 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 int compare(DfsPackFile a, DfsPackFile b) { 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 358a92138..e825f1a8b 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 DfsPackDescription(DfsRepositoryDescription repoDesc, String name) { 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 5b5588058..755b16312 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 Collection resolve(AbbreviatedObjectId id) 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 @@ private Iterable> findAll( 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 @@ private void findAllImpl(PackList packList, 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 @@ private void findAllImpl(PackList packList, 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 @@ private DfsPackFile[] sortPacksForSelectRepresentation() 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 4ddcec167..b41c18b6c 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 Map getRefs(String prefix) throws IOException { 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 a31a47e11..527e46b73 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 void setGitwebDescription(@Nullable String d) { } 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 @@ protected synchronized void commitPackImpl( 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 void flush() { 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 void setReadAheadBytes(int b) { * 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 void execute(RevWalk walk, ProgressMonitor monitor) @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 7855a460c..88eef4ce8 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 @@ private EWAHCompressedBitmap ewahBitmap(Bitmap other) { 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 a81d8ec0e..d47b30468 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 a95dea74b..b3979894e 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 @@ private static int hash(final long position) { private int openByteCount; static { - DEAD = new SoftReference(null); + DEAD = new SoftReference<>(null); reconfigure(new WindowCacheConfig()); } @@ -115,7 +115,7 @@ void store(final PackFile pack, final long position, 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 16315a5b5..ba52251a4 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 @@ private File descriptionFile() { */ @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 353024c9d..c68e5f7f3 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 void prune(Set objectsToKeep) throws IOException, // 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 @@ private static boolean equals(Ref r1, Ref r2) { */ 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 Collection repack() throws IOException { 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 @@ else if (RefTreeNames.isRefTree(refdb, ref.getName())) 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 @@ else if (RefTreeNames.isRefTree(refdb, ref.getName())) 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 @@ private Set listRefLogObjects(Ref ref, long minTime) throws IOExceptio .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 @@ private Set listNonHEADIndexObjects() treeWalk.setFilter(TreeFilter.ANY_DIFF); treeWalk.setRecursive(true); - Set ret = new HashSet(); + Set ret = new HashSet<>(); while (treeWalk.next()) { checkCancelled(); @@ -965,7 +965,7 @@ private PackFile writePack(@NonNull Set want, 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 2f4d2d633..1aa71e5a5 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 ObjectDirectory(final Config cfg, final File dir, 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 @@ Set getShallowCommits() throws IOException { if (shallowFileSnapshot == null || shallowFileSnapshot.isModified(shallowFile)) { - shallowCommitsIds = new HashSet(); + shallowCommitsIds = new HashSet<>(); final BufferedReader reader = open(shallowFile); try { @@ -797,7 +797,7 @@ private PackList scanPacksImpl(final PackList old) { 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 @@ private PackList scanPacksImpl(final PackList old) { } 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 @@ private Set listPackDirectory() { 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 @@ AlternateHandle[] myAlternates() { } 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 d80abaa9c..bfd60fc53 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 6b5b8826e..9a8c2752d 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 @@ private PackBitmapIndexRemapper( 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 542570a2d..24d51a5ea 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 Map getRefs(String prefix) throws IOException { @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 @@ private class LooseScanner { 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 @@ private PackedRefList readPackedRefs() throws IOException { 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 490da4695..c3702feca 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 @@ public List getReverseEntries(int max) throws IOException { } 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 ce67ae07a..967754a62 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 @@ private static class Table { 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 e1b7606df..a525c8511 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 @@ private WindowCache(final WindowCacheConfig cfg) { 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 27215502b..83b236ed9 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 @@ public Collection resolve(AbbreviatedObjectId id) 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 b6af0b03f..d231ccb99 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 91917b281..973dd1de3 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 635cb8d8d..0c4e4448d 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 @@ static final class Block { 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 @@ void partitionTasks() { } 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 int size() { 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 37354d3e6..93dbee3e7 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 static Iterable getInstances() { @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 PackWriter(final PackConfig config, final ObjectReader reader) { 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 PackWriter setObjectCountCallback(ObjectCountCallback callback) { */ public void setClientShallowCommits(Set clientShallowCommits) { stats.clientShallowCommits = Collections - .unmodifiableSet(new HashSet(clientShallowCommits)); + .unmodifiableSet(new HashSet<>(clientShallowCommits)); } /** @@ -918,7 +918,7 @@ private List sortByName() { 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 @@ private void searchForReuse(ProgressMonitor monitor) throws IOException { 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 void run() { 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 @@ private void findObjectsToPack(@NonNull ProgressMonitor countingMonitor, } } - 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 @@ private void findObjectsToPack(@NonNull ProgressMonitor countingMonitor, 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 @@ private void findObjectsToPack(@NonNull ProgressMonitor countingMonitor, } 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 @@ private void findObjectsToPack(@NonNull ProgressMonitor countingMonitor, 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 2c2c80eb8..07a03b404 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 @@ Collection selectCommits(int expectedCommitCount) 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 @@ Collection selectCommits(int expectedCommitCount) // 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 @@ Collection selectCommits(int expectedCommitCount) } if (longestAncestorChain == null) { - longestAncestorChain = new ArrayList(); + longestAncestorChain = new ArrayList<>(); chains.add(longestAncestorChain); } longestAncestorChain.add(new BitmapCommit( @@ -376,7 +376,7 @@ private CommitSelectionHelper setupTipCommitBitmaps(RevWalk rw, 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 @@ private CommitSelectionHelper setupTipCommitBitmaps(RevWalk rw, // 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 670f9a9e1..de1003bdd 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 File getObjectDirectory() { public B addAlternateObjectDirectory(File other) { if (other != null) { if (alternateObjectDirectories == null) - alternateObjectDirectories = new LinkedList(); + alternateObjectDirectories = new LinkedList<>(); alternateObjectDirectories.add(other); } return self(); @@ -429,7 +429,7 @@ public B readEnvironment(SystemReader sr) { public B addCeilingDirectory(File root) { if (root != null) { if (ceilingDirectories == null) - ceilingDirectories = new LinkedList(); + 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 653c9f66b..3f6995de8 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 void execute(RevWalk walk, ProgressMonitor monitor, } 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 void execute(RevWalk walk, ProgressMonitor monitor, } 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 void execute(RevWalk walk, ProgressMonitor monitor) 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 @@ private static void addRefToPrefixes(Collection prefixes, } 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 ec771a24f..f45c71cf9 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 Config() { */ public Config(Config defaultConfig) { baseConfig = defaultConfig; - state = new AtomicReference(newState()); + state = new AtomicReference<>(newState()); } /** @@ -960,7 +960,7 @@ private ConfigSnapshot unsetSection(final ConfigSnapshot srcState, 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 @@ private static List copy(final ConfigSnapshot src, // 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 @@ private List fromTextRecurse(final String text, int depth) 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 90c42ea16..f5ada13a3 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 @@ private Map getNamesInternal(String section, 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 @@ private List sorted() { } 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 @@ private static class SectionNames { 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 @@ private static class SectionNames { 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 b845fad03..e544b72a8 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 TreeFilter clone() { 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 TreeFilter clone() { 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 boolean diff(final ProgressMonitor monitor, int estWorkTreeSize, 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 boolean diff(final ProgressMonitor monitor, int estWorkTreeSize, 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 Set getIgnoredNotInIndex() { */ 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 Set getAssumeUnchanged() { */ public Set getUntrackedFolders() { return ((indexDiffFilter == null) ? Collections. emptySet() - : new HashSet(indexDiffFilter.getUntrackedFolders())); + : new HashSet<>(indexDiffFilter.getUntrackedFolders())); } /** @@ -727,7 +727,7 @@ public FileMode getIndexMode(final String path) { 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 feecbd81c..9d3aee150 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 void checkTree(@Nullable AnyObjectId id, byte[] raw) 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 b79a02c64..f39f29189 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 AbbreviatedObjectId abbreviate(AnyObjectId objectId, int len) 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 75a359221..1047a6df9 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 List readRebaseTodo(String path, 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 91b0319f4..95e338685 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 int compare(final Ref o1, final Ref o2) { * @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 517c8aa53..59a104b60 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 Collection getConflictingNames(String name) 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 c59224e3a..e2f6c3c71 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 Map getAllRefs() { try { return getRefDatabase().getRefs(RefDatabase.ALL); } catch (IOException e) { - return new HashMap(); + return new HashMap<>(); } } @@ -1067,7 +1067,7 @@ public Map getTags() { try { return getRefDatabase().getRefs(Constants.R_TAGS); } catch (IOException e) { - return new HashMap(); + return new HashMap<>(); } } @@ -1102,7 +1102,7 @@ public Ref peel(final Ref ref) { @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 Map> getAllRefsByPeeledObjectId() { // 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 List readMergeHeads() throws IOException, NoWorkTreeException { 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 2f1a9e1cd..baa528686 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 @@ private void unregisterAndCloseRepository(final Key location) { } 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 112550a1d..04c65effb 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 MergeAlgorithm(DiffAlgorithm diff) { */ 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 ee6095aa7..43876a622 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 void formatMerge(OutputStream out, MergeResult res, @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 82cbf368c..ca0e18a0e 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 String format(List refsToMerge, Ref target) { 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 String format(List refsToMerge, Ref target) { } } - 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 c5e615ed8..656480e46 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 e0556447c..f8e1998ed 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 @@ protected RevCommit getBaseCommit(RevCommit a, RevCommit b) */ 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 @@ protected RevCommit getBaseCommit(RevCommit a, RevCommit b, int callDepth) 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 fd5e7ef7b..f667af278 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 enum MergeFailureReason { * * @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 enum MergeFailureReason { * * @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 enum MergeFailureReason { * * @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 enum MergeFailureReason { * * @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 @@ protected boolean processEntry(CanonicalTreeParser base, 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 d880d9b61..fd425abf3 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 @@ */ 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 @@ static synchronized T lookupBundle(Locale locale, 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 396ad7884..5e7beed1e 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 static T getBundleFor(Class type) { } 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 b104a4984..2c8f34e7c 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 @@ int parseGitHeaders(int ptr, final int end) { 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 534c82731..eb28a0e2a 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 @@ void addHunk(final HunkHeader h) { 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 40ea77e8e..10ac449d1 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 6102a8148..a8eb86e23 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 bdeb01c3a..be1f07a38 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 void addAdditionalRefs(Iterable refs) throws IOException { 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 3609d46e3..5d7e72dd2 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 f98a7d637..58689981b 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 ObjectWalk(final Repository repo) { 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 @@ protected void reset(final int retainFlags) { 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 1e91006d4..c641a1331 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 final List getFooterLines() { 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 final List getFooterLines(final FooterKey keyName) { 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 1afdeb610..bb699e08c 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 RevFlagSet() { */ 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 572ebcd2e..320f05f44 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 RevWalk(ObjectReader or) { 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 @@ byte[] getCachedBytes(RevObject obj, ObjectLoader ldr) */ 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 11fec31e9..e751d7714 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 static List find(final RevWalk walk, 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 static List findBranchesReachableFrom(RevCommit commit, // 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 1aebaddac..64cb4ddba 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 @@ HttpURLConnection open(final String method, final String bucket, 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 @@ static Properties properties(final File authFile) } private final class ListParser extends DefaultHandler { - final List entries = new ArrayList(); + final List entries = new ArrayList<>(); private final String bucket; @@ -680,7 +680,7 @@ private final class ListParser extends DefaultHandler { } 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 aa36aeb1b..c69544930 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 @@ protected void readAdvertisedRefs() throws TransportException { } 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 128ec4e28..e8d18812f 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 BasePackFetchConnection(final PackTransport packTransport) { 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 bb5922d21..679ea0c8f 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 @@ private String enableCapabilities(final ProgressMonitor monitor, 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 a7e72f1de..6f94dbbfe 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 static class FirstLine { * 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 @@ protected BaseReceivePack(final Repository into) { 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 @@ protected void init(final InputStream input, final OutputStream output, 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 559c40394..f37ba0103 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 @@ private int readSignature() throws IOException { 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 @@ private void verifyPrerequisites() throws TransportException { 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 ca624c03d..37d70e3a1 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 void writeBundle(ProgressMonitor monitor, OutputStream os) 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 739ddccc7..8cb3d604c 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 843f6cc0e..83586350b 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 String[] promptKeyboardInteractive(String destination, String name, 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 8cb36c791..280e6d4df 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 @@ private void executeImp(final ProgressMonitor monitor, 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 @@ private void reopenConnection() throws NotSupportedException, // 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 @@ private void expandSingle(final RefSpec spec, final Set matched) } 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 3d95eddc9..7df997c1e 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 4256fe47d..c97daa958 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 @@ void authorize(final String username, final String password) { @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 @@ private static String LHEX(byte[] bin) { } 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 d1cbd8d26..ce14183a5 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 @@ * 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 88b4b074a..4d60202a6 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 @@ V put(final long key, final V value) { 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 8855f9656..bab5bf035 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 @@ boolean complete() { 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 6051f39c0..8b7b60da3 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 @@ private synchronized Map refresh() { } 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 ad51f3e70..42317984f 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 4bbe3f881..93e7952bd 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 @@ protected void setCheckObjectCollisions(boolean check) { */ public void setNeedNewObjectIds(boolean b) { if (b) - newObjectIds = new ObjectIdSubclassMap(); + newObjectIds = new ObjectIdSubclassMap<>(); else newObjectIds = null; } @@ -333,14 +333,14 @@ public void setExpectDataAfterPackFooter(boolean e) { 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 PackLock parse(ProgressMonitor receiving, ProgressMonitor resolving) 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 @@ private void resolveDeltasWithExternalBases(final ProgressMonitor progress) 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 5590c2d25..3201732a9 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 @@ else if (!preprocessed.isEmpty()) 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 0cd720c29..745e813c4 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 @@ protected void end() throws IOException { 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 ba0931b9b..d91684e2f 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 RemoteConfig(final Config rc, final String remoteName) 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 RemoteConfig(final Config rc, final String remoteName) * 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 @@ private void unset(final Config rc, final String key) { 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 5fd2f84b7..8a28e3a7d 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 TestProtocol(UploadPackFactory uploadPackFactory, ReceivePackFactory receivePackFactory) { this.uploadPackFactory = uploadPackFactory; this.receivePackFactory = receivePackFactory; - this.handles = new HashMap(); + this.handles = new HashMap<>(); } @Override @@ -174,7 +174,7 @@ private class TransportInternal extends Transport implements PackTransport { 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 FetchConnection openFetch() throws NotSupportedException, 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 5507e9b05..2198b50f0 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 RefFilter getRefFilter() { 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 269d11644..649e84062 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 enum Operation { } private static final List> protocols = - new CopyOnWriteArrayList>(); + new CopyOnWriteArrayList<>(); static { // Registration goes backwards in order of priority. @@ -226,7 +226,7 @@ private static void load(ClassLoader ldr, String cn) { * 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 static void unregister(TransportProtocol proto) { */ 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 static List openAll(final Repository local, 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 static List openAll(final Repository local, 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 static Collection findRemoteRefUpdatesFor( 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 @@ private static Collection expandPushWildcardsFor( 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 FetchResult fetch(final ProgressMonitor monitor, // 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 74d9e7ff4..6cd119bd2 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 @@ WalkRemoteObjectDatabase openAlternate(final String location) @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 @@ void writeFile(final String path, final byte[] data) throws IOException { } 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 31d7909d1..f2ddc0d0d 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 49a2042d9..9a40f47cb 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 Process exec(String command, int timeout) 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 7c5289293..26a254d94 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 enum AcceptEncoding { 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 @@ private HttpConnection connect(final String service) } 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 @@ BufferedReader openReader(String path) throws IOException { @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 @@ FileStream open(String path, AcceptEncoding acceptEncoding) 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 32582ec48..f483ec7f9 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 @@ public UploadPack create(Void req, Repository db) { return createUploadPack(db); } }; - return new InternalFetchConnection(this, upf, null, openRepo()); + return new InternalFetchConnection<>(this, upf, null, openRepo()); } @Override @@ -207,7 +207,7 @@ public ReceivePack create(Void req, Repository db) { 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 b99378dc9..c46f94b7d 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 @@ WalkRemoteObjectDatabase openAlternate(final String location) @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 @@ private void mkdir_p(String path) throws IOException { } 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 3177b32e6..58fdd2574 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 static class FirstLine { */ 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 Set getOptions() { 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 @@ else if (requestValidator instanceof AnyRequestValidator) } 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 @@ private boolean negotiate() throws IOException { 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 @@ private void parseWants() throws IOException { for (ObjectId obj : wantIds) { if (!advertised.contains(obj)) { if (notAdvertisedWants == null) - notAdvertisedWants = new ArrayList(); + notAdvertisedWants = new ArrayList<>(); notAdvertisedWants.add(obj); } } @@ -1488,7 +1488,7 @@ private void sendPack(final boolean sideband) throws IOException { 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 0319d9386..3d60aedcc 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 @@ public void close() { 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 @@ private boolean downloadPackedObject(final ProgressMonitor monitor, private Iterator swapFetchQueue() { final Iterator r = workQueue.iterator(); - workQueue = new LinkedList(); + workQueue = new LinkedList<>(); return r; } @@ -794,7 +794,7 @@ private void recordError(final AnyObjectId id, final Throwable what) { 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 39f11f96e..5c4e14ca3 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 @@ public void push(final ProgressMonitor monitor, 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 @@ private void sendpack(final List updates, 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 @@ private void sendpack(final List updates, 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 @@ private void sendpack(final List updates, // 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 24f30ed20..17f8c3ec1 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 @@ Collection readAlternates(final String listPath) 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 44d90aba0..7654d462e 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 01156c338..1ed946815 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 static enum OperationType { * 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 4eb530e98..0d3c78888 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 String getCleanFilterCommand() throws IOException { cmd = state.walk .getFilterCommand(Constants.ATTR_FILTER_TYPE_CLEAN); } - cleanFilterCommandHolder = new Holder(cmd); + cleanFilterCommandHolder = new Holder<>(cmd); } return cleanFilterCommandHolder.get(); } @@ -1415,7 +1415,7 @@ private EolStreamType getEolStreamType(OperationType opType) 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 42725bc76..b821a1647 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 Set getIgnoredPaths() { * 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 6828185a8..8677c690f 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 @@ /** 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 f189b3586..68b71309b 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 File resolve(final File dir, final String name) { 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 File userHome() { * @return {@code this}. */ public FS setUserHome(File path) { - userHome = new Holder(path); + userHome = new Holder<>(path); return this; } @@ -650,7 +650,7 @@ protected File discoverGitSystemConfig() { */ public File getGitSystemConfig() { if (gitSystemConfig == null) { - gitSystemConfig = new Holder(discoverGitSystemConfig()); + gitSystemConfig = new Holder<>(discoverGitSystemConfig()); } return gitSystemConfig.value; } @@ -664,7 +664,7 @@ public File getGitSystemConfig() { * @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 cb4868cc7..0780d2b56 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 @@ private static void apply(Set set, @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 dffd66569..060292160 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 @@ protected File userHomeImpl() { @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 e62083e9c..545cc0119 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 String run() { @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 1f1d15b32..1f20e9700 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 static void delete(final File f, int options) throws IOException { 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 4aafa3a2c..da78008a0 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 @@ private static SimpleDateFormat getDateFormat(ParseableSimpleDateFormat f, 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 0d283fde6..6cff76cc2 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 static void skipFully(final InputStream fd, long toSkip) * @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 96c1a89f2..159781795 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 @@ * 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 final T get(int idx) { * @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 final RefList set(int idx, T ref) { 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 final RefList add(int idx, T ref) { 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 final RefList remove(int idx) { 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 void sort() { /** @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 9509db0db..e3f1916f4 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 void reset() { 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 0319afd5a..1c46310ef 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 int read() throws IOException { } }; - private final LinkedList streams = new LinkedList(); + private final LinkedList streams = new LinkedList<>(); /** Create an empty InputStream that is currently at EOF state. */ public UnionInputStream() {