From a57dd1c1649cb85a2d47690bcea8a6acdc68ce35 Mon Sep 17 00:00:00 2001 From: Robin Rosenberg Date: Sat, 15 Dec 2012 11:57:04 +0100 Subject: [PATCH] Declare essentially static methods as static Change-Id: I83ca25fb569c0dbc36eb374d5437fcf2b65a6f68 --- .../server/resolver/DefaultReceivePackFactory.java | 2 +- .../eclipse/jgit/http/test/FileResolverTest.java | 2 +- .../eclipse/jgit/http/test/ProtocolErrorTest.java | 2 +- .../src/org/eclipse/jgit/iplog/IPZillaQuery.java | 8 ++++---- .../src/org/eclipse/jgit/iplog/IpLogGenerator.java | 10 +++++----- .../src/org/eclipse/jgit/iplog/IpLogMeta.java | 2 +- .../org/eclipse/jgit/iplog/SimpleCookieManager.java | 2 +- .../jgit/junit/LocalDiskRepositoryTestCase.java | 4 ++-- .../src/org/eclipse/jgit/junit/TestRepository.java | 2 +- .../org/eclipse/jgit/pgm/AbstractFetchCommand.java | 5 +++-- .../src/org/eclipse/jgit/pgm/Clone.java | 4 ++-- .../src/org/eclipse/jgit/pgm/Daemon.java | 3 ++- .../src/org/eclipse/jgit/pgm/Push.java | 2 +- .../org/eclipse/jgit/pgm/debug/ShowPackDelta.java | 2 +- .../eclipse/jgit/pgm/debug/TextHashFunctions.java | 3 ++- .../tst/org/eclipse/jgit/api/AddCommandTest.java | 2 +- .../tst/org/eclipse/jgit/api/ApplyCommandTest.java | 2 +- .../tst/org/eclipse/jgit/api/BlameCommandTest.java | 2 +- .../tst/org/eclipse/jgit/api/CommitOnlyTest.java | 7 ++++--- .../tst/org/eclipse/jgit/api/HugeFileTest.java | 2 +- .../tst/org/eclipse/jgit/api/MergeCommandTest.java | 6 +++--- .../tst/org/eclipse/jgit/api/PullCommandTest.java | 5 +++-- .../eclipse/jgit/api/PullCommandWithRebaseTest.java | 5 +++-- .../org/eclipse/jgit/diff/DiffFormatterTest.java | 5 +++-- .../dircache/DirCacheCGitCompatabilityTest.java | 6 +++--- .../eclipse/jgit/dircache/DirCacheEntryTest.java | 2 +- .../eclipse/jgit/fnmatch/FileNameMatcherTest.java | 5 +++-- .../org/eclipse/jgit/ignore/IgnoreMatcherTest.java | 2 +- .../tst/org/eclipse/jgit/lib/BranchConfigTest.java | 2 +- .../tst/org/eclipse/jgit/lib/ConfigTest.java | 7 ++++--- .../tst/org/eclipse/jgit/lib/T0002_TreeTest.java | 3 ++- .../tst/org/eclipse/jgit/merge/CherryPickTest.java | 5 +++-- .../tst/org/eclipse/jgit/merge/SimpleMergeTest.java | 5 +++-- .../eclipse/jgit/storage/file/FileSnapshotTest.java | 4 ++-- .../org/eclipse/jgit/storage/file/PackFileTest.java | 12 ++++++------ .../eclipse/jgit/storage/file/PackWriterTest.java | 4 ++-- .../eclipse/jgit/storage/file/RefUpdateTest.java | 2 +- .../eclipse/jgit/storage/file/ReflogReaderTest.java | 2 +- .../storage/file/RepositorySetupWorkDirTest.java | 13 +++++++------ .../jgit/storage/file/UnpackedObjectTest.java | 7 ++++--- .../jgit/storage/file/WindowCacheGetTest.java | 2 +- .../eclipse/jgit/transport/BundleWriterTest.java | 2 +- .../org/eclipse/jgit/transport/PackParserTest.java | 7 ++++--- .../transport/ReceivePackAdvertiseRefsHookTest.java | 11 ++++++----- .../eclipse/jgit/treewalk/FileTreeIteratorTest.java | 2 +- .../jgit/treewalk/TreeWalkBasicDiffTest.java | 1 + .../jgit/treewalk/filter/IndexDiffFilterTest.java | 4 ++-- .../jgit/util/QuotedStringGitPathStyleTest.java | 2 +- .../util/RawParseUtils_ParsePersonIdentTest.java | 2 +- .../tst/org/eclipse/jgit/util/RefListTest.java | 2 +- .../tst/org/eclipse/jgit/util/RefMapTest.java | 2 +- .../jgit/util/RelativeDateFormatterTest.java | 2 +- .../util/io/EolCanonicalizingInputStreamTest.java | 3 ++- .../eclipse/jgit/awtui/AwtCredentialsProvider.java | 2 +- 54 files changed, 116 insertions(+), 98 deletions(-) diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultReceivePackFactory.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultReceivePackFactory.java index 38a3ec2f1..df876ba43 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultReceivePackFactory.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultReceivePackFactory.java @@ -104,7 +104,7 @@ public class DefaultReceivePackFactory implements throw new ServiceNotAuthorizedException(); } - private ReceivePack createFor(final HttpServletRequest req, + private static ReceivePack createFor(final HttpServletRequest req, final Repository db, final String user) { final ReceivePack rp = new ReceivePack(db); rp.setRefLogIdent(toPersonIdent(req, user)); diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/FileResolverTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/FileResolverTest.java index cafb9590e..8d0ba964c 100644 --- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/FileResolverTest.java +++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/FileResolverTest.java @@ -81,7 +81,7 @@ public class FileResolverTest extends LocalDiskRepositoryTestCase { assertUnreasonable("C:/windows"); } - private void assertUnreasonable(String name) + private static void assertUnreasonable(String name) throws ServiceNotEnabledException { FileResolver r = new FileResolver( new File("."), false); diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/ProtocolErrorTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/ProtocolErrorTest.java index 22b1025cc..b62ed7fab 100644 --- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/ProtocolErrorTest.java +++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/ProtocolErrorTest.java @@ -176,7 +176,7 @@ public class ProtocolErrorTest extends HttpTestCase { } } - private void packHeader(ByteArrayOutputStream tinyPack, int cnt) + private static void packHeader(ByteArrayOutputStream tinyPack, int cnt) throws IOException { final byte[] hdr = new byte[8]; NB.encodeInt32(hdr, 0, 2); diff --git a/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IPZillaQuery.java b/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IPZillaQuery.java index b8db84a89..23fdf68a8 100644 --- a/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IPZillaQuery.java +++ b/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IPZillaQuery.java @@ -156,7 +156,7 @@ class IPZillaQuery { } } - private BufferedReader reader(HttpURLConnection conn) + private static BufferedReader reader(HttpURLConnection conn) throws UnsupportedEncodingException, IOException { String encoding = conn.getContentEncoding(); InputStream in = conn.getInputStream(); @@ -206,7 +206,7 @@ class IPZillaQuery { } } - private String readFully(HttpURLConnection c) throws IOException { + private static String readFully(HttpURLConnection c) throws IOException { String enc = c.getContentEncoding(); Reader reader; if (enc != null) { @@ -240,7 +240,7 @@ class IPZillaQuery { return c; } - private void setCookie(URL url, String name, String value) + private static void setCookie(URL url, String name, String value) throws IOException { Map> cols = new HashMap>(); cols.put("Set-Cookie", Collections.singletonList(name + "=" + value)); @@ -253,7 +253,7 @@ class IPZillaQuery { } } - private CQ parseOneCQ(Map row) { + private static CQ parseOneCQ(Map row) { long id = Long.parseLong(row.get("bug_id")); String state = row.get("bug_severity"); String bug_status = row.get("bug_status"); diff --git a/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java b/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java index 06d5393ca..eea8a688e 100644 --- a/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java +++ b/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java @@ -273,7 +273,7 @@ public class IpLogGenerator { } } - private Date parseDate(SimpleDateFormat dt, String value) + private static Date parseDate(SimpleDateFormat dt, String value) throws IOException { if ("NULL".equals(value) || "".equals(value) || value == null) return null; @@ -524,7 +524,7 @@ public class IpLogGenerator { return project; } - private void populateProjectType(Project p, Element project) { + private static void populateProjectType(Project p, Element project) { required(project, "id", p.getID()); required(project, "name", p.getName()); optional(project, "comments", p.getComments()); @@ -557,7 +557,7 @@ public class IpLogGenerator { return r; } - private String mapCQState(String state) { + private static String mapCQState(String state) { // "approved" CQs shall be listed as "active" in the iplog if (state.equals("approved")) return "active"; @@ -602,13 +602,13 @@ public class IpLogGenerator { return doc.createElementNS(IPLOG_NS, IPLOG_PFX + name); } - private void required(Element r, String name, String value) { + private static void required(Element r, String name, String value) { if (value == null) value = ""; r.setAttribute(name, value); } - private void optional(Element r, String name, String value) { + private static void optional(Element r, String name, String value) { if (value != null && value.length() > 0) r.setAttribute(name, value); } diff --git a/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogMeta.java b/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogMeta.java index ba10f6f24..c491d67cc 100644 --- a/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogMeta.java +++ b/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogMeta.java @@ -142,7 +142,7 @@ public class IpLogMeta { reviewUrl = cfg.getString(S_REVIEW, null, K_URL); } - private List parseProjects(final Config cfg, + private static List parseProjects(final Config cfg, final String sectionName) { final List dst = new ArrayList(); for (String id : cfg.getSubsections(sectionName)) { diff --git a/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/SimpleCookieManager.java b/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/SimpleCookieManager.java index dca6f1505..d6b3a3698 100644 --- a/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/SimpleCookieManager.java +++ b/org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/SimpleCookieManager.java @@ -112,7 +112,7 @@ public class SimpleCookieManager extends CookieHandler { } } - private String hostOf(URI uri) { + private static String hostOf(URI uri) { StringBuilder key = new StringBuilder(); key.append(uri.getScheme()); key.append(':'); diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java index 676698a8e..1614c379e 100644 --- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java +++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/LocalDiskRepositoryTestCase.java @@ -162,7 +162,7 @@ public abstract class LocalDiskRepositoryTestCase { mockSystemReader.setProperty(Constants.GIT_CEILING_DIRECTORIES_KEY, makePath(ceilings)); } - private String makePath(List objects) { + private static String makePath(List objects) { final StringBuilder stringBuilder = new StringBuilder(); for (Object object : objects) { if (stringBuilder.length() > 0) @@ -303,7 +303,7 @@ public abstract class LocalDiskRepositoryTestCase { toClose.add(r); } - private String createUniqueTestFolderPrefix() { + private static String createUniqueTestFolderPrefix() { return "test" + (System.currentTimeMillis() + "_" + (testCount++)); } diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java index cc4852a2b..9c7570ef6 100644 --- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java +++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java @@ -673,7 +673,7 @@ public class TestRepository { } } - private void prunePacked(ObjectDirectory odb) throws IOException { + private static void prunePacked(ObjectDirectory odb) throws IOException { for (PackFile p : odb.getPacks()) { for (MutableEntry e : p) FileUtils.delete(odb.fileFor(e.toObjectId())); 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 e4bca2a49..ad9a36db1 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 @@ -128,7 +128,8 @@ abstract class AbstractFetchCommand extends TextBuiltin { writer.flush(); } - private String longTypeOf(ObjectReader reader, final TrackingRefUpdate u) { + private static String longTypeOf(ObjectReader reader, + final TrackingRefUpdate u) { final RefUpdate.Result r = u.getResult(); if (r == RefUpdate.Result.LOCK_FAILURE) return "[lock fail]"; @@ -164,7 +165,7 @@ abstract class AbstractFetchCommand extends TextBuiltin { return "[" + r.name() + "]"; //$NON-NLS-1$//$NON-NLS-2$ } - private String safeAbbreviate(ObjectReader reader, ObjectId id) { + private static String safeAbbreviate(ObjectReader reader, ObjectId id) { try { return reader.abbreviate(id).name(); } catch (IOException cannotAbbreviate) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java index ddae66e72..5406527a6 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Clone.java @@ -150,7 +150,7 @@ class Clone extends AbstractFetchCommand { return r; } - private Ref guessHEAD(final FetchResult result) { + private static Ref guessHEAD(final FetchResult result) { final Ref idHEAD = result.getAdvertisedRef(Constants.HEAD); final List availableRefs = new ArrayList(); Ref head = null; @@ -201,4 +201,4 @@ class Clone extends AbstractFetchCommand { } return commit; } -} \ No newline at end of file +} diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java index c75da9f89..8087efe7d 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Daemon.java @@ -155,7 +155,8 @@ class Daemon extends TextBuiltin { outw.println(MessageFormat.format(CLIText.get().listeningOn, d.getAddress())); } - private DaemonService service(final org.eclipse.jgit.transport.Daemon d, + private static DaemonService service( + final org.eclipse.jgit.transport.Daemon d, final String n) { final DaemonService svc = d.getService(n); if (svc == null) 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 8239c96d4..ea3cac722 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 @@ -241,7 +241,7 @@ class Push extends TextBuiltin { } } - private String safeAbbreviate(ObjectReader reader, ObjectId id) { + private static String safeAbbreviate(ObjectReader reader, ObjectId id) { try { return reader.abbreviate(id).name(); } catch (IOException cannotAbbreviate) { diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowPackDelta.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowPackDelta.java index fa9fd6e68..338929a1b 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowPackDelta.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/ShowPackDelta.java @@ -90,7 +90,7 @@ class ShowPackDelta extends TextBuiltin { outw.println(BinaryDelta.format(delta)); } - private byte[] getDelta(ObjectReader reader, RevObject obj) + private static byte[] getDelta(ObjectReader reader, RevObject obj) throws IOException, MissingObjectException, StoredObjectRepresentationNotAvailableException { ObjectReuseAsIs asis = (ObjectReuseAsIs) reader; 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 e2da0d5fc..aa46ea114 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 @@ -369,7 +369,8 @@ class TextHashFunctions extends TextBuiltin { outw.flush(); } - private void testOne(Function fun, RawText txt, int[] elements, int cnt) { + private static void testOne(Function fun, RawText txt, int[] elements, + int cnt) { final Hash cmp = fun.hash; final Fold fold = fun.fold; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java index ab2027ce7..f2377f160 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/AddCommandTest.java @@ -697,7 +697,7 @@ public class AddCommandTest extends RepositoryTestCase { assertEquals(FileMode.EXECUTABLE_FILE, walk.getFileMode(0)); } - private DirCacheEntry addEntryToBuilder(String path, File file, + private static DirCacheEntry addEntryToBuilder(String path, File file, ObjectInserter newObjectInserter, DirCacheBuilder builder, int stage) throws IOException { FileInputStream inputStream = new FileInputStream(file); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ApplyCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ApplyCommandTest.java index 3c38edb86..5513b4460 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ApplyCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ApplyCommandTest.java @@ -178,7 +178,7 @@ public class ApplyCommandTest extends RepositoryTestCase { b.getString(0, b.size(), false)); } - private byte[] readFile(final String patchFile) throws IOException { + private static byte[] readFile(final String patchFile) throws IOException { final InputStream in = DiffFormatterReflowTest.class .getResourceAsStream(patchFile); if (in == null) { diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/BlameCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/BlameCommandTest.java index 7e1c22cb7..fd726ba93 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/BlameCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/BlameCommandTest.java @@ -55,7 +55,7 @@ import org.junit.Test; */ public class BlameCommandTest extends RepositoryTestCase { - private String join(String... lines) { + private static String join(String... lines) { StringBuilder joined = new StringBuilder(); for (String line : lines) joined.append(line).append('\n'); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitOnlyTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitOnlyTest.java index aa0018bc2..24ca21a97 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitOnlyTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitOnlyTest.java @@ -1267,7 +1267,7 @@ public class CommitOnlyTest extends RepositoryTestCase { } } - private String expected_f3_head(final int state) { + private static String expected_f3_head(final int state) { switch (state) { case 0: case 1: @@ -1280,7 +1280,7 @@ public class CommitOnlyTest extends RepositoryTestCase { return null; } - private String expected_f3_idx(final int state) { + private static String expected_f3_idx(final int state) { switch (state) { case 0: case 3: @@ -1294,7 +1294,8 @@ public class CommitOnlyTest extends RepositoryTestCase { return null; } - private String getHead(final Git git, final String path) throws Exception { + static private String getHead(final Git git, final String path) + throws Exception { try { final Repository repo = git.getRepository(); final ObjectId headId = repo.resolve(Constants.HEAD + "^{commit}"); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/HugeFileTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/HugeFileTest.java index 10b6ba48b..273b09ded 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/HugeFileTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/HugeFileTest.java @@ -228,7 +228,7 @@ public class HugeFileTest extends RepositoryTestCase { assertEquals(0, status.getUntracked().size()); } - private void assertCollectionEquals(Collection asList, + private static void assertCollectionEquals(Collection asList, Collection added) { assertEquals(asList.toString(), added.toString()); } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java index 21ac3ad4e..589845ef6 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/MergeCommandTest.java @@ -1328,17 +1328,17 @@ public class MergeCommandTest extends RepositoryTestCase { assertEquals(StatusCommandTest.set("file2"), stat.getConflicting()); } - private void setExecutable(Git git, String path, boolean executable) { + private static void setExecutable(Git git, String path, boolean executable) { FS.DETECTED.setExecute( new File(git.getRepository().getWorkTree(), path), executable); } - private boolean canExecute(Git git, String path) { + private static boolean canExecute(Git git, String path) { return FS.DETECTED.canExecute(new File(git.getRepository() .getWorkTree(), path)); } - private RevCommit addAllAndCommit(final Git git) throws Exception { + private static RevCommit addAllAndCommit(final Git git) throws Exception { git.add().addFilepattern(".").call(); return git.commit().setMessage("message").call(); } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java index eaed8d8b8..53df60980 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java @@ -268,7 +268,8 @@ public class PullCommandTest extends RepositoryTestCase { assertFileContentsEqual(targetFile, "Hello world"); } - private void writeToFile(File actFile, String string) throws IOException { + private static void writeToFile(File actFile, String string) + throws IOException { FileOutputStream fos = null; try { fos = new FileOutputStream(actFile); @@ -280,7 +281,7 @@ public class PullCommandTest extends RepositoryTestCase { } } - private void assertFileContentsEqual(File actFile, String string) + private static void assertFileContentsEqual(File actFile, String string) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); FileInputStream fis = null; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java index 2f2faf822..697813647 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandWithRebaseTest.java @@ -340,7 +340,8 @@ public class PullCommandWithRebaseTest extends RepositoryTestCase { assertFileContentsEqual(targetFile, "Hello world"); } - private void writeToFile(File actFile, String string) throws IOException { + private static void writeToFile(File actFile, String string) + throws IOException { FileOutputStream fos = null; try { fos = new FileOutputStream(actFile); @@ -352,7 +353,7 @@ public class PullCommandWithRebaseTest extends RepositoryTestCase { } } - private void assertFileContentsEqual(File actFile, String string) + private static void assertFileContentsEqual(File actFile, String string) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); FileInputStream fis = null; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterTest.java index efdaa7bd7..4c9841849 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterTest.java @@ -288,7 +288,8 @@ public class DiffFormatterTest extends RepositoryTestCase { assertEquals(expected.toString(), actual); } - private String makeDiffHeader(String pathA, String pathB, ObjectId aId, + private static String makeDiffHeader(String pathA, String pathB, + ObjectId aId, ObjectId bId) { String a = aId.abbreviate(8).name(); String b = bId.abbreviate(8).name(); @@ -298,7 +299,7 @@ public class DiffFormatterTest extends RepositoryTestCase { "+++ b/" + pathB + "\n"; } - private String makeDiffHeaderModeChange(String pathA, String pathB, + private static String makeDiffHeaderModeChange(String pathA, String pathB, ObjectId aId, ObjectId bId, String modeA, String modeB) { String a = aId.abbreviate(8).name(); String b = bId.abbreviate(8).name(); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java index 36ebd6f22..53d672d7f 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheCGitCompatabilityTest.java @@ -227,11 +227,11 @@ public class DirCacheCGitCompatabilityTest extends LocalDiskRepositoryTestCase { assertEquals(intentToAdd, entry.isIntentToAdd()); } - private File pathOf(final String name) { + private static File pathOf(final String name) { return JGitTestUtil.getTestResourceFile(name); } - private Map readLsFiles() throws Exception { + private static Map readLsFiles() throws Exception { final LinkedHashMap r = new LinkedHashMap(); final BufferedReader br = new BufferedReader(new InputStreamReader( new FileInputStream(pathOf("gitgit.lsfiles")), "UTF-8")); @@ -247,7 +247,7 @@ public class DirCacheCGitCompatabilityTest extends LocalDiskRepositoryTestCase { return r; } - private Map readLsTree() throws Exception { + private static Map readLsTree() throws Exception { final LinkedHashMap r = new LinkedHashMap(); final BufferedReader br = new BufferedReader(new InputStreamReader( new FileInputStream(pathOf("gitgit.lstree")), "UTF-8")); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheEntryTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheEntryTest.java index 7ba7ca052..225ce2a90 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheEntryTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/dircache/DirCacheEntryTest.java @@ -176,7 +176,7 @@ public class DirCacheEntryTest { copyMetaDataHelper(true); } - private void copyMetaDataHelper(final boolean keepStage) { + private static void copyMetaDataHelper(final boolean keepStage) { DirCacheEntry e = new DirCacheEntry("some/path", DirCacheEntry.STAGE_2); e.setAssumeValid(false); e.setCreationTime(2L); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/fnmatch/FileNameMatcherTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/fnmatch/FileNameMatcherTest.java index 13c8cbef5..ec0724406 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/fnmatch/FileNameMatcherTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/fnmatch/FileNameMatcherTest.java @@ -54,7 +54,7 @@ import org.junit.Test; public class FileNameMatcherTest { - private void assertMatch(final String pattern, final String input, + private static void assertMatch(final String pattern, final String input, final boolean matchExpected, final boolean appendCanMatchExpected) throws InvalidPatternException { final FileNameMatcher matcher = new FileNameMatcher(pattern, null); @@ -63,7 +63,8 @@ public class FileNameMatcherTest { assertEquals(appendCanMatchExpected, matcher.canAppendMatch()); } - private void assertFileNameMatch(final String pattern, final String input, + private static void assertFileNameMatch(final String pattern, + final String input, final char excludedCharacter, final boolean matchExpected, final boolean appendCanMatchExpected) throws InvalidPatternException { diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreMatcherTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreMatcherTest.java index 7e771dc99..d911efc1d 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreMatcherTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreMatcherTest.java @@ -378,7 +378,7 @@ public class IgnoreMatcherTest { * @return * Result of {@link IgnoreRule#isMatch(String, boolean)} */ - private boolean match(String pattern, String target) { + private static boolean match(String pattern, String target) { IgnoreRule r = new IgnoreRule(pattern); //If speed of this test is ever an issue, we can use a presetRule field //to avoid recompiling a pattern each time. diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/BranchConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/BranchConfigTest.java index 4895d3cf1..63441bfe9 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/BranchConfigTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/BranchConfigTest.java @@ -144,7 +144,7 @@ public class BranchConfigTest { branchConfig.getTrackingBranch()); } - private Config parse(final String content) { + private static Config parse(final String content) { final Config c = new Config(null); try { c.fromText(content); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java index 63f9476d9..e67560929 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/ConfigTest.java @@ -465,17 +465,18 @@ public class ConfigTest { assertEquals(result, config.toText()); } - private void assertReadLong(long exp) throws ConfigInvalidException { + private static void assertReadLong(long exp) throws ConfigInvalidException { assertReadLong(exp, String.valueOf(exp)); } - private void assertReadLong(long exp, String act) + private static void assertReadLong(long exp, String act) throws ConfigInvalidException { final Config c = parse("[s]\na = " + act + "\n"); assertEquals(exp, c.getLong("s", null, "a", 0L)); } - private Config parse(final String content) throws ConfigInvalidException { + private static Config parse(final String content) + throws ConfigInvalidException { final Config c = new Config(null); c.fromText(content); return c; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0002_TreeTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0002_TreeTest.java index dd7d335c8..dca34a0e1 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0002_TreeTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/T0002_TreeTest.java @@ -61,7 +61,8 @@ public class T0002_TreeTest extends SampleDataRepositoryTestCase { private static final ObjectId SOME_FAKE_ID = ObjectId.fromString( "0123456789abcdef0123456789abcdef01234567"); - private int compareNamesUsingSpecialCompare(String a,String b) throws UnsupportedEncodingException { + private static int compareNamesUsingSpecialCompare(String a, String b) + throws UnsupportedEncodingException { char lasta = '\0'; byte[] abytes; if (a.length() > 0 && a.charAt(a.length()-1) == '/') { diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/CherryPickTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/CherryPickTest.java index 8b4a5f4db..905f215f2 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/CherryPickTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/CherryPickTest.java @@ -183,12 +183,13 @@ public class CherryPickTest extends RepositoryTestCase { assertFalse(tw.next()); } - private void assertCorrectId(final DirCache treeT, final TreeWalk tw) { + private static void assertCorrectId(final DirCache treeT, final TreeWalk tw) { assertEquals(treeT.getEntry(tw.getPathString()).getObjectId(), tw .getObjectId(0)); } - private ObjectId commit(final ObjectInserter odi, final DirCache treeB, + private static ObjectId commit(final ObjectInserter odi, + final DirCache treeB, final ObjectId[] parentIds) throws Exception { final CommitBuilder c = new CommitBuilder(); c.setTreeId(treeB.writeTree(odi)); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SimpleMergeTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SimpleMergeTest.java index 81add8409..4f9c22eb1 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SimpleMergeTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/SimpleMergeTest.java @@ -373,12 +373,13 @@ public class SimpleMergeTest extends SampleDataRepositoryTestCase { assertFalse(merge); } - private void assertCorrectId(final DirCache treeT, final TreeWalk tw) { + private static void assertCorrectId(final DirCache treeT, final TreeWalk tw) { assertEquals(treeT.getEntry(tw.getPathString()).getObjectId(), tw .getObjectId(0)); } - private ObjectId commit(final ObjectInserter odi, final DirCache treeB, + private static ObjectId commit(final ObjectInserter odi, + final DirCache treeB, final ObjectId[] parentIds) throws Exception { final CommitBuilder c = new CommitBuilder(); c.setTreeId(treeB.writeTree(odi)); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileSnapshotTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileSnapshotTest.java index 99d859384..22fc4c70c 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileSnapshotTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/FileSnapshotTest.java @@ -68,7 +68,7 @@ public class FileSnapshotTest { FileUtils.delete(trash, FileUtils.RECURSIVE | FileUtils.SKIP_MISSING); } - private void waitNextSec(File f) { + private static void waitNextSec(File f) { long initialLastModified = f.lastModified(); do { f.setLastModified(System.currentTimeMillis()); @@ -144,7 +144,7 @@ public class FileSnapshotTest { return f; } - private void append(File f, byte b) throws IOException { + private static void append(File f, byte b) throws IOException { FileOutputStream os = new FileOutputStream(f, true); try { os.write(b); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/PackFileTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/PackFileTest.java index ca46da2a6..11082bd1f 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/PackFileTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/PackFileTest.java @@ -303,14 +303,14 @@ public class PackFileTest extends LocalDiskRepositoryTestCase { in.close(); } - private byte[] clone(int first, byte[] base) { + private static byte[] clone(int first, byte[] base) { byte[] r = new byte[base.length]; System.arraycopy(base, 1, r, 1, r.length - 1); r[0] = (byte) first; return r; } - private byte[] delta(byte[] base, byte[] dest) throws IOException { + private static byte[] delta(byte[] base, byte[] dest) throws IOException { ByteArrayOutputStream tmp = new ByteArrayOutputStream(); DeltaEncoder de = new DeltaEncoder(tmp, base.length, dest.length); de.insert(dest, 0, 1); @@ -318,7 +318,7 @@ public class PackFileTest extends LocalDiskRepositoryTestCase { return tmp.toByteArray(); } - private void packHeader(TemporaryBuffer.Heap pack, int cnt) + private static void packHeader(TemporaryBuffer.Heap pack, int cnt) throws IOException { final byte[] hdr = new byte[8]; NB.encodeInt32(hdr, 0, 2); @@ -327,7 +327,7 @@ public class PackFileTest extends LocalDiskRepositoryTestCase { pack.write(hdr, 0, 8); } - private void objectHeader(TemporaryBuffer.Heap pack, int type, int sz) + private static void objectHeader(TemporaryBuffer.Heap pack, int type, int sz) throws IOException { byte[] buf = new byte[8]; int nextLength = sz >>> 4; @@ -342,7 +342,7 @@ public class PackFileTest extends LocalDiskRepositoryTestCase { pack.write(buf, 0, n); } - private void deflate(TemporaryBuffer.Heap pack, final byte[] content) + private static void deflate(TemporaryBuffer.Heap pack, final byte[] content) throws IOException { final Deflater deflater = new Deflater(); final byte[] buf = new byte[128]; @@ -356,7 +356,7 @@ public class PackFileTest extends LocalDiskRepositoryTestCase { deflater.end(); } - private void digest(TemporaryBuffer.Heap buf) throws IOException { + private static void digest(TemporaryBuffer.Heap buf) throws IOException { MessageDigest md = Constants.newMessageDigest(); md.update(buf.toByteArray()); buf.write(md.digest()); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/PackWriterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/PackWriterTest.java index f262d01ea..b6932db59 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/PackWriterTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/PackWriterTest.java @@ -479,7 +479,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase { contentB.getId())); } - private void assertContent(PackIndex pi, List expected) { + private static void assertContent(PackIndex pi, List expected) { assertEquals("Pack index has wrong size.", expected.size(), pi.getObjectCount()); for (int i = 0; i < pi.getObjectCount(); i++) @@ -489,7 +489,7 @@ public class PackWriterTest extends SampleDataRepositoryTestCase { expected.contains(pi.getObjectId(i))); } - private PackIndex writePack(FileRepository repo, + private static PackIndex writePack(FileRepository repo, Set want, Set excludeObjects) throws IOException { PackWriter pw = new PackWriter(repo); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RefUpdateTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RefUpdateTest.java index 8bc454a58..0cce2cf25 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RefUpdateTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RefUpdateTest.java @@ -863,7 +863,7 @@ public class RefUpdateTest extends SampleDataRepositoryTestCase { "HEAD").getReverseEntries().get(0).getComment()); } - private void writeReflog(Repository db, ObjectId newId, String msg, + private static void writeReflog(Repository db, ObjectId newId, String msg, String refName) throws IOException { RefDirectory refs = (RefDirectory) db.getRefDatabase(); RefDirectoryUpdate update = refs.newUpdate(refName, true); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/ReflogReaderTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/ReflogReaderTest.java index f3a6914be..8289fe468 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/ReflogReaderTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/ReflogReaderTest.java @@ -110,7 +110,7 @@ public class ReflogReaderTest extends SampleDataRepositoryTestCase { e.getComment()); } - private String iso(PersonIdent id) { + private static String iso(PersonIdent id) { final SimpleDateFormat fmt; fmt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); fmt.setTimeZone(id.getTimeZone()); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RepositorySetupWorkDirTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RepositorySetupWorkDirTest.java index f98ae4957..8aaeb4970 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RepositorySetupWorkDirTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/RepositorySetupWorkDirTest.java @@ -183,7 +183,7 @@ public class RepositorySetupWorkDirTest extends LocalDiskRepositoryTestCase { } } - private File getFile(String... pathComponents) throws IOException { + private static File getFile(String... pathComponents) throws IOException { String rootPath = new File(new File("target"), "trash").getPath(); for (String pathComponent : pathComponents) rootPath = rootPath + File.separatorChar + pathComponent; @@ -192,7 +192,7 @@ public class RepositorySetupWorkDirTest extends LocalDiskRepositoryTestCase { return result; } - private void setBare(File gitDir, boolean bare) throws IOException, + private static void setBare(File gitDir, boolean bare) throws IOException, ConfigInvalidException { FileBasedConfig cfg = configFor(gitDir); cfg.setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null, @@ -200,7 +200,8 @@ public class RepositorySetupWorkDirTest extends LocalDiskRepositoryTestCase { cfg.save(); } - private void setWorkTree(File gitDir, File workTree) throws IOException, + private static void setWorkTree(File gitDir, File workTree) + throws IOException, ConfigInvalidException { String path = workTree.getAbsolutePath(); FileBasedConfig cfg = configFor(gitDir); @@ -209,7 +210,7 @@ public class RepositorySetupWorkDirTest extends LocalDiskRepositoryTestCase { cfg.save(); } - private FileBasedConfig configFor(File gitDir) throws IOException, + private static FileBasedConfig configFor(File gitDir) throws IOException, ConfigInvalidException { File configPath = new File(gitDir, Constants.CONFIG); FileBasedConfig cfg = new FileBasedConfig(configPath, FS.DETECTED); @@ -217,14 +218,14 @@ public class RepositorySetupWorkDirTest extends LocalDiskRepositoryTestCase { return cfg; } - private void assertGitdirPath(Repository repo, String... expected) + private static void assertGitdirPath(Repository repo, String... expected) throws IOException { File exp = getFile(expected).getCanonicalFile(); File act = repo.getDirectory().getCanonicalFile(); assertEquals("Wrong Git Directory", exp, act); } - private void assertWorkdirPath(Repository repo, String... expected) + private static void assertWorkdirPath(Repository repo, String... expected) throws IOException { File exp = getFile(expected).getCanonicalFile(); File act = repo.getWorkTree().getCanonicalFile(); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/UnpackedObjectTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/UnpackedObjectTest.java index 71e58e105..16580b49a 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/UnpackedObjectTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/UnpackedObjectTest.java @@ -520,14 +520,14 @@ public class UnpackedObjectTest extends LocalDiskRepositoryTestCase { } } - private byte[] compressStandardFormat(int type, byte[] data) + private static byte[] compressStandardFormat(int type, byte[] data) throws IOException { String typeString = Constants.typeString(type); String length = String.valueOf(data.length); return compressStandardFormat(typeString, length, data); } - private byte[] compressStandardFormat(String type, String length, + private static byte[] compressStandardFormat(String type, String length, byte[] data) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); DeflaterOutputStream d = new DeflaterOutputStream(out); @@ -540,7 +540,8 @@ public class UnpackedObjectTest extends LocalDiskRepositoryTestCase { return out.toByteArray(); } - private byte[] compressPackFormat(int type, byte[] data) throws IOException { + private static byte[] compressPackFormat(int type, byte[] data) + throws IOException { byte[] hdr = new byte[64]; int rawLength = data.length; int nextLength = rawLength >>> 4; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/WindowCacheGetTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/WindowCacheGetTest.java index 88600cefe..54bdca923 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/WindowCacheGetTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/storage/file/WindowCacheGetTest.java @@ -126,7 +126,7 @@ public class WindowCacheGetTest extends SampleDataRepositoryTestCase { checkLimits(cfg); } - private void checkLimits(final WindowCacheConfig cfg) { + private static void checkLimits(final WindowCacheConfig cfg) { final WindowCache cache = WindowCache.getInstance(); assertTrue(cache.getOpenFiles() <= cfg.getPackedGitOpenFiles()); assertTrue(cache.getOpenBytes() <= cfg.getPackedGitLimit()); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/BundleWriterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/BundleWriterTest.java index 332d802cb..236f0ee05 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/BundleWriterTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/BundleWriterTest.java @@ -140,7 +140,7 @@ public class BundleWriterTest extends SampleDataRepositoryTestCase { } } - private FetchResult fetchFromBundle(final Repository newRepo, + private static FetchResult fetchFromBundle(final Repository newRepo, final byte[] bundle) throws URISyntaxException, NotSupportedException, TransportException { final URIish uri = new URIish("in-memory://"); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PackParserTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PackParserTest.java index 9cf01a98e..bacdb3d91 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PackParserTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PackParserTest.java @@ -452,7 +452,7 @@ public class PackParserTest extends RepositoryTestCase { assertEquals(0x7e, in.read()); } - private void packHeader(TemporaryBuffer.Heap tinyPack, int cnt) + private static void packHeader(TemporaryBuffer.Heap tinyPack, int cnt) throws IOException { final byte[] hdr = new byte[8]; NB.encodeInt32(hdr, 0, 2); @@ -462,7 +462,8 @@ public class PackParserTest extends RepositoryTestCase { tinyPack.write(hdr, 0, 8); } - private void deflate(TemporaryBuffer.Heap tinyPack, final byte[] content) + private static void deflate(TemporaryBuffer.Heap tinyPack, + final byte[] content) throws IOException { final Deflater deflater = new Deflater(); final byte[] buf = new byte[128]; @@ -475,7 +476,7 @@ public class PackParserTest extends RepositoryTestCase { } while (!deflater.finished()); } - private void digest(TemporaryBuffer.Heap buf) throws IOException { + private static void digest(TemporaryBuffer.Heap buf) throws IOException { MessageDigest md = Constants.newMessageDigest(); md.update(buf.toByteArray()); buf.write(md.digest()); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java index 9e52bcaa5..8c3ce6196 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/ReceivePackAdvertiseRefsHookTest.java @@ -283,7 +283,7 @@ public class ReceivePackAdvertiseRefsHookTest extends LocalDiskRepositoryTestCas assertSame(PacketLineIn.END, r.readString()); } - private void receive(final ReceivePack rp, + private static void receive(final ReceivePack rp, final TemporaryBuffer.Heap inBuf, final TemporaryBuffer.Heap outBuf) throws IOException { rp.receive(new ByteArrayInputStream(inBuf.toByteArray()), outBuf, null); @@ -490,7 +490,7 @@ public class ReceivePackAdvertiseRefsHookTest extends LocalDiskRepositoryTestCas assertSame(PacketLineIn.END, r.readString()); } - private void packHeader(TemporaryBuffer.Heap tinyPack, int cnt) + private static void packHeader(TemporaryBuffer.Heap tinyPack, int cnt) throws IOException { final byte[] hdr = new byte[8]; NB.encodeInt32(hdr, 0, 2); @@ -500,7 +500,7 @@ public class ReceivePackAdvertiseRefsHookTest extends LocalDiskRepositoryTestCas tinyPack.write(hdr, 0, 8); } - private void copy(TemporaryBuffer.Heap tinyPack, ObjectLoader ldr) + private static void copy(TemporaryBuffer.Heap tinyPack, ObjectLoader ldr) throws IOException { final byte[] buf = new byte[64]; final byte[] content = ldr.getCachedBytes(); @@ -519,7 +519,8 @@ public class ReceivePackAdvertiseRefsHookTest extends LocalDiskRepositoryTestCas deflate(tinyPack, content); } - private void deflate(TemporaryBuffer.Heap tinyPack, final byte[] content) + private static void deflate(TemporaryBuffer.Heap tinyPack, + final byte[] content) throws IOException { final Deflater deflater = new Deflater(); final byte[] buf = new byte[128]; @@ -532,7 +533,7 @@ public class ReceivePackAdvertiseRefsHookTest extends LocalDiskRepositoryTestCas } while (!deflater.finished()); } - private void digest(TemporaryBuffer.Heap buf) throws IOException { + private static void digest(TemporaryBuffer.Heap buf) throws IOException { MessageDigest md = Constants.newMessageDigest(); md.update(buf.toByteArray()); buf.write(md.digest()); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java index a06149e84..bf22569df 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/FileTreeIteratorTest.java @@ -462,7 +462,7 @@ public class FileTreeIteratorTest extends RepositoryTestCase { assertFalse(tw.next()); } - private void assertEntry(String sha1string, String path, TreeWalk tw) + private static void assertEntry(String sha1string, String path, TreeWalk tw) throws MissingObjectException, IncorrectObjectTypeException, CorruptObjectException, IOException { assertTrue(tw.next()); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/TreeWalkBasicDiffTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/TreeWalkBasicDiffTest.java index 78d8c6b77..edec6b047 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/TreeWalkBasicDiffTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/TreeWalkBasicDiffTest.java @@ -58,6 +58,7 @@ import org.eclipse.jgit.lib.Tree; import org.eclipse.jgit.treewalk.filter.TreeFilter; import org.junit.Test; +@SuppressWarnings("deprecation") public class TreeWalkBasicDiffTest extends RepositoryTestCase { @Test public void testMissingSubtree_DetectFileAdded_FileModified() diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/IndexDiffFilterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/IndexDiffFilterTest.java index 4c103c83d..ee33c29eb 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/IndexDiffFilterTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/filter/IndexDiffFilterTest.java @@ -619,7 +619,7 @@ public class IndexDiffFilterTest extends RepositoryTestCase { return treeWalk; } - private void assertPaths(TreeWalk treeWalk, String... paths) + private static void assertPaths(TreeWalk treeWalk, String... paths) throws Exception { for (int i = 0; i < paths.length; i++) { assertTrue(treeWalk.next()); @@ -628,7 +628,7 @@ public class IndexDiffFilterTest extends RepositoryTestCase { assertFalse(treeWalk.next()); } - private void assertPath(String path, String... paths) { + private static void assertPath(String path, String... paths) { for (String p : paths) if (p.equals(path)) return; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/QuotedStringGitPathStyleTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/QuotedStringGitPathStyleTest.java index 670fbaf27..cc73c70c5 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/QuotedStringGitPathStyleTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/QuotedStringGitPathStyleTest.java @@ -157,7 +157,7 @@ public class QuotedStringGitPathStyleTest { } } - private String octalEscape(int i) { + private static String octalEscape(int i) { String s = Integer.toOctalString(i); while (s.length() < 3) { s = "0" + s; diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RawParseUtils_ParsePersonIdentTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RawParseUtils_ParsePersonIdentTest.java index df5eb4bd4..ed6268027 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RawParseUtils_ParsePersonIdentTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RawParseUtils_ParsePersonIdentTest.java @@ -137,7 +137,7 @@ public class RawParseUtils_ParsePersonIdentTest { assertPersonIdent("Me toList(Ref... refs) { + private static RefList toList(Ref... refs) { RefList.Builder b = new RefList.Builder(refs.length); b.addAll(refs, 0, refs.length); return b.toRefList(); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RefMapTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RefMapTest.java index b43fe48be..78ab27a85 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RefMapTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RefMapTest.java @@ -480,7 +480,7 @@ public class RefMapTest { assertEquals(1, map.size()); } - private RefList toList(Ref... refs) { + private static RefList toList(Ref... refs) { RefList.Builder b = new RefList.Builder(refs.length); b.addAll(refs, 0, refs.length); return b.toRefList(); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RelativeDateFormatterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RelativeDateFormatterTest.java index 84b35b4dc..0bf78f390 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RelativeDateFormatterTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/RelativeDateFormatterTest.java @@ -63,7 +63,7 @@ public class RelativeDateFormatterTest { SystemReader.setInstance(new MockSystemReader()); } - private void assertFormat(long ageFromNow, long timeUnit, + private static void assertFormat(long ageFromNow, long timeUnit, String expectedFormat) { Date d = new Date(SystemReader.getInstance().getCurrentTime() - ageFromNow * timeUnit); diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/EolCanonicalizingInputStreamTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/EolCanonicalizingInputStreamTest.java index bd1524563..ed2a4f210 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/EolCanonicalizingInputStreamTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/EolCanonicalizingInputStreamTest.java @@ -94,7 +94,8 @@ public class EolCanonicalizingInputStreamTest { test(asBytes("1\r\n2\r\n3\0"), asBytes("1\n2\n3\0"), false); } - private void test(byte[] input, byte[] expected, boolean detectBinary) throws IOException { + private static void test(byte[] input, byte[] expected, + boolean detectBinary) throws IOException { final InputStream bis1 = new ByteArrayInputStream(input); final InputStream cis1 = new EolCanonicalizingInputStream(bis1, detectBinary); int index1 = 0; diff --git a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtCredentialsProvider.java b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtCredentialsProvider.java index 0e6f78ab4..fd26bfa7f 100644 --- a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtCredentialsProvider.java +++ b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtCredentialsProvider.java @@ -135,7 +135,7 @@ public class AwtCredentialsProvider extends CredentialsProvider { } } - private boolean interactive(URIish uri, CredentialItem[] items) { + private static boolean interactive(URIish uri, CredentialItem[] items) { final GridBagConstraints gbc = new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0);