Browse Source

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>
stable-5.2
David Pursehouse 6 years ago
parent
commit
ee40efcea4
  1. 2
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/transport/http/apache/HttpClientConnectionTest.java
  2. 2
      org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java
  3. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java
  4. 5
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ArchiveCommandTest.java
  5. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java
  6. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/WindowCacheGetTest.java
  7. 4
      org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergerTest.java
  8. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/PlotCommitListTest.java
  9. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/AbstractTreeIteratorTest.java
  10. 2
      org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutOutputStreamTest.java
  11. 2
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexRemapper.java
  12. 2
      org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java

2
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/transport/http/apache/HttpClientConnectionTest.java

@ -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() {

2
org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java

@ -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);
}

2
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/TextHashFunctions.java

@ -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;

5
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ArchiveCommandTest.java

@ -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;

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java

@ -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<>();

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/WindowCacheGetTest.java

@ -141,7 +141,7 @@ public class WindowCacheGetTest extends SampleDataRepositoryTestCase {
}
}
private class TestObject {
private static class TestObject {
ObjectId id;
int type;

4
org.eclipse.jgit.test/tst/org/eclipse/jgit/merge/MergerTest.java

@ -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;

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/revplot/PlotCommitListTest.java

@ -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;

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/treewalk/AbstractTreeIteratorTest.java

@ -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();

2
org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutOutputStreamTest.java

@ -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]);

2
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexRemapper.java

@ -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) {

2
org.eclipse.jgit/src/org/eclipse/jgit/lib/RefUpdate.java

@ -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;
}
}

Loading…
Cancel
Save