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