]> source.dussan.org Git - jgit.git/commitdiff
[errorprone] Fix error pattern JdkObsolete 15/1194015/2
authorMatthias Sohn <matthias.sohn@sap.com>
Sun, 28 Apr 2024 20:41:46 +0000 (22:41 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Mon, 29 Apr 2024 13:05:23 +0000 (15:05 +0200)
See https://errorprone.info/bugpattern/JdkObsolete

Change-Id: Id105e2695eb64523bd217f507bf95f909bc6b348

40 files changed:
org.eclipse.jgit.http.apache/src/org/eclipse/jgit/transport/http/apache/HttpClientConnection.java
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitFilter.java
org.eclipse.jgit.lfs/src/org/eclipse/jgit/lfs/internal/LfsConnectionFactory.java
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CommandCatalog.java
org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/KnownHostEntryReader.java
org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/OpenSshServerKeyDatabase.java
org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/SshdSession.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/AbstractPlotRendererTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/http/JDKHttpConnectionTest.java
org.eclipse.jgit.test/tst/org/eclipse/jgit/util/http/HttpCookiesMatcher.java
org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/SwingCommitList.java
org.eclipse.jgit/src/org/eclipse/jgit/api/CheckoutCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/CherryPickCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/CommitCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/MergeCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/ResetCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/RmCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/StatusCommand.java
org.eclipse.jgit/src/org/eclipse/jgit/api/errors/CheckoutConflictException.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/CommitGraphWriter.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsReader.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexBuilder.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/memory/TernarySearchTree.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/DeltaTask.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/transport/ssh/OpenSshConfigFile.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoFile.java
org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java
org.eclipse.jgit/src/org/eclipse/jgit/revwalk/MergeBaseGenerator.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/Transport.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/http/JDKHttpConnection.java
org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/IndexDiffFilter.java
org.eclipse.jgit/src/org/eclipse/jgit/util/io/UnionInputStream.java
tools/BUILD

index 6d806dee371773e64250f23c731d6101199e3c69..0cb6fe10d0f1f698782b79462e738096bf1a6f7d 100644 (file)
@@ -25,10 +25,10 @@ import java.net.URL;
 import java.security.KeyManagementException;
 import java.security.NoSuchAlgorithmException;
 import java.security.SecureRandom;
+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.stream.Collectors;
@@ -300,7 +300,7 @@ public class HttpClientConnection implements HttpConnection {
                for (Header hdr : resp.getAllHeaders()) {
                        List<String> list = ret.get(hdr.getName());
                        if (list == null) {
-                               list = new LinkedList<>();
+                               list = new ArrayList<>();
                                ret.put(hdr.getName(), list);
                        }
                        for (HeaderElement hdrElem : hdr.getElements()) {
index 2f3eee41d6a99cc84c4a61d9114023b062cc1f99..703c0be8d9e6e0d9f16981630a48adf19056071f 100644 (file)
@@ -12,7 +12,7 @@ package org.eclipse.jgit.http.server;
 
 import java.io.File;
 import java.text.MessageFormat;
-import java.util.LinkedList;
+import java.util.ArrayList;
 import java.util.List;
 
 import javax.servlet.Filter;
@@ -65,9 +65,9 @@ public class GitFilter extends MetaFilter {
 
        private ReceivePackErrorHandler receivePackErrorHandler;
 
-       private final List<Filter> uploadPackFilters = new LinkedList<>();
+       private final List<Filter> uploadPackFilters = new ArrayList<>();
 
-       private final List<Filter> receivePackFilters = new LinkedList<>();
+       private final List<Filter> receivePackFilters = new ArrayList<>();
 
        /**
         * New servlet that will load its base directory from {@code web.xml}.
index d7d8d63775a3f1d413b54784e2d826a217a015bc..1a4e85ded6b0daded61e3a504003a9f3c7372cff 100644 (file)
@@ -9,11 +9,11 @@
  */
 package org.eclipse.jgit.lfs.internal;
 
+import static org.eclipse.jgit.lib.Constants.DEFAULT_REMOTE_NAME;
 import static org.eclipse.jgit.util.HttpSupport.ENCODING_GZIP;
 import static org.eclipse.jgit.util.HttpSupport.HDR_ACCEPT;
 import static org.eclipse.jgit.util.HttpSupport.HDR_ACCEPT_ENCODING;
 import static org.eclipse.jgit.util.HttpSupport.HDR_CONTENT_TYPE;
-import static org.eclipse.jgit.lib.Constants.DEFAULT_REMOTE_NAME;
 
 import java.io.IOException;
 import java.net.ProxySelector;
@@ -22,7 +22,7 @@ import java.net.URL;
 import java.time.LocalDateTime;
 import java.time.ZoneOffset;
 import java.time.format.DateTimeFormatter;
-import java.util.LinkedList;
+import java.util.ArrayList;
 import java.util.Map;
 import java.util.TreeMap;
 
@@ -266,7 +266,7 @@ public class LfsConnectionFactory {
                Protocol.Request req = new Protocol.Request();
                req.operation = operation;
                if (resources != null) {
-                       req.objects = new LinkedList<>();
+                       req.objects = new ArrayList<>();
                        for (LfsPointer res : resources) {
                                Protocol.ObjectSpec o = new Protocol.ObjectSpec();
                                o.oid = res.getOid().getName();
index 210e17277fdcfe2041bd073a8e6e8f160df9ff0e..2a9f7acdb958fcab720f497da2ef63b84e8c5456 100644 (file)
@@ -19,10 +19,10 @@ import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
-import java.util.Vector;
 
 /**
  * List of all commands known by jgit's command line tools.
@@ -104,7 +104,7 @@ public class CommandCatalog {
                        final String pfx = "META-INF/services/"; //$NON-NLS-1$
                        return ldr.getResources(pfx + TextBuiltin.class.getName());
                } catch (IOException err) {
-                       return new Vector<URL>().elements();
+                       return Collections.emptyEnumeration();
                }
        }
 
index a00e5d96ac96adb77a24722d7fa945bfb9f36b0c..96829b73654cb9a6a2aef7b5fc852b8ba83e8245 100644 (file)
@@ -18,9 +18,9 @@ import java.io.BufferedReader;
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -65,7 +65,7 @@ public class KnownHostEntryReader {
         */
        public static List<KnownHostEntry> readFromFile(Path path)
                        throws IOException {
-               List<KnownHostEntry> result = new LinkedList<>();
+               List<KnownHostEntry> result = new ArrayList<>();
                try (BufferedReader r = Files.newBufferedReader(path, UTF_8)) {
                        r.lines().forEachOrdered(l -> {
                                if (l == null) {
index 65ba5be0c5ac63b5ecdd66d23ef4ce35fbd8e374..2b4f7e50ff476a5ed3100a590e2ef8dbb1a12e75 100644 (file)
@@ -31,7 +31,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Random;
@@ -587,7 +586,7 @@ public class OpenSshServerKeyDatabase
                                if (rawEntries == null || rawEntries.isEmpty()) {
                                        return Collections.emptyList();
                                }
-                               List<HostEntryPair> newEntries = new LinkedList<>();
+                               List<HostEntryPair> newEntries = new ArrayList<>();
                                for (KnownHostEntry entry : rawEntries) {
                                        AuthorizedKeyEntry keyPart = entry.getKeyEntry();
                                        if (keyPart == null) {
index b94ccc6d4fa70e6ec3dcb7d8e250016793017dee..96316ba1aaf40d367b2eae9a1da2e16e89a2ff1b 100644 (file)
@@ -23,7 +23,6 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.EnumSet;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.CopyOnWriteArrayList;
@@ -263,7 +262,7 @@ public class SshdSession implements RemoteSession2 {
        private List<URIish> parseProxyJump(String proxyJump)
                        throws URISyntaxException {
                String[] hops = proxyJump.split(","); //$NON-NLS-1$
-               List<URIish> result = new LinkedList<>();
+               List<URIish> result = new ArrayList<>();
                for (String hop : hops) {
                        // There shouldn't be any whitespace, but let's be lenient
                        hop = hop.trim();
index 0c0257df9002635f6d5375e5ae253b7c5e75c6f3..5c63c2df6b50dd663e9440f368388aca02aeaad3 100644 (file)
@@ -42,7 +42,6 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Iterator;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
@@ -124,16 +123,16 @@ public class ConfigTest {
        @Test
        public void test005_PutGetStringList() {
                Config c = new Config();
-               final LinkedList<String> values = new LinkedList<>();
+               List<String> values = new ArrayList<>();
                values.add("value1");
                values.add("value2");
                c.setStringList("my", null, "somename", values);
 
-               final Object[] expArr = values.toArray();
-               final String[] actArr = c.getStringList("my", null, "somename");
+               Object[] expArr = values.toArray();
+               String[] actArr = c.getStringList("my", null, "somename");
                assertArrayEquals(expArr, actArr);
 
-               final String expText = "[my]\n\tsomename = value1\n\tsomename = value2\n";
+               String expText = "[my]\n\tsomename = value1\n\tsomename = value2\n";
                assertEquals(expText, c.toText());
        }
 
index 49f832a1aa1c44fe07fa3aca7ec85a7338f0c5ce..e4bd8506e3786f69f5cf8ec1457268816312011b 100644 (file)
@@ -11,7 +11,7 @@ package org.eclipse.jgit.revplot;
 
 import static org.junit.Assert.assertEquals;
 
-import java.util.LinkedList;
+import java.util.ArrayList;
 import java.util.List;
 
 import org.eclipse.jgit.api.Git;
@@ -70,7 +70,7 @@ public class AbstractPlotRendererTest extends RepositoryTestCase {
        private static class TestPlotRenderer extends
                        AbstractPlotRenderer<PlotLane, Object> {
 
-               List<Integer> indentations = new LinkedList<>();
+               List<Integer> indentations = new ArrayList<>();
 
                @Override
                protected int drawLabel(int x, int y, Ref ref) {
index 37f951449449fa15a4ece5239dce0796c1b4809e..f71781dcf360590f3660fc0069ae241337839e9c 100644 (file)
@@ -16,9 +16,9 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 import java.net.HttpURLConnection;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
@@ -74,7 +74,7 @@ public class JDKHttpConnectionTest {
        }
 
        private void assertValues(String key, String... values) {
-               List<String> l = new LinkedList<>();
+               List<String> l = new ArrayList<>();
                List<String> hf = c.getHeaderFields(key);
                if (hf != null) {
                        l.addAll(hf);
index 5a2bd976c7523c34dc52c0865f5d5d1896b914f7..18faab5c9f3d21b882af136316e184739c53ec91 100644 (file)
@@ -10,7 +10,7 @@
 package org.eclipse.jgit.util.http;
 
 import java.net.HttpCookie;
-import java.util.LinkedList;
+import java.util.ArrayList;
 import java.util.List;
 
 import org.hamcrest.Description;
@@ -26,7 +26,7 @@ public final class HttpCookiesMatcher {
 
        public static Matcher<Iterable<? extends HttpCookie>> containsInOrder(
                        Iterable<HttpCookie> expectedCookies, int allowedMaxAgeDelta) {
-               final List<Matcher<? super HttpCookie>> cookieMatchers = new LinkedList<>();
+               final List<Matcher<? super HttpCookie>> cookieMatchers = new ArrayList<>();
                for (HttpCookie cookie : expectedCookies) {
                        cookieMatchers
                                        .add(new HttpCookieMatcher(cookie, allowedMaxAgeDelta));
index 47acc11e7d32f76ecd8c9c3610cdf4202964e551..901452617d36ee2e3fe94e6ad76b5d02e266497c 100644 (file)
 package org.eclipse.jgit.awtui;
 
 import java.awt.Color;
-import java.util.LinkedList;
+import java.util.ArrayDeque;
+import java.util.Deque;
 
 import org.eclipse.jgit.revplot.PlotCommitList;
 import org.eclipse.jgit.revplot.PlotLane;
 
 class SwingCommitList extends PlotCommitList<SwingCommitList.SwingLane> {
-       final LinkedList<Color> colors;
+       final Deque<Color> colors;
 
        SwingCommitList() {
-               colors = new LinkedList<>();
+               colors = new ArrayDeque<>();
                repackColors();
        }
 
index a03ea018643790ad8dcfa6973e57d0cefe78a200..c133219d4d574c15b14cb941f76c8da3a6fcc0f8 100644 (file)
@@ -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
index a1c64788bd57c54288188623c9fe370c4377d67a..a353d1a1358a5ac8455d9d5864da8b801a4f5807 100644 (file)
@@ -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)) {
index 483b9602daa627e2f0a672d9d75727d4afc6c9ed..a1a2cc09d22b4002db6fa29346264c8caed97622 100644 (file)
@@ -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;
 
index ed4a5342b3aa220776ef946136536d6749e4a3a3..7064f5a57a92e262e928f8f3a5dd1a5b870af5a0 100644 (file)
@@ -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;
 
index 757aff89c3e89a18693dd4b74bbdb81f199f72b7..858bd961cdaeffb0adc3a5274ca8b8d4f4028e7c 100644 (file)
@@ -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)) {
index 225c9996cfcb8720ee33699ba791868865266545..47145a0563de988bb4b808974c6277b6b3dd8251 100644 (file)
@@ -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;
 
index 5231d4a327b8eee2de08a6e26f47876dd11bfba4..855c3b1cf308ce03c31746685b09b8c7ea30ecaa 100644 (file)
@@ -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;
 
index 656f36a81a37735d1a75aeac47f11ac8609edd4d..7459e7298f1a957a524baa70b6a5622d249f2322 100644 (file)
@@ -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<>();
        }
 
        /**
index eab389460a90f4416bb6f6a33145b9bde034bc8e..cdd078ea250de981b766c163b2235700dc38d053 100644 (file)
@@ -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;
        }
index 0224b3dbb35622f7425d59e1a12cd65a85f22dfa..55387111925cfc7efd92a41b785118d78990a77c 100644 (file)
@@ -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;
        }
index 1f1c35ac19ddb59d1e2d9bde446e1f8a266f772f..0d9815ecebada4737a122480830722a61d8fc330 100644 (file)
@@ -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();
index a342796cbef746e4618cd1ae67b353717cac52e8..c939114f5faa433254584ad976f46c250f03a5f3 100644 (file)
@@ -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);
                }
index 4c996730e8d7e4e703d77ab6435ac94273b551ea..cf26f8d284eeae93997e972b7f88ff0a775d2721 100644 (file)
@@ -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();
index 1da805503d09dc6a8478367749d17d204b0e4a64..08d2b7178f287fdee79125beb3aea2b6b50137dd 100644 (file)
@@ -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<>();
 
index 169dce1cc0d926e20c491669c735d86c5923180b..8e57bf9f2fcf887248e8c411a1913d2403fa033c 100644 (file)
@@ -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)
index acc1c830d586d0d8ebb42e6ffc69bb54b3abddef..72434dbffebe6e98e2ff75a2ef151ea58c553284 100644 (file)
@@ -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);
index 9a3f4b07eee7fcef316f196e1bea64ec9f60a312..03d6f16733428589e823667bcab0ed791c6650da 100644 (file)
 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) {
index 29a2922136d71563cb227325248298846fe76747..3e75a9dde33c351100b2d0416bd5ba8705ed6b9a 100644 (file)
@@ -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
index c716f464d31eb88a5c7dac2848544771600f46c9..b036a0b6a15a4df81ae2e0945d51871ee1a2f1cf 100644 (file)
@@ -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);
index 825ef17c3fd5e67542b29a8da7bc61d1a94e5fbf..1ad41be42361a4db91adb283be6fc0782fe941fc 100644 (file)
@@ -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;
 
index a213dd47c69387bad9496dd487157b1c55286286..be29dc31389f9abfa7067d4c9055ed86f048c514 100644 (file)
@@ -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;
 
index 4a02d6d452600c7cdc5930c37915e158147f6a4c..b335675da5a55449907a8335c9eb22c188adf26a 100644 (file)
@@ -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) {
index 3162b89908385cb9074098787cae444a86977c94..a65d0b756c1b1fce77332e01e01016566401f39d 100644 (file)
@@ -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));
index 8d89107c2be87215ce6e0ce8e2dec0160873de1d..3da76f38fa4b009c15154e638372491f41b862e5 100644 (file)
@@ -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;
        }
 
index 8e9be1dde86ee47581f521467583e3a86ec67db9..e20acadc4a57df4a5c2a479d124db36f19cb08ef 100644 (file)
@@ -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()));
index 699ff6b68b293a25cef5d1cc87fe854c0f311d84..cfdc4dd3583860c5d6a61562cd59573796866b81 100644 (file)
@@ -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;
        }
index b37f28b1618cfebfe7da0e6a0c53b7aa3afd1df2..c3a1c4e3bb86336a0e65e64a8760bc2328685d55 100644 (file)
@@ -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.
index dbec43b7fa8441dd8ee4d8f986c90b9fe2c30ef3..38c7e7fb8fa633d8d8da6668d7ef5114aada1a6c 100644 (file)
@@ -222,7 +222,7 @@ java_package_configuration(
         "-Xep:JavaPeriodGetDays:ERROR",
         "-Xep:JavaTimeDefaultTimeZone:ERROR",
         "-Xep:JavaUtilDate:WARN",
-        "-Xep:JdkObsolete:WARN",
+        "-Xep:JdkObsolete:ERROR",
         "-Xep:JodaConstructors:ERROR",
         "-Xep:JodaDateTimeConstants:ERROR",
         "-Xep:JodaDurationWithMillis:ERROR",