As reported by Error Prone:
An inner class should be static unless it references members of its
enclosing class. An inner class that is made non-static unnecessarily
uses more memory and does not make the intent of the class clear.
See https://errorprone.info/bugpattern/ClassCanBeStatic
Change-Id: Ib99d120532630dba63cf400cc1c61c318286fc41
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
(cherry picked from commit ee40efcea4
)
tags/v5.1.9.201908210455-r
@@ -76,7 +76,7 @@ public class HttpClientConnectionTest { | |||
assertTrue(headerValues.contains("NTLM")); | |||
} | |||
private class HttpResponseMock extends AbstractHttpMessage | |||
private static class HttpResponseMock extends AbstractHttpMessage | |||
implements HttpResponse { | |||
@Override | |||
public StatusLine getStatusLine() { |
@@ -70,7 +70,7 @@ import org.eclipse.jgit.util.time.ProposedTimestamp; | |||
* Mock {@link org.eclipse.jgit.util.SystemReader} for tests. | |||
*/ | |||
public class MockSystemReader extends SystemReader { | |||
private final class MockConfig extends FileBasedConfig { | |||
private static final class MockConfig extends FileBasedConfig { | |||
private MockConfig(File cfgLocation, FS fs) { | |||
super(cfgLocation, fs); | |||
} |
@@ -474,7 +474,7 @@ class TextHashFunctions extends TextBuiltin { | |||
} | |||
/** Utility to help us identify unique lines in a file. */ | |||
private class Line { | |||
private static class Line { | |||
private final RawText txt; | |||
private final int pos; |
@@ -190,7 +190,8 @@ public class ArchiveCommandTest extends RepositoryTestCase { | |||
} | |||
} | |||
private class MockFormat implements ArchiveCommand.Format<MockOutputStream> { | |||
private static class MockFormat | |||
implements ArchiveCommand.Format<MockOutputStream> { | |||
private Map<String, String> entries = new HashMap<>(); | |||
@@ -240,7 +241,7 @@ public class ArchiveCommandTest extends RepositoryTestCase { | |||
} | |||
} | |||
public class MockOutputStream extends OutputStream { | |||
public static class MockOutputStream extends OutputStream { | |||
private int foo; | |||
@@ -139,7 +139,7 @@ public class RepoCommandTest extends RepositoryTestCase { | |||
resolveRelativeUris(); | |||
} | |||
class IndexedRepos implements RepoCommand.RemoteReader { | |||
static class IndexedRepos implements RepoCommand.RemoteReader { | |||
Map<String, Repository> uriRepoMap; | |||
IndexedRepos() { | |||
uriRepoMap = new HashMap<>(); |
@@ -141,7 +141,7 @@ public class WindowCacheGetTest extends SampleDataRepositoryTestCase { | |||
} | |||
} | |||
private class TestObject { | |||
private static class TestObject { | |||
ObjectId id; | |||
int type; |
@@ -839,7 +839,7 @@ public class MergerTest extends RepositoryTestCase { | |||
/** | |||
* Throws an exception if reading beyond limit. | |||
*/ | |||
class BigReadForbiddenStream extends ObjectStream.Filter { | |||
static class BigReadForbiddenStream extends ObjectStream.Filter { | |||
int limit; | |||
BigReadForbiddenStream(ObjectStream orig, int limit) { | |||
@@ -878,7 +878,7 @@ public class MergerTest extends RepositoryTestCase { | |||
} | |||
} | |||
class BigReadForbiddenReader extends ObjectReader.Filter { | |||
static class BigReadForbiddenReader extends ObjectReader.Filter { | |||
ObjectReader delegate; | |||
int limit; | |||
@@ -56,7 +56,7 @@ import org.junit.Test; | |||
public class PlotCommitListTest extends RevWalkTestCase { | |||
class CommitListAssert { | |||
static class CommitListAssert { | |||
private PlotCommitList<PlotLane> pcl; | |||
private PlotCommit<PlotLane> current; | |||
private int nextIndex = 0; |
@@ -66,7 +66,7 @@ public class AbstractTreeIteratorTest { | |||
return s > 0 ? path.substring(0, s) : ""; | |||
} | |||
public class FakeTreeIterator extends WorkingTreeIterator { | |||
public static class FakeTreeIterator extends WorkingTreeIterator { | |||
public FakeTreeIterator(String pathName, FileMode fileMode) { | |||
super(prefix(pathName), new Config().get(WorkingTreeOptions.KEY)); | |||
mode = fileMode.getBits(); |
@@ -282,7 +282,7 @@ public class TimeoutOutputStreamTest { | |||
return System.currentTimeMillis(); | |||
} | |||
private final class FullPipeInputStream extends PipedInputStream { | |||
private static final class FullPipeInputStream extends PipedInputStream { | |||
FullPipeInputStream(PipedOutputStream src) throws IOException { | |||
super(src); | |||
src.write(new byte[PIPE_SIZE]); |
@@ -207,7 +207,7 @@ public class PackBitmapIndexRemapper extends PackBitmapIndex | |||
} | |||
/** An entry in the old PackBitmapIndex. */ | |||
public final class Entry extends ObjectId { | |||
public static final class Entry extends ObjectId { | |||
private final int flags; | |||
Entry(AnyObjectId src, int flags) { |
@@ -823,7 +823,7 @@ public abstract class RefUpdate { | |||
* Handle the abstraction of storing a ref update. This is because both | |||
* updating and deleting of a ref have merge testing in common. | |||
*/ | |||
private abstract class Store { | |||
private static abstract class Store { | |||
abstract Result execute(Result status) throws IOException; | |||
} | |||
} |