summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm
diff options
context:
space:
mode:
authorRobin Rosenberg <robin.rosenberg@dewire.com>2012-09-22 01:15:39 +0200
committerRobin Rosenberg <robin.rosenberg@dewire.com>2012-09-22 01:21:00 +0200
commitc3f1fac03fdf3ed5165adfd22aa14a21e5876892 (patch)
tree6403e5f3175dbcdccfe0719a838527efd7d580fb /org.eclipse.jgit.pgm
parent46d42404d3913e626f86a4520032a689d207b4c8 (diff)
downloadjgit-c3f1fac03fdf3ed5165adfd22aa14a21e5876892.tar.gz
jgit-c3f1fac03fdf3ed5165adfd22aa14a21e5876892.zip
Suppress boxing warnings where we know they are ok
Invoke the wrapper types' valueOf via static imports. For booleans used in asserts, add a new assert in the JUnit utility package since out current version of JUnit does not have the assert(boolean, boolean) method. Change-Id: I9099bd8efbc8c133479344d51ce7dabed8958a2b
Diffstat (limited to 'org.eclipse.jgit.pgm')
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AbstractFetchCommand.java5
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/AmazonS3Client.java6
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Blame.java17
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java5
-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.java15
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/MakeCacheTree.java7
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ReadDirCache.java5
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowCacheTree.java7
-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
11 files changed, 58 insertions, 26 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 4633187d77..ed0236b811 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
@@ -47,6 +47,8 @@
package org.eclipse.jgit.pgm;
+import static java.lang.Character.valueOf;
+
import java.io.IOException;
import java.io.PrintWriter;
import java.text.MessageFormat;
@@ -82,7 +84,8 @@ abstract class AbstractFetchCommand extends TextBuiltin {
shownURI = true;
}
- outw.format(" %c %-17s %-10s -> %s", type, longType, src, dst);
+ outw.format(" %c %-17s %-10s -> %s", valueOf(type), longType,
+ src, dst);
outw.println();
}
} finally {
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 f137b10aca..8485ab5f38 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
@@ -44,6 +44,8 @@
package org.eclipse.jgit.pgm;
+import static java.lang.Integer.valueOf;
+
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
@@ -91,7 +93,9 @@ class AmazonS3Client extends TextBuiltin {
while (len > 0) {
final int n = in.read(tmp);
if (n < 0)
- throw new EOFException(MessageFormat.format(CLIText.get().expectedNumberOfbytes, len));
+ throw new EOFException(MessageFormat.format(
+ CLIText.get().expectedNumberOfbytes,
+ 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 a67c35d933..801e3972fa 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
@@ -46,6 +46,8 @@
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_STRING_LENGTH;
import java.io.File;
@@ -201,23 +203,23 @@ class Blame extends TextBuiltin {
maxSourceLine = Math.max(maxSourceLine, blame.getSourceLine(line));
}
- String pathFmt = MessageFormat.format(" %{0}s", pathWidth);
+ String pathFmt = MessageFormat.format(" %{0}s", valueOf(pathWidth));
String numFmt = MessageFormat.format(" %{0}d",
- 1 + (int) Math.log10(maxSourceLine + 1));
+ valueOf(1 + (int) Math.log10(maxSourceLine + 1)));
String lineFmt = MessageFormat.format(" %{0}d) ",
- 1 + (int) Math.log10(end + 1));
+ valueOf(1 + (int) Math.log10(end + 1)));
String authorFmt = MessageFormat.format(" (%-{0}s %{1}s",
- authorWidth, dateWidth);
+ valueOf(authorWidth), valueOf(dateWidth));
for (int line = begin; line < end; line++) {
outw.print(abbreviate(blame.getSourceCommit(line)));
if (showSourcePath)
outw.format(pathFmt, path(line));
if (showSourceLine)
- outw.format(numFmt, blame.getSourceLine(line) + 1);
+ outw.format(numFmt, valueOf(blame.getSourceLine(line) + 1));
if (!noAuthor)
outw.format(authorFmt, author(line), date(line));
- outw.format(lineFmt, line + 1);
+ outw.format(lineFmt, valueOf(line + 1));
outw.flush();
blame.getResultContents().writeLine(outs, line);
outs.flush();
@@ -314,7 +316,8 @@ class Blame extends TextBuiltin {
dateFmt.setTimeZone(author.getTimeZone());
if (!showRawTimestamp)
return dateFmt.format(author.getWhen());
- return String.format("%d %s", author.getWhen().getTime() / 1000L,
+ return String.format("%d %s",
+ 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 56564c71c2..0085888231 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
@@ -45,6 +45,7 @@
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;
@@ -229,12 +230,12 @@ class Diff extends TextBuiltin {
out.println("M\t" + ent.getNewPath());
break;
case COPY:
- out.format("C%1$03d\t%2$s\t%3$s", ent.getScore(), //
+ out.format("C%1$03d\t%2$s\t%3$s", valueOf(ent.getScore()), //
ent.getOldPath(), ent.getNewPath());
out.println();
break;
case RENAME:
- out.format("R%1$03d\t%2$s\t%3$s", ent.getScore(), //
+ out.format("R%1$03d\t%2$s\t%3$s", valueOf(ent.getScore()), //
ent.getOldPath(), ent.getNewPath());
out.println();
break;
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 f466517250..2c10cf98f5 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
@@ -44,6 +44,8 @@
package org.eclipse.jgit.pgm;
+import static java.lang.Character.valueOf;
+
import java.io.IOException;
import java.text.MessageFormat;
import java.util.ArrayList;
@@ -250,7 +252,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", flag, summary);
+ out.format(" %c %-17s", valueOf(flag), summary);
if (srcRef != null)
outw.format(" %s ->", abbreviateRef(srcRef, true));
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 ef297322df..2a67b389ed 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
@@ -43,6 +43,9 @@
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;
@@ -248,8 +251,10 @@ class DiffAlgorithms extends TextBuiltin {
outw.println(name + ": start at " + startId.name());
}
- outw.format(" %12d files, %8d commits\n", files, commits);
- outw.format(" N=%10d min lines, %8d max lines\n", minN, maxN);
+ outw.format(" %12d files, %8d commits\n", valueOf(files),
+ valueOf(commits));
+ outw.format(" N=%10d min lines, %8d max lines\n", valueOf(minN),
+ valueOf(maxN));
outw.format("%-25s %12s ( %12s %12s )\n", //
"Algorithm", "Time(ns)", "Time(ns) on", "Time(ns) on");
@@ -261,9 +266,9 @@ class DiffAlgorithms extends TextBuiltin {
for (Test test : all) {
outw.format("%-25s %12d ( %12d %12d )", //
test.algorithm.name, //
- test.runningTimeNanos, //
- test.minN.runningTimeNanos, //
- test.maxN.runningTimeNanos);
+ valueOf(test.runningTimeNanos), //
+ valueOf(test.minN.runningTimeNanos), //
+ 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 3961a7c156..4769f1159d 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
@@ -44,6 +44,8 @@
package org.eclipse.jgit.pgm.debug;
+import static java.lang.Integer.valueOf;
+
import java.io.IOException;
import java.text.MessageFormat;
@@ -61,8 +63,9 @@ class MakeCacheTree extends TextBuiltin {
}
private void show(final DirCacheTree tree) throws IOException {
- outw.println(MessageFormat.format(CLIText.get().cacheTreePathInfo
- , tree.getPathString(), tree.getEntrySpan(), tree.getChildCount()));
+ outw.println(MessageFormat.format(CLIText.get().cacheTreePathInfo,
+ tree.getPathString(), valueOf(tree.getEntrySpan()),
+ 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 83dacce6b5..9f6bcda2a1 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
@@ -44,6 +44,8 @@
package org.eclipse.jgit.pgm.debug;
+import static java.lang.Long.valueOf;
+
import java.text.MessageFormat;
import org.eclipse.jgit.pgm.CLIText;
@@ -58,6 +60,7 @@ class ReadDirCache extends TextBuiltin {
db.readDirCache();
final long end = System.currentTimeMillis();
outw.print(" ");
- outw.println(MessageFormat.format(CLIText.get().averageMSPerRead, (end - start) / cnt));
+ outw.println(MessageFormat.format(CLIText.get().averageMSPerRead,
+ 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 7b4b36aa42..9fa8c69954 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
@@ -44,6 +44,8 @@
package org.eclipse.jgit.pgm.debug;
+import static java.lang.Integer.valueOf;
+
import java.io.IOException;
import java.text.MessageFormat;
@@ -63,8 +65,9 @@ class ShowCacheTree extends TextBuiltin {
}
private void show(final DirCacheTree tree) throws IOException {
- outw.println(MessageFormat.format(CLIText.get().cacheTreePathInfo
- , tree.getPathString(), tree.getEntrySpan(), tree.getChildCount()));
+ outw.println(MessageFormat.format(CLIText.get().cacheTreePathInfo,
+ tree.getPathString(), valueOf(tree.getEntrySpan()),
+ 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 a710103e9d..040b2e50e7 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
@@ -46,6 +46,8 @@
package org.eclipse.jgit.pgm.debug;
+import static java.lang.Integer.valueOf;
+
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -69,7 +71,7 @@ class ShowDirCache extends TextBuiltin {
final int stage = ent.getStage();
outw.print(mode);
- outw.format(" %6d", len);
+ outw.format(" %6d", valueOf(len));
outw.print(' ');
outw.print(fmt.format(mtime));
outw.print(' ');
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 ab80037da3..df7058f138 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
@@ -43,6 +43,9 @@
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;
@@ -347,8 +350,8 @@ class TextHashFunctions extends TextBuiltin {
outw.println(name + ":");
}
outw.format(" %6d files; %5d avg. unique lines/file\n", //
- fileCnt, //
- lineCnt / fileCnt);
+ valueOf(fileCnt), //
+ valueOf(lineCnt / fileCnt));
outw.format("%-20s %-15s %9s\n", "Hash", "Fold", "Max Len");
outw.println("-----------------------------------------------");
String lastHashName = null;
@@ -359,7 +362,7 @@ class TextHashFunctions extends TextBuiltin {
outw.format("%-20s %-15s %9d\n", //
hashName, //
fun.fold.name, //
- fun.maxChainLength);
+ valueOf(fun.maxChainLength));
lastHashName = fun.hash.name;
}
outw.println();