summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm/src/org
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2023-09-22 01:30:04 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2023-09-25 22:06:13 +0200
commitd56ae55c836968e09d1ad887d4180ff6bccc5be7 (patch)
tree1a52e1e59f0b10cc5311485a56e56158abe07db5 /org.eclipse.jgit.pgm/src/org
parenta7edc7889c6f0a6441bdd5e030125dd795abfd2c (diff)
downloadjgit-d56ae55c836968e09d1ad887d4180ff6bccc5be7.tar.gz
jgit-d56ae55c836968e09d1ad887d4180ff6bccc5be7.zip
[errorprone] Fix BadImport
See https://errorprone.info/bugpattern/BadImport Change-Id: Iea98b15862ed0bc4bcad759a7240133769680808
Diffstat (limited to 'org.eclipse.jgit.pgm/src/org')
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java6
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java4
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java18
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java11
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeTool.java14
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Push.java4
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/DiffAlgorithms.java17
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/MakeCacheTree.java6
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadDirCache.java4
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCacheTree.java6
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowDirCache.java4
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java9
12 files changed, 43 insertions, 60 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java
index 1115d2d113..4440e26f6d 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java
@@ -14,8 +14,6 @@
package org.eclipse.jgit.pgm;
-import static java.lang.Character.valueOf;
-
import java.io.IOException;
import java.text.MessageFormat;
@@ -59,8 +57,8 @@ abstract class AbstractFetchCommand extends TextBuiltin {
shownURI = true;
}
- outw.format(" %c %-17s %-10s -> %s", valueOf(type), longType, //$NON-NLS-1$
- src, dst);
+ outw.format(" %c %-17s %-10s -> %s", Character.valueOf(type), //$NON-NLS-1$
+ longType, src, dst);
outw.println();
}
}
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java
index 9c0915c631..24a75a86e8 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java
@@ -11,8 +11,6 @@
package org.eclipse.jgit.pgm;
-import static java.lang.Integer.valueOf;
-
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
@@ -66,7 +64,7 @@ class AmazonS3Client extends TextBuiltin {
if (n < 0)
throw new EOFException(MessageFormat.format(
CLIText.get().expectedNumberOfbytes,
- valueOf(len)));
+ Integer.valueOf(len)));
outs.write(tmp, 0, n);
len -= n;
}
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 93d02c196c..d2285ae64a 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
@@ -13,8 +13,6 @@
package org.eclipse.jgit.pgm;
-import static java.lang.Integer.valueOf;
-import static java.lang.Long.valueOf;
import static org.eclipse.jgit.lib.Constants.OBJECT_ID_ABBREV_STRING_LENGTH;
import static org.eclipse.jgit.lib.Constants.OBJECT_ID_STRING_LENGTH;
@@ -197,13 +195,14 @@ class Blame extends TextBuiltin {
maxSourceLine = Math.max(maxSourceLine, blame.getSourceLine(line));
}
- String pathFmt = MessageFormat.format(" %{0}s", valueOf(pathWidth)); //$NON-NLS-1$
+ String pathFmt = MessageFormat.format(" %{0}s", //$NON-NLS-1$
+ Integer.valueOf(pathWidth));
String numFmt = MessageFormat.format(" %{0}d", //$NON-NLS-1$
- valueOf(1 + (int) Math.log10(maxSourceLine + 1)));
+ Integer.valueOf(1 + (int) Math.log10(maxSourceLine + 1)));
String lineFmt = MessageFormat.format(" %{0}d) ", //$NON-NLS-1$
- valueOf(1 + (int) Math.log10(end + 1)));
+ Integer.valueOf(1 + (int) Math.log10(end + 1)));
String authorFmt = MessageFormat.format(" (%-{0}s %{1}s", //$NON-NLS-1$
- valueOf(authorWidth), valueOf(dateWidth));
+ Integer.valueOf(authorWidth), Integer.valueOf(dateWidth));
for (int line = begin; line < end;) {
RevCommit c = blame.getSourceCommit(line);
@@ -220,12 +219,13 @@ class Blame extends TextBuiltin {
outw.format(pathFmt, path(line));
}
if (showSourceLine) {
- outw.format(numFmt, valueOf(blame.getSourceLine(line) + 1));
+ outw.format(numFmt,
+ Integer.valueOf(blame.getSourceLine(line) + 1));
}
if (!noAuthor) {
outw.format(authorFmt, author, date);
}
- outw.format(lineFmt, valueOf(line + 1));
+ outw.format(lineFmt, Integer.valueOf(line + 1));
outw.flush();
blame.getResultContents().writeLine(outs, line);
outs.flush();
@@ -339,7 +339,7 @@ class Blame extends TextBuiltin {
if (!showRawTimestamp)
return dateFmt.format(author.getWhen());
return String.format("%d %s", //$NON-NLS-1$
- valueOf(author.getWhen().getTime() / 1000L),
+ Long.valueOf(author.getWhen().getTime() / 1000L),
dateFmt.format(author.getWhen()));
}
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java
index 61979d1695..52665a1c71 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java
@@ -12,7 +12,6 @@
package org.eclipse.jgit.pgm;
-import static java.lang.Integer.valueOf;
import static org.eclipse.jgit.lib.Constants.HEAD;
import static org.eclipse.jgit.lib.Constants.OBJECT_ID_STRING_LENGTH;
@@ -228,13 +227,15 @@ class Diff extends TextBuiltin {
out.println("M\t" + ent.getNewPath()); //$NON-NLS-1$
break;
case COPY:
- out.format("C%1$03d\t%2$s\t%3$s", valueOf(ent.getScore()), // //$NON-NLS-1$
- ent.getOldPath(), ent.getNewPath());
+ out.format("C%1$03d\t%2$s\t%3$s", //$NON-NLS-1$
+ Integer.valueOf(ent.getScore()), ent.getOldPath(),
+ ent.getNewPath());
out.println();
break;
case RENAME:
- out.format("R%1$03d\t%2$s\t%3$s", valueOf(ent.getScore()), // //$NON-NLS-1$
- ent.getOldPath(), ent.getNewPath());
+ out.format("R%1$03d\t%2$s\t%3$s", //$NON-NLS-1$
+ Integer.valueOf(ent.getScore()), ent.getOldPath(),
+ ent.getNewPath());
out.println();
break;
}
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeTool.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeTool.java
index a382fab757..9d0b65c479 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeTool.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/MergeTool.java
@@ -41,7 +41,6 @@ import org.eclipse.jgit.errors.NoWorkTreeException;
import org.eclipse.jgit.errors.RevisionSyntaxException;
import org.eclipse.jgit.internal.diffmergetool.ExternalMergeTool;
import org.eclipse.jgit.internal.diffmergetool.FileElement;
-import org.eclipse.jgit.internal.diffmergetool.FileElement.Type;
import org.eclipse.jgit.internal.diffmergetool.MergeTools;
import org.eclipse.jgit.internal.diffmergetool.ToolException;
import org.eclipse.jgit.lib.Constants;
@@ -218,8 +217,8 @@ class MergeTool extends TextBuiltin {
FileElement base = null;
FileElement local = null;
FileElement remote = null;
- FileElement merged = new FileElement(mergedFilePath, Type.MERGED,
- db.getWorkTree());
+ FileElement merged = new FileElement(mergedFilePath,
+ FileElement.Type.MERGED, db.getWorkTree());
DirCache cache = db.readDirCache();
try (RevWalk revWalk = new RevWalk(db);
TreeWalk treeWalk = new TreeWalk(db,
@@ -249,7 +248,8 @@ class MergeTool extends TextBuiltin {
ObjectId id = entry.getObjectId();
switch (entry.getStage()) {
case DirCacheEntry.STAGE_1:
- base = new FileElement(mergedFilePath, Type.BASE);
+ base = new FileElement(mergedFilePath,
+ FileElement.Type.BASE);
DirCacheCheckout.getContent(db, mergedFilePath,
checkoutMetadata,
baseSource.open(mergedFilePath, id), opt,
@@ -257,7 +257,8 @@ class MergeTool extends TextBuiltin {
base.createTempFile(tempFilesParent)));
break;
case DirCacheEntry.STAGE_2:
- local = new FileElement(mergedFilePath, Type.LOCAL);
+ local = new FileElement(mergedFilePath,
+ FileElement.Type.LOCAL);
DirCacheCheckout.getContent(db, mergedFilePath,
checkoutMetadata,
localSource.open(mergedFilePath, id), opt,
@@ -265,7 +266,8 @@ class MergeTool extends TextBuiltin {
local.createTempFile(tempFilesParent)));
break;
case DirCacheEntry.STAGE_3:
- remote = new FileElement(mergedFilePath, Type.REMOTE);
+ remote = new FileElement(mergedFilePath,
+ FileElement.Type.REMOTE);
DirCacheCheckout.getContent(db, mergedFilePath,
checkoutMetadata,
remoteSource.open(mergedFilePath, id), opt,
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 6535d95e9a..b1a5daaa65 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
@@ -11,8 +11,6 @@
package org.eclipse.jgit.pgm;
-import static java.lang.Character.valueOf;
-
import java.io.IOException;
import java.text.MessageFormat;
import java.util.ArrayList;
@@ -233,7 +231,7 @@ class Push extends TextBuiltin {
private void printUpdateLine(final char flag, final String summary,
final String srcRef, final String destRef, final String message)
throws IOException {
- outw.format(" %c %-17s", valueOf(flag), summary); //$NON-NLS-1$
+ outw.format(" %c %-17s", Character.valueOf(flag), summary); //$NON-NLS-1$
if (srcRef != null)
outw.format(" %s ->", abbreviateRef(srcRef, true)); //$NON-NLS-1$
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 67300dcc6a..2bdca24336 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
@@ -10,9 +10,6 @@
package org.eclipse.jgit.pgm.debug;
-import static java.lang.Integer.valueOf;
-import static java.lang.Long.valueOf;
-
import java.io.File;
import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
@@ -216,10 +213,10 @@ class DiffAlgorithms extends TextBuiltin {
outw.println(name + ": start at " + startId.name()); //$NON-NLS-1$
}
- outw.format(" %12d files, %8d commits\n", valueOf(files), //$NON-NLS-1$
- valueOf(commits));
- outw.format(" N=%10d min lines, %8d max lines\n", valueOf(minN), //$NON-NLS-1$
- valueOf(maxN));
+ outw.format(" %12d files, %8d commits\n", Long.valueOf(files), //$NON-NLS-1$
+ Integer.valueOf(commits));
+ outw.format(" N=%10d min lines, %8d max lines\n", //$NON-NLS-1$
+ Integer.valueOf(minN), Integer.valueOf(maxN));
outw.format("%-25s %12s ( %12s %12s )\n", //$NON-NLS-1$
"Algorithm", "Time(ns)", "Time(ns) on", "Time(ns) on"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
@@ -231,9 +228,9 @@ class DiffAlgorithms extends TextBuiltin {
for (Test test : all) {
outw.format("%-25s %12d ( %12d %12d )", // //$NON-NLS-1$
test.algorithm.name, //
- valueOf(test.runningTimeNanos), //
- valueOf(test.minN.runningTimeNanos), //
- valueOf(test.maxN.runningTimeNanos));
+ Long.valueOf(test.runningTimeNanos), //
+ Long.valueOf(test.minN.runningTimeNanos), //
+ Long.valueOf(test.maxN.runningTimeNanos));
outw.println();
}
outw.println();
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/MakeCacheTree.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/MakeCacheTree.java
index 5188336890..eec10c774f 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/MakeCacheTree.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/MakeCacheTree.java
@@ -11,8 +11,6 @@
package org.eclipse.jgit.pgm.debug;
-import static java.lang.Integer.valueOf;
-
import java.io.IOException;
import java.text.MessageFormat;
@@ -33,8 +31,8 @@ class MakeCacheTree extends TextBuiltin {
private void show(DirCacheTree tree) throws IOException {
outw.println(MessageFormat.format(CLIText.get().cacheTreePathInfo,
- tree.getPathString(), valueOf(tree.getEntrySpan()),
- valueOf(tree.getChildCount())));
+ tree.getPathString(), Integer.valueOf(tree.getEntrySpan()),
+ Integer.valueOf(tree.getChildCount())));
for (int i = 0; i < tree.getChildCount(); i++)
show(tree.getChild(i));
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadDirCache.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadDirCache.java
index 6e0f915ff2..3d20e01d3c 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadDirCache.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadDirCache.java
@@ -11,8 +11,6 @@
package org.eclipse.jgit.pgm.debug;
-import static java.lang.Long.valueOf;
-
import java.text.MessageFormat;
import org.eclipse.jgit.pgm.Command;
@@ -30,6 +28,6 @@ class ReadDirCache extends TextBuiltin {
final long end = System.currentTimeMillis();
outw.print(" "); //$NON-NLS-1$
outw.println(MessageFormat.format(CLIText.get().averageMSPerRead,
- valueOf((end - start) / cnt)));
+ Long.valueOf((end - start) / cnt)));
}
}
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCacheTree.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCacheTree.java
index 057d20b8d6..da16b33701 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCacheTree.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCacheTree.java
@@ -11,8 +11,6 @@
package org.eclipse.jgit.pgm.debug;
-import static java.lang.Integer.valueOf;
-
import java.io.IOException;
import java.text.MessageFormat;
@@ -35,8 +33,8 @@ class ShowCacheTree extends TextBuiltin {
private void show(DirCacheTree tree) throws IOException {
outw.println(MessageFormat.format(CLIText.get().cacheTreePathInfo,
- tree.getPathString(), valueOf(tree.getEntrySpan()),
- valueOf(tree.getChildCount())));
+ tree.getPathString(), Integer.valueOf(tree.getEntrySpan()),
+ Integer.valueOf(tree.getChildCount())));
for (int i = 0; i < tree.getChildCount(); i++)
show(tree.getChild(i));
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowDirCache.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowDirCache.java
index 3633d880d7..96add0f188 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowDirCache.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowDirCache.java
@@ -13,8 +13,6 @@
package org.eclipse.jgit.pgm.debug;
-import static java.lang.Integer.valueOf;
-
import java.time.Instant;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
@@ -49,7 +47,7 @@ class ShowDirCache extends TextBuiltin {
final int stage = ent.getStage();
outw.print(mode);
- outw.format(" %6d", valueOf(len)); //$NON-NLS-1$
+ outw.format(" %6d", Integer.valueOf(len)); //$NON-NLS-1$
outw.print(' ');
if (millis) {
outw.print(mtime.toEpochMilli());
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 d7d31bd4b2..2ce1711404 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
@@ -10,9 +10,6 @@
package org.eclipse.jgit.pgm.debug;
-import static java.lang.Integer.valueOf;
-import static java.lang.Long.valueOf;
-
import java.io.File;
import java.lang.reflect.Field;
import java.security.MessageDigest;
@@ -313,8 +310,8 @@ class TextHashFunctions extends TextBuiltin {
outw.println(name + ":"); //$NON-NLS-1$
}
outw.format(" %6d files; %5d avg. unique lines/file\n", //$NON-NLS-1$
- valueOf(fileCnt), //
- valueOf(lineCnt / fileCnt));
+ Long.valueOf(fileCnt), //
+ Long.valueOf(lineCnt / fileCnt));
outw.format("%-20s %-15s %9s\n", "Hash", "Fold", "Max Len"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
outw.println("-----------------------------------------------"); //$NON-NLS-1$
String lastHashName = null;
@@ -325,7 +322,7 @@ class TextHashFunctions extends TextBuiltin {
outw.format("%-20s %-15s %9d\n", // //$NON-NLS-1$
hashName, //
fun.fold.name, //
- valueOf(fun.maxChainLength));
+ Integer.valueOf(fun.maxChainLength));
lastHashName = fun.hash.name;
}
outw.println();