Make inner classes static where appropriate

There are several classes that have inner classes not declared with the
'static' modifier.  For these classes Findbugs reports:

  This class is an inner class, but does not use its embedded reference
  to the object which created it.  This reference makes the instances of
  the class larger, and may keep the reference to the creator object alive
  longer than necessary.  If possible, the class should be made static.

Add a 'static' modifier on these classes.

Change-Id: I0244bb1cd5662398f79c61d442df815e3811bf12
This commit is contained in:
David Pursehouse
2015-03-20 16:29:41 +09:00
parent 01ace62303
commit 65dad0493b
15 changed files with 15 additions and 15 deletions

View File

@@ -41,7 +41,7 @@ public class AcceptanceTestRequestScope {
private static final Key<RequestScopedReviewDbProvider> DB_KEY = private static final Key<RequestScopedReviewDbProvider> DB_KEY =
Key.get(RequestScopedReviewDbProvider.class); Key.get(RequestScopedReviewDbProvider.class);
public class Context implements RequestContext { public static class Context implements RequestContext {
private final RequestCleanup cleanup = new RequestCleanup(); private final RequestCleanup cleanup = new RequestCleanup();
private final Map<Key<?>, Object> map = Maps.newHashMap(); private final Map<Key<?>, Object> map = Maps.newHashMap();
private final SchemaFactory<ReviewDb> schemaFactory; private final SchemaFactory<ReviewDb> schemaFactory;

View File

@@ -47,7 +47,7 @@ public class MyAgreementsScreen extends SettingsScreen {
}); });
} }
private class AgreementTable extends FancyFlexTable<ContributorAgreement> { private static class AgreementTable extends FancyFlexTable<ContributorAgreement> {
AgreementTable() { AgreementTable() {
table.setWidth(""); table.setWidth("");
table.setText(0, 1, Util.C.agreementStatus()); table.setText(0, 1, Util.C.agreementStatus());

View File

@@ -142,7 +142,7 @@ class UsernameField extends Composite {
setUserName.setEnabled(on); setUserName.setEnabled(on);
} }
private final class UserNameValidator implements KeyPressHandler { private static final class UserNameValidator implements KeyPressHandler {
@Override @Override
public void onKeyPress(final KeyPressEvent event) { public void onKeyPress(final KeyPressEvent event) {
final char code = event.getCharCode(); final char code = event.getCharCode();

View File

@@ -60,7 +60,7 @@ public class PluginListScreen extends PluginScreen {
add(pluginPanel); add(pluginPanel);
} }
private class PluginTable extends FancyFlexTable<PluginInfo> { private static class PluginTable extends FancyFlexTable<PluginInfo> {
PluginTable() { PluginTable() {
table.setText(0, 1, Util.C.columnPluginName()); table.setText(0, 1, Util.C.columnPluginName());
table.setText(0, 2, Util.C.columnPluginSettings()); table.setText(0, 2, Util.C.columnPluginSettings());

View File

@@ -698,7 +698,7 @@ public class ProjectInfoScreen extends ProjectScreen {
&& Gerrit.getUserAccount().getUserName().length() > 0; && Gerrit.getUserAccount().getUserName().length() > 0;
} }
private class LabeledWidgetsGrid extends FlexTable { private static class LabeledWidgetsGrid extends FlexTable {
private String labelSuffix; private String labelSuffix;
public LabeledWidgetsGrid() { public LabeledWidgetsGrid() {

View File

@@ -82,7 +82,7 @@ public abstract class CherryPickDialog extends TextAreaActionDialog {
return newBranch.getText(); return newBranch.getText();
} }
class BranchSuggestion implements Suggestion { static class BranchSuggestion implements Suggestion {
private BranchInfo branch; private BranchInfo branch;
public BranchSuggestion(BranchInfo branch) { public BranchSuggestion(BranchInfo branch) {

View File

@@ -82,7 +82,7 @@ public abstract class CreateChangeDialog extends TextAreaActionDialog {
return newChange.getText(); return newChange.getText();
} }
class BranchSuggestion implements Suggestion { static class BranchSuggestion implements Suggestion {
private BranchInfo branch; private BranchInfo branch;
public BranchSuggestion(BranchInfo branch) { public BranchSuggestion(BranchInfo branch) {

View File

@@ -186,7 +186,7 @@ class ProjectBasicAuthFilter implements Filter {
return MoreObjects.firstNonNull(req.getCharacterEncoding(), "UTF-8"); return MoreObjects.firstNonNull(req.getCharacterEncoding(), "UTF-8");
} }
class Response extends HttpServletResponseWrapper { static class Response extends HttpServletResponseWrapper {
private static final String WWW_AUTHENTICATE = "WWW-Authenticate"; private static final String WWW_AUTHENTICATE = "WWW-Authenticate";
Response(HttpServletResponse rsp) { Response(HttpServletResponse rsp) {

View File

@@ -45,7 +45,7 @@ class ContextMapper {
return base + name; return base + name;
} }
private class WrappedRequest extends HttpServletRequestWrapper { private static class WrappedRequest extends HttpServletRequestWrapper {
private final String contextPath; private final String contextPath;
private final String pathInfo; private final String pathInfo;

View File

@@ -54,7 +54,7 @@ public class LuceneIndexModule extends LifecycleModule {
} }
} }
private class MultiVersionModule extends LifecycleModule { private static class MultiVersionModule extends LifecycleModule {
@Override @Override
public void configure() { public void configure() {
factory(OnlineReindexer.Factory.class); factory(OnlineReindexer.Factory.class);

View File

@@ -244,7 +244,7 @@ public class RebuildNotedb extends SiteProgram {
} }
} }
private class RebuildListener implements Runnable { private static class RebuildListener implements Runnable {
private Change.Id changeId; private Change.Id changeId;
private ListenableFuture<?> future; private ListenableFuture<?> future;
private AtomicBoolean ok; private AtomicBoolean ok;

View File

@@ -278,7 +278,7 @@ public class ListAccess implements RestReadView<TopLevelResource> {
} }
} }
public class PermissionRuleInfo { public static class PermissionRuleInfo {
public PermissionRule.Action action; public PermissionRule.Action action;
public Boolean force; public Boolean force;
public Integer min; public Integer min;

View File

@@ -25,7 +25,7 @@ public class ColumnFormatterTest {
* Holds an in-memory {@link java.io.PrintWriter} object and allows * Holds an in-memory {@link java.io.PrintWriter} object and allows
* comparisons of its contents to a supplied string via an assert statement. * comparisons of its contents to a supplied string via an assert statement.
*/ */
class PrintWriterComparator { static class PrintWriterComparator {
private PrintWriter printWriter; private PrintWriter printWriter;
private StringWriter stringWriter; private StringWriter stringWriter;