summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2024-04-28 22:41:46 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2024-04-29 15:05:23 +0200
commit964498e0a5059fc62417f4d09074b56b42b148be (patch)
treeb5e7be9f32c3dd5700f95e79de7ac30f5709e4c8 /org.eclipse.jgit/src/org
parentd8cb554f25925f3ea2d66815fdaa59efa1867ae3 (diff)
downloadjgit-964498e0a5059fc62417f4d09074b56b42b148be.tar.gz
jgit-964498e0a5059fc62417f4d09074b56b42b148be.zip
[errorprone] Fix error pattern JdkObsolete
See https://errorprone.info/bugpattern/JdkObsolete Change-Id: Id105e2695eb64523bd217f507bf95f909bc6b348
Diffstat (limited to 'org.eclipse.jgit/src/org')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/RmCommand.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/StatusCommand.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/errors/CheckoutConflictException.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/CommitGraphWriter.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java3
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexBuilder.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/memory/TernarySearchTree.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaTask.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/transport/ssh/OpenSshConfigFile.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoFile.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/MergeBaseGenerator.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java6
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java5
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java21
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/http/JDKHttpConnection.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/IndexDiffFilter.java17
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/io/UnionInputStream.java5
27 files changed, 77 insertions, 82 deletions
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 a03ea01864..c133219d4d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java
@@ -17,7 +17,6 @@ import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashSet;
-import java.util.LinkedList;
import java.util.List;
import java.util.Set;
@@ -164,7 +163,7 @@ public class CheckoutCommand extends GitCommand<Ref> {
*/
protected CheckoutCommand(Repository repo) {
super(repo);
- this.paths = new LinkedList<>();
+ this.paths = new ArrayList<>();
}
@Override
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 a1c64788bd..a353d1a135 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java
@@ -14,7 +14,7 @@ import static org.eclipse.jgit.lib.Constants.OBJECT_ID_ABBREV_STRING_LENGTH;
import java.io.IOException;
import java.text.MessageFormat;
-import java.util.LinkedList;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -63,7 +63,7 @@ import org.eclipse.jgit.treewalk.FileTreeIterator;
public class CherryPickCommand extends GitCommand<CherryPickResult> {
private String reflogPrefix = "cherry-pick:"; //$NON-NLS-1$
- private List<Ref> commits = new LinkedList<>();
+ private List<Ref> commits = new ArrayList<>();
private String ourCommitName = null;
@@ -102,7 +102,7 @@ public class CherryPickCommand extends GitCommand<CherryPickResult> {
UnmergedPathsException, ConcurrentRefUpdateException,
WrongRepositoryStateException, NoHeadException {
RevCommit newHead = null;
- List<Ref> cherryPickedRefs = new LinkedList<>();
+ List<Ref> cherryPickedRefs = new ArrayList<>();
checkCallable();
try (RevWalk revWalk = new RevWalk(repo)) {
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 483b9602da..a1a2cc09d2 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java
@@ -16,7 +16,6 @@ import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
-import java.util.LinkedList;
import java.util.List;
import org.eclipse.jgit.annotations.NonNull;
@@ -109,7 +108,7 @@ public class CommitCommand extends GitCommand<RevCommit> {
* parents this commit should have. The current HEAD will be in this list
* and also all commits mentioned in .git/MERGE_HEAD
*/
- private List<ObjectId> parents = new LinkedList<>();
+ private List<ObjectId> parents = new ArrayList<>();
private String reflogComment;
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 ed4a5342b3..7064f5a57a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java
@@ -13,9 +13,9 @@ package org.eclipse.jgit.api;
import java.io.IOException;
import java.text.MessageFormat;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
-import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -75,7 +75,7 @@ public class MergeCommand extends GitCommand<MergeResult> {
private ContentMergeStrategy contentStrategy;
- private List<Ref> commits = new LinkedList<>();
+ private List<Ref> commits = new ArrayList<>();
private Boolean squash;
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 757aff89c3..858bd961cd 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
@@ -23,7 +23,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
@@ -1120,8 +1119,8 @@ public class RebaseCommand extends GitCommand<RebaseResult> {
private void popSteps(int numSteps) throws IOException {
if (numSteps == 0)
return;
- List<RebaseTodoLine> todoLines = new LinkedList<>();
- List<RebaseTodoLine> poppedLines = new LinkedList<>();
+ List<RebaseTodoLine> todoLines = new ArrayList<>();
+ List<RebaseTodoLine> poppedLines = new ArrayList<>();
for (RebaseTodoLine line : repo.readRebaseTodo(
rebaseState.getPath(GIT_REBASE_TODO), true)) {
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 225c9996cf..47145a0563 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java
@@ -11,8 +11,8 @@ package org.eclipse.jgit.api;
import java.io.IOException;
import java.text.MessageFormat;
+import java.util.ArrayList;
import java.util.Collection;
-import java.util.LinkedList;
import org.eclipse.jgit.api.errors.CheckoutConflictException;
import org.eclipse.jgit.api.errors.GitAPIException;
@@ -90,7 +90,7 @@ public class ResetCommand extends GitCommand<Ref> {
private ResetType mode;
- private Collection<String> filepaths = new LinkedList<>();
+ private Collection<String> filepaths = new ArrayList<>();
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 5231d4a327..855c3b1cf3 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java
@@ -13,7 +13,7 @@ import static org.eclipse.jgit.lib.Constants.OBJECT_ID_ABBREV_STRING_LENGTH;
import java.io.IOException;
import java.text.MessageFormat;
-import java.util.LinkedList;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -58,13 +58,13 @@ import org.eclipse.jgit.treewalk.FileTreeIterator;
* >Git documentation about revert</a>
*/
public class RevertCommand extends GitCommand<RevCommit> {
- private List<Ref> commits = new LinkedList<>();
+ private List<Ref> commits = new ArrayList<>();
private String ourCommitName = null;
private boolean insertChangeId;
- private List<Ref> revertedRefs = new LinkedList<>();
+ private List<Ref> revertedRefs = new ArrayList<>();
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 656f36a81a..7459e7298f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RmCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RmCommand.java
@@ -13,7 +13,6 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.LinkedList;
import java.util.List;
import org.eclipse.jgit.api.errors.GitAPIException;
@@ -71,7 +70,7 @@ public class RmCommand extends GitCommand<DirCache> {
*/
public RmCommand(Repository repo) {
super(repo);
- filepatterns = new LinkedList<>();
+ filepatterns = new ArrayList<>();
}
/**
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 eab389460a..cdd078ea25 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/StatusCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/StatusCommand.java
@@ -10,7 +10,7 @@
package org.eclipse.jgit.api;
import java.io.IOException;
-import java.util.LinkedList;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.jgit.api.errors.GitAPIException;
@@ -83,7 +83,7 @@ public class StatusCommand extends GitCommand<Status> {
*/
public StatusCommand addPath(String path) {
if (paths == null)
- paths = new LinkedList<>();
+ paths = new ArrayList<>();
paths.add(path);
return this;
}
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 0224b3dbb3..5538711192 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
@@ -37,7 +37,7 @@
*/
package org.eclipse.jgit.api.errors;
-import java.util.LinkedList;
+import java.util.ArrayList;
import java.util.List;
/**
@@ -99,7 +99,7 @@ public class CheckoutConflictException extends GitAPIException {
*/
CheckoutConflictException addConflictingPath(String conflictingPath) {
if (conflictingPaths == null)
- conflictingPaths = new LinkedList<>();
+ conflictingPaths = new ArrayList<>();
conflictingPaths.add(conflictingPath);
return this;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/CommitGraphWriter.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/CommitGraphWriter.java
index 1f1c35ac19..0d9815eceb 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/CommitGraphWriter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/CommitGraphWriter.java
@@ -31,12 +31,12 @@ import java.io.IOException;
import java.io.InterruptedIOException;
import java.io.OutputStream;
import java.nio.ByteBuffer;
+import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
-import java.util.Stack;
import org.eclipse.jgit.annotations.NonNull;
import org.eclipse.jgit.annotations.Nullable;
@@ -336,10 +336,10 @@ public class CommitGraphWriter {
continue;
}
- Stack<RevCommit> commitStack = new Stack<>();
+ ArrayDeque<RevCommit> commitStack = new ArrayDeque<>();
commitStack.push(cmit);
- while (!commitStack.empty()) {
+ while (!commitStack.isEmpty()) {
int maxGeneration = 0;
boolean allParentComputed = true;
RevCommit current = commitStack.peek();
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 a342796cbe..c939114f5f 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
@@ -21,7 +21,6 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import java.util.Set;
@@ -308,7 +307,7 @@ public class DfsReader extends ObjectReader implements ObjectReuseAsIs {
private <T extends ObjectId> Iterable<FoundObject<T>> findAll(
Iterable<T> objectIds) throws IOException {
- Collection<T> pending = new LinkedList<>();
+ Collection<T> pending = new ArrayList<>();
for (T id : objectIds) {
pending.add(id);
}
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 4c996730e8..cf26f8d284 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
@@ -49,7 +49,6 @@ import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -866,7 +865,7 @@ public class GC {
}
}
- List<ObjectIdSet> excluded = new LinkedList<>();
+ List<ObjectIdSet> excluded = new ArrayList<>();
for (Pack p : repo.getObjectDatabase().getPacks()) {
checkCancelled();
if (!shouldPackKeptObjects() && p.shouldBeKept()) {
@@ -1897,7 +1896,7 @@ public class GC {
}
private String getProcDesc() {
- StringBuffer s = new StringBuffer(Long.toString(getPID()));
+ StringBuilder s = new StringBuilder(Long.toString(getPID()));
s.append(' ');
s.append(getHostName());
return s.toString();
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 1da805503d..08d2b7178f 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
@@ -11,9 +11,9 @@
package org.eclipse.jgit.internal.storage.file;
import java.text.MessageFormat;
+import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.LinkedList;
import java.util.List;
import org.eclipse.jgit.internal.JGitText;
@@ -41,8 +41,7 @@ public class PackBitmapIndexBuilder extends BasePackBitmapIndex {
private final EWAHCompressedBitmap tags;
private final BlockList<PositionEntry> byOffset;
- private final LinkedList<StoredBitmap>
- bitmapsToWriteXorBuffer = new LinkedList<>();
+ private final ArrayDeque<StoredBitmap> bitmapsToWriteXorBuffer = new ArrayDeque<>();
private List<StoredEntry> bitmapsToWrite = new ArrayList<>();
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 169dce1cc0..8e57bf9f2f 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
@@ -41,11 +41,11 @@ import java.nio.file.Paths;
import java.security.DigestInputStream;
import java.security.MessageDigest;
import java.text.MessageFormat;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
@@ -64,8 +64,8 @@ import org.eclipse.jgit.events.RefsChangedEvent;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.CoreConfig.TrustPackedRefsStat;
import org.eclipse.jgit.lib.CoreConfig.TrustLooseRefStat;
+import org.eclipse.jgit.lib.CoreConfig.TrustPackedRefsStat;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectIdRef;
import org.eclipse.jgit.lib.Ref;
@@ -413,7 +413,7 @@ public class RefDirectory extends RefDatabase {
@Override
public List<Ref> getAdditionalRefs() throws IOException {
- List<Ref> ret = new LinkedList<>();
+ List<Ref> ret = new ArrayList<>();
for (String name : additionalRefsNames) {
Ref r = exactRef(name);
if (r != null)
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/memory/TernarySearchTree.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/memory/TernarySearchTree.java
index acc1c830d5..72434dbffe 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/memory/TernarySearchTree.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/memory/TernarySearchTree.java
@@ -9,9 +9,9 @@
*/
package org.eclipse.jgit.internal.storage.memory;
+import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -340,7 +340,7 @@ public final class TernarySearchTree<Value> {
* @return all keys
*/
public Iterable<String> getKeys() {
- Queue<String> queue = new LinkedList<>();
+ Queue<String> queue = new ArrayDeque<>();
lock.readLock().lock();
try {
findKeysWithPrefix(root, new StringBuilder(), queue);
@@ -358,7 +358,7 @@ public final class TernarySearchTree<Value> {
* @return keys starting with given prefix
*/
public Iterable<String> getKeysWithPrefix(String prefix) {
- Queue<String> keys = new LinkedList<>();
+ Queue<String> keys = new ArrayDeque<>();
if (prefix == null) {
return keys;
}
@@ -486,7 +486,7 @@ public final class TernarySearchTree<Value> {
* @return keys matching given pattern.
*/
public Iterable<String> getKeysMatching(String pattern) {
- Queue<String> keys = new LinkedList<>();
+ Queue<String> keys = new ArrayDeque<>();
lock.readLock().lock();
try {
findKeysWithPrefix(root, new StringBuilder(), 0, pattern, keys);
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 9a3f4b07ee..03d6f16733 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
@@ -11,10 +11,10 @@
package org.eclipse.jgit.internal.storage.pack;
import java.io.IOException;
+import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
-import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.Callable;
@@ -232,14 +232,15 @@ final class DeltaTask implements Callable<Object> {
}
private final Block block;
- final LinkedList<Slice> slices;
+
+ final ArrayDeque<Slice> slices;
private ObjectReader or;
private DeltaWindow dw;
DeltaTask(Block b) {
this.block = b;
- this.slices = new LinkedList<>();
+ this.slices = new ArrayDeque<>();
}
void add(Slice s) {
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/transport/ssh/OpenSshConfigFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/transport/ssh/OpenSshConfigFile.java
index 29a2922136..3e75a9dde3 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/transport/ssh/OpenSshConfigFile.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/transport/ssh/OpenSshConfigFile.java
@@ -22,7 +22,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -100,7 +99,7 @@ public class OpenSshConfigFile implements SshConfigStore {
* fully resolved entries created from that.
*/
private static class State {
- List<HostEntry> entries = new LinkedList<>();
+ List<HostEntry> entries = new ArrayList<>();
// Previous lookups, keyed by user@hostname:port
Map<String, HostEntry> hosts = new HashMap<>();
@@ -218,7 +217,7 @@ public class OpenSshConfigFile implements SshConfigStore {
private List<HostEntry> parse(BufferedReader reader)
throws IOException {
- final List<HostEntry> entries = new LinkedList<>();
+ final List<HostEntry> entries = new ArrayList<>();
// The man page doesn't say so, but the openssh parser (readconf.c)
// starts out in active mode and thus always applies any lines that
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 c716f464d3..b036a0b6a1 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoFile.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoFile.java
@@ -17,7 +17,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
-import java.util.LinkedList;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.jgit.lib.RebaseTodoLine.Action;
@@ -62,7 +62,7 @@ public class RebaseTodoFile {
byte[] buf = IO.readFully(new File(repo.getDirectory(), path));
int ptr = 0;
int tokenBegin = 0;
- List<RebaseTodoLine> r = new LinkedList<>();
+ List<RebaseTodoLine> r = new ArrayList<>();
while (ptr < buf.length) {
tokenBegin = ptr;
ptr = RawParseUtils.nextLF(buf, ptr);
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 825ef17c3f..1ad41be423 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java
@@ -32,7 +32,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -106,9 +105,9 @@ public class ResolveMerger extends ThreeWayMerger {
*/
public static class Result {
- private final List<String> modifiedFiles = new LinkedList<>();
+ private final List<String> modifiedFiles = new ArrayList<>();
- private final List<String> failedToDelete = new LinkedList<>();
+ private final List<String> failedToDelete = new ArrayList<>();
private ObjectId treeId = null;
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 a213dd47c6..be29dc3138 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/MergeBaseGenerator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/MergeBaseGenerator.java
@@ -12,7 +12,7 @@ package org.eclipse.jgit.revwalk;
import java.io.IOException;
import java.text.MessageFormat;
-import java.util.LinkedList;
+import java.util.ArrayDeque;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.MissingObjectException;
@@ -47,7 +47,8 @@ class MergeBaseGenerator extends Generator {
private int recarryTest;
private int recarryMask;
private int mergeBaseAncestor = -1;
- private LinkedList<RevCommit> ret = new LinkedList<>();
+
+ private ArrayDeque<RevCommit> ret = new ArrayDeque<>();
private CarryStack stack;
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 4a02d6d452..b335675da5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java
@@ -33,10 +33,8 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.LinkedHashSet;
-import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import java.util.Vector;
import java.util.concurrent.CopyOnWriteArrayList;
import org.eclipse.jgit.annotations.NonNull;
@@ -109,7 +107,7 @@ public abstract class Transport implements AutoCloseable {
String name = prefix + Transport.class.getName();
return ldr.getResources(name);
} catch (IOException err) {
- return new Vector<URL>().elements();
+ return Collections.emptyEnumeration();
}
}
@@ -595,7 +593,7 @@ public abstract class Transport implements AutoCloseable {
Collection<RefSpec> fetchSpecs) throws IOException {
if (fetchSpecs == null)
fetchSpecs = Collections.emptyList();
- final List<RemoteRefUpdate> result = new LinkedList<>();
+ final List<RemoteRefUpdate> result = new ArrayList<>();
final Collection<RefSpec> procRefs = expandPushWildcardsFor(db, specs);
for (RefSpec spec : procRefs) {
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 3162b89908..a65d0b756c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
@@ -66,7 +66,6 @@ import java.util.Collections;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.LinkedHashSet;
-import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -763,7 +762,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
void processResponseCookies(HttpConnection conn) {
if (cookieFile != null && http.getSaveCookies()) {
- List<HttpCookie> foundCookies = new LinkedList<>();
+ List<HttpCookie> foundCookies = new ArrayList<>();
List<String> cookieHeaderValues = conn
.getHeaderFields(HDR_SET_COOKIE);
@@ -795,7 +794,7 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
private List<HttpCookie> extractCookies(String headerKey,
List<String> headerValues) {
- List<HttpCookie> foundCookies = new LinkedList<>();
+ List<HttpCookie> foundCookies = new ArrayList<>();
for (String headerValue : headerValues) {
foundCookies
.addAll(HttpCookie.parse(headerKey + ':' + headerValue));
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 8d89107c2b..3da76f38fa 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java
@@ -16,12 +16,13 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.MessageFormat;
+import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
-import java.util.LinkedList;
import java.util.List;
import java.util.Set;
@@ -112,16 +113,16 @@ class WalkFetchConnection extends BaseFetchConnection {
private final DateRevQueue localCommitQueue;
/** Objects we need to copy from the remote repository. */
- private LinkedList<ObjectId> workQueue;
+ private Deque<ObjectId> workQueue;
/** Databases we have not yet obtained the list of packs from. */
- private final LinkedList<WalkRemoteObjectDatabase> noPacksYet;
+ private final Deque<WalkRemoteObjectDatabase> noPacksYet;
/** Databases we have not yet obtained the alternates from. */
- private final LinkedList<WalkRemoteObjectDatabase> noAlternatesYet;
+ private final Deque<WalkRemoteObjectDatabase> noAlternatesYet;
/** Packs we have discovered, but have not yet fetched locally. */
- private final LinkedList<RemotePack> unfetchedPacks;
+ private final Deque<RemotePack> unfetchedPacks;
/**
* Packs whose indexes we have looked at in {@link #unfetchedPacks}.
@@ -163,13 +164,13 @@ class WalkFetchConnection extends BaseFetchConnection {
remotes = new ArrayList<>();
remotes.add(w);
- unfetchedPacks = new LinkedList<>();
+ unfetchedPacks = new ArrayDeque<>();
packsConsidered = new HashSet<>();
- noPacksYet = new LinkedList<>();
+ noPacksYet = new ArrayDeque<>();
noPacksYet.add(w);
- noAlternatesYet = new LinkedList<>();
+ noAlternatesYet = new ArrayDeque<>();
noAlternatesYet.add(w);
fetchErrors = new HashMap<>();
@@ -183,7 +184,7 @@ class WalkFetchConnection extends BaseFetchConnection {
LOCALLY_SEEN = revWalk.newFlag("LOCALLY_SEEN"); //$NON-NLS-1$
localCommitQueue = new DateRevQueue();
- workQueue = new LinkedList<>();
+ workQueue = new ArrayDeque<>();
}
@Override
@@ -567,7 +568,7 @@ class WalkFetchConnection extends BaseFetchConnection {
private Iterator<ObjectId> swapFetchQueue() {
final Iterator<ObjectId> r = workQueue.iterator();
- workQueue = new LinkedList<>();
+ workQueue = new ArrayDeque<>();
return r;
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/http/JDKHttpConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/http/JDKHttpConnection.java
index 8e9be1dde8..e20acadc4a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/http/JDKHttpConnection.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/http/JDKHttpConnection.java
@@ -20,7 +20,7 @@ import java.net.URL;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
-import java.util.LinkedList;
+import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -152,7 +152,7 @@ public class JDKHttpConnection implements HttpConnection {
private static List<String> mapValuesToListIgnoreCase(String keyName,
Map<String, List<String>> m) {
- List<String> fields = new LinkedList<>();
+ List<String> fields = new ArrayList<>();
m.entrySet().stream().filter(e -> keyName.equalsIgnoreCase(e.getKey()))
.filter(e -> e.getValue() != null)
.forEach(e -> fields.addAll(e.getValue()));
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 699ff6b68b..cfdc4dd358 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
@@ -10,8 +10,9 @@
package org.eclipse.jgit.treewalk.filter;
import java.io.IOException;
+import java.util.ArrayDeque;
+import java.util.ArrayList;
import java.util.HashSet;
-import java.util.LinkedList;
import java.util.List;
import java.util.Set;
@@ -62,9 +63,9 @@ public class IndexDiffFilter extends TreeFilter {
private final Set<String> ignoredPaths = new HashSet<>();
- private final LinkedList<String> untrackedParentFolders = new LinkedList<>();
+ private final ArrayDeque<String> untrackedParentFolders = new ArrayDeque<>();
- private final LinkedList<String> untrackedFolders = new LinkedList<>();
+ private final ArrayDeque<String> untrackedFolders = new ArrayDeque<>();
/**
* Creates a new instance of this filter. Do not use an instance of this
@@ -272,12 +273,14 @@ public class IndexDiffFilter extends TreeFilter {
* empty list will be returned.
*/
public List<String> getUntrackedFolders() {
- LinkedList<String> ret = new LinkedList<>(untrackedFolders);
+ ArrayList<String> ret = new ArrayList<>(untrackedFolders);
if (!untrackedParentFolders.isEmpty()) {
String toBeAdded = untrackedParentFolders.getLast();
- while (!ret.isEmpty() && ret.getLast().startsWith(toBeAdded))
- ret.removeLast();
- ret.addLast(toBeAdded);
+ while (!ret.isEmpty()
+ && ret.get(ret.size() - 1).startsWith(toBeAdded)) {
+ ret.remove(ret.size() - 1);
+ }
+ ret.add(toBeAdded);
}
return ret;
}
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 b37f28b161..c3a1c4e3bb 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
@@ -12,8 +12,9 @@ package org.eclipse.jgit.util.io;
import java.io.IOException;
import java.io.InputStream;
+import java.util.ArrayDeque;
+import java.util.Deque;
import java.util.Iterator;
-import java.util.LinkedList;
/**
* An InputStream which reads from one or more InputStreams.
@@ -34,7 +35,7 @@ public class UnionInputStream extends InputStream {
}
};
- private final LinkedList<InputStream> streams = new LinkedList<>();
+ private final Deque<InputStream> streams = new ArrayDeque<>();
/**
* Create an empty InputStream that is currently at EOF state.