Make inner classes static where possible
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
)
This commit is contained in:
parent
f6c989665e
commit
6d0168a414
|
@ -76,7 +76,7 @@ public void testGetHeaderFieldsAllowMultipleValues()
|
|||
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 @@
|
|||
* 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 @@ private static abstract class Fold {
|
|||
}
|
||||
|
||||
/** 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 void archiveByDirectoryPath() throws GitAPIException, IOException {
|
|||
}
|
||||
}
|
||||
|
||||
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 Iterable<String> suffixes() {
|
|||
}
|
||||
}
|
||||
|
||||
public class MockOutputStream extends OutputStream {
|
||||
public static class MockOutputStream extends OutputStream {
|
||||
|
||||
private int foo;
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ public void setUp() throws Exception {
|
|||
resolveRelativeUris();
|
||||
}
|
||||
|
||||
class IndexedRepos implements RepoCommand.RemoteReader {
|
||||
static class IndexedRepos implements RepoCommand.RemoteReader {
|
||||
Map<String, Repository> uriRepoMap;
|
||||
IndexedRepos() {
|
||||
uriRepoMap = new HashMap<>();
|
||||
|
|
|
@ -141,7 +141,7 @@ private void doCacheTests() throws IOException {
|
|||
}
|
||||
}
|
||||
|
||||
private class TestObject {
|
||||
private static class TestObject {
|
||||
ObjectId id;
|
||||
|
||||
int type;
|
||||
|
|
|
@ -839,7 +839,7 @@ public ObjectReader newReader() {
|
|||
/**
|
||||
* 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 int read(byte[] b, int off, int len) throws IOException {
|
|||
}
|
||||
}
|
||||
|
||||
class BigReadForbiddenReader extends ObjectReader.Filter {
|
||||
static class BigReadForbiddenReader extends ObjectReader.Filter {
|
||||
ObjectReader delegate;
|
||||
int limit;
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
|
||||
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 @@ private static String prefix(String path) {
|
|||
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 @@ private static long now() {
|
|||
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 EWAHCompressedBitmap getBitmap(AnyObjectId objectId) {
|
|||
}
|
||||
|
||||
/** 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 @@ private static RevObject safeParseOld(RevWalk rw, AnyObjectId oldId)
|
|||
* 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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue