Bug 1382049 - Make inner classes static when possible. r=nalexander, r=sebastian
authorAndrew Gaul <andrew@gaul.org>
Tue, 18 Jul 2017 16:51:30 -0700
changeset 389115 7c264d9bf22a
parent 389114 719f1c2189d2
child 389116 ca46fd749dc5
push id32778
push userarchaeopteryx@coole-files.de
push dateMon, 30 Oct 2017 22:52:59 +0000
treeherdermozilla-central@083a9c84fbd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander, sebastian
bugs1382049
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1382049 - Make inner classes static when possible. r=nalexander, r=sebastian This avoids an implicit this field and can help GC. Found via error-prone.
media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java
mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
mobile/android/base/java/org/mozilla/gecko/EditBookmarkDialog.java
mobile/android/base/java/org/mozilla/gecko/FormAssistPopup.java
mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
mobile/android/base/java/org/mozilla/gecko/SessionParser.java
mobile/android/base/java/org/mozilla/gecko/animation/PropertyAnimator.java
mobile/android/base/java/org/mozilla/gecko/bookmarks/BookmarkEditFragment.java
mobile/android/base/java/org/mozilla/gecko/db/BrowserDatabaseHelper.java
mobile/android/base/java/org/mozilla/gecko/home/PanelInfoManager.java
mobile/android/base/java/org/mozilla/gecko/menu/GeckoMenuInflater.java
mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
mobile/android/base/java/org/mozilla/gecko/prompts/IconGridInput.java
mobile/android/base/java/org/mozilla/gecko/updater/UpdateService.java
mobile/android/base/java/org/mozilla/gecko/widget/ActivityChooserModel.java
mobile/android/base/java/org/mozilla/gecko/widget/FadedHorizontalScrollView.java
mobile/android/services/src/main/java/org/mozilla/gecko/fxa/login/State.java
mobile/android/services/src/main/java/org/mozilla/gecko/sync/JSONRecordFetcher.java
mobile/android/services/src/main/java/org/mozilla/gecko/sync/middleware/MiddlewareRepository.java
mobile/android/services/src/main/java/org/mozilla/gecko/sync/middleware/MiddlewareRepositorySession.java
mobile/android/services/src/main/java/org/mozilla/gecko/sync/net/SyncStorageRecordRequest.java
mobile/android/services/src/main/java/org/mozilla/gecko/sync/net/SyncStorageRequest.java
mobile/android/services/src/main/java/org/mozilla/gecko/sync/stage/FormHistoryServerSyncStage.java
mobile/android/services/src/main/java/org/mozilla/gecko/sync/stage/ServerSyncStage.java
--- a/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java
+++ b/media/webrtc/trunk/webrtc/modules/video_capture/android/java/src/org/webrtc/videoengine/VideoCaptureAndroid.java
@@ -80,17 +80,17 @@ public class VideoCaptureAndroid impleme
     this.info = new Camera.CameraInfo();
     Camera.getCameraInfo(id, info);
   }
 
   // Return the global application context.
   @WebRTCJNITarget
   private static native Context GetContext();
 
-  private class CameraThread extends Thread {
+  private static final class CameraThread extends Thread {
     private Exchanger<Handler> handlerExchanger;
     public CameraThread(Exchanger<Handler> handlerExchanger) {
       this.handlerExchanger = handlerExchanger;
     }
 
     @Override public void run() {
       Looper.prepare();
       exchange(handlerExchanger, new Handler());
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -3160,17 +3160,17 @@ public class BrowserApp extends GeckoApp
         mBrowserSearch.setUserVisibleHint(false);
 
         getWindow().setBackgroundDrawable(null);
     }
 
     /**
      * Hides certain UI elements (e.g. button toast) when the user touches the main layout.
      */
-    private class HideOnTouchListener implements TouchEventInterceptor {
+    private static final class HideOnTouchListener implements TouchEventInterceptor {
         @Override
         public boolean onInterceptTouchEvent(View view, MotionEvent event) {
             if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
                 SnackbarBuilder.dismissCurrentSnackbar();
             }
             return false;
         }
 
--- a/mobile/android/base/java/org/mozilla/gecko/EditBookmarkDialog.java
+++ b/mobile/android/base/java/org/mozilla/gecko/EditBookmarkDialog.java
@@ -34,17 +34,17 @@ public class EditBookmarkDialog {
 
     public EditBookmarkDialog(Context context) {
         mContext = context;
     }
 
     /**
      * A private struct to make it easier to pass bookmark data across threads
      */
-    private class Bookmark {
+    private static final class Bookmark {
         final int id;
         final String title;
         final String url;
         final String keyword;
 
         public Bookmark(int aId, String aTitle, String aUrl, String aKeyword) {
             id = aId;
             title = aTitle;
@@ -56,17 +56,17 @@ public class EditBookmarkDialog {
     /**
      * This text watcher to enable or disable the OK button if the dialog contains
      * valid information. This class is overridden to do data checking on different fields.
      * By itself, it always enables the button.
      *
      * Callers can also assign a paired partner to the TextWatcher, and callers will check
      * that both are enabled before enabling the ok button.
      */
-    private class EditBookmarkTextWatcher implements TextWatcher {
+    private static class EditBookmarkTextWatcher implements TextWatcher {
         // A stored reference to the dialog containing the text field being watched
         protected AlertDialog mDialog;
 
         // A stored text watcher to do the real verification of a field
         protected EditBookmarkTextWatcher mPairedTextWatcher;
 
         // Whether or not the ok button should be enabled.
         protected boolean mEnabled = true;
@@ -96,34 +96,34 @@ public class EditBookmarkDialog {
         @Override
         public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
     }
 
     /**
      * A version of the EditBookmarkTextWatcher for the url field of the dialog.
      * Only checks if the field is empty or not.
      */
-    private class LocationTextWatcher extends EditBookmarkTextWatcher {
+    private static final class LocationTextWatcher extends EditBookmarkTextWatcher {
         public LocationTextWatcher(AlertDialog aDialog) {
             super(aDialog);
         }
 
         // Disables the ok button if the location field is empty.
         @Override
         public void onTextChanged(CharSequence s, int start, int before, int count) {
             mEnabled = (s.toString().trim().length() > 0);
             super.onTextChanged(s, start, before, count);
         }
     }
 
     /**
      * A version of the EditBookmarkTextWatcher for the keyword field of the dialog.
      * Checks if the field has any (non leading or trailing) spaces.
      */
-    private class KeywordTextWatcher extends EditBookmarkTextWatcher {
+    private static final class KeywordTextWatcher extends EditBookmarkTextWatcher {
         public KeywordTextWatcher(AlertDialog aDialog) {
             super(aDialog);
         }
 
         @Override
         public void onTextChanged(CharSequence s, int start, int before, int count) {
             // Disable if the keyword contains spaces
             mEnabled = (s.toString().trim().indexOf(' ') == -1);
--- a/mobile/android/base/java/org/mozilla/gecko/FormAssistPopup.java
+++ b/mobile/android/base/java/org/mozilla/gecko/FormAssistPopup.java
@@ -393,17 +393,17 @@ public class FormAssistPopup extends Rel
         ThreadUtils.postToUiThread(new Runnable() {
             @Override
             public void run() {
                 positionAndShowPopup(aMetrics);
             }
         });
     }
 
-    private class AutoCompleteListAdapter extends ArrayAdapter<Pair<String, String>> {
+    private static final class AutoCompleteListAdapter extends ArrayAdapter<Pair<String, String>> {
         private final LayoutInflater mInflater;
         private final int mTextViewResourceId;
 
         public AutoCompleteListAdapter(Context context, int textViewResourceId) {
             super(context, textViewResourceId);
 
             mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
             mTextViewResourceId = textViewResourceId;
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
@@ -342,17 +342,17 @@ public abstract class GeckoApp extends G
 
     abstract public View getDoorhangerOverlay();
 
     protected void processTabQueue() {};
 
     protected void openQueuedTabs() {};
 
     @SuppressWarnings("serial")
-    class SessionRestoreException extends Exception {
+    static final class SessionRestoreException extends Exception {
         public SessionRestoreException(Exception e) {
             super(e);
         }
 
         public SessionRestoreException(String message) {
             super(message);
         }
     }
--- a/mobile/android/base/java/org/mozilla/gecko/SessionParser.java
+++ b/mobile/android/base/java/org/mozilla/gecko/SessionParser.java
@@ -15,17 +15,17 @@ import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
 
 import android.util.Log;
 
 public abstract class SessionParser {
     private static final String LOGTAG = "GeckoSessionParser";
 
-    public class SessionTab {
+    public static final class SessionTab {
         final private String mTitle;
         final private String mUrl;
         final private JSONObject mTabObject;
         private boolean mIsSelected;
 
         private SessionTab(String title, String url, boolean isSelected, JSONObject tabObject) {
             mTitle = title;
             mUrl = url;
--- a/mobile/android/base/java/org/mozilla/gecko/animation/PropertyAnimator.java
+++ b/mobile/android/base/java/org/mozilla/gecko/animation/PropertyAnimator.java
@@ -28,17 +28,17 @@ public class PropertyAnimator implements
         TRANSLATION_X,
         TRANSLATION_Y,
         SCROLL_X,
         SCROLL_Y,
         WIDTH,
         HEIGHT
     }
 
-    private class ElementHolder {
+    private static final class ElementHolder {
         View view;
         Property property;
         float from;
         float to;
     }
 
     public static interface PropertyAnimationListener {
         public void onPropertyAnimationStart();
--- a/mobile/android/base/java/org/mozilla/gecko/bookmarks/BookmarkEditFragment.java
+++ b/mobile/android/base/java/org/mozilla/gecko/bookmarks/BookmarkEditFragment.java
@@ -491,17 +491,17 @@ public class BookmarkEditFragment extend
 
             bookmark = null;
         }
     }
 
     /**
      * This text watcher enables the menu item if the dialog contains valid information, or disables otherwise.
      */
-    private class BookmarkTextWatcher implements TextWatcher {
+    private static final class BookmarkTextWatcher implements TextWatcher {
         // A stored reference to the dialog containing the text field being watched.
         private final WeakReference<MenuItem> doneItemWeakReference;
 
         // Whether or not the menu item should be enabled.
         private boolean enabled = true;
 
         private BookmarkTextWatcher(MenuItem doneItem) {
             doneItemWeakReference = new WeakReference<>(doneItem);
--- a/mobile/android/base/java/org/mozilla/gecko/db/BrowserDatabaseHelper.java
+++ b/mobile/android/base/java/org/mozilla/gecko/db/BrowserDatabaseHelper.java
@@ -2491,17 +2491,17 @@ public class BrowserDatabaseHelper exten
                 c.close();
         }
     }
 
     private interface BookmarkMigrator {
         public void updateForNewTable(ContentValues bookmark);
     }
 
-    private class BookmarkMigrator3to4 implements BookmarkMigrator {
+    private static final class BookmarkMigrator3to4 implements BookmarkMigrator {
         @Override
         public void updateForNewTable(ContentValues bookmark) {
             Integer isFolder = bookmark.getAsInteger("folder");
             if (isFolder == null || isFolder != 1) {
                 bookmark.put(Bookmarks.TYPE, Bookmarks.TYPE_BOOKMARK);
             } else {
                 bookmark.put(Bookmarks.TYPE, Bookmarks.TYPE_FOLDER);
             }
--- a/mobile/android/base/java/org/mozilla/gecko/home/PanelInfoManager.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/PanelInfoManager.java
@@ -20,17 +20,17 @@ import org.mozilla.gecko.util.GeckoBundl
 import org.mozilla.gecko.util.ThreadUtils;
 
 import android.util.Log;
 import android.util.SparseArray;
 
 public class PanelInfoManager implements BundleEventListener {
     private static final String LOGTAG = "GeckoPanelInfoManager";
 
-    public class PanelInfo {
+    public static final class PanelInfo {
         private final String mId;
         private final String mTitle;
         private final GeckoBundle mBundleData;
 
         public PanelInfo(String id, String title, final GeckoBundle bundleData) {
             mId = id;
             mTitle = title;
             mBundleData = bundleData;
--- a/mobile/android/base/java/org/mozilla/gecko/menu/GeckoMenuInflater.java
+++ b/mobile/android/base/java/org/mozilla/gecko/menu/GeckoMenuInflater.java
@@ -25,17 +25,17 @@ import android.view.SubMenu;
 public class GeckoMenuInflater extends MenuInflater {
     private static final String TAG_MENU = "menu";
     private static final String TAG_ITEM = "item";
     private static final int NO_ID = 0;
 
     private final Context mContext;
 
     // Private class to hold the parsed menu item.
-    private class ParsedItem {
+    private static final class ParsedItem {
         public int id;
         public int order;
         public CharSequence title;
         public int iconRes;
         public boolean checkable;
         public boolean checked;
         public boolean visible;
         public boolean enabled;
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
@@ -1179,17 +1179,17 @@ public class GeckoPreferences
         input.setHint(aHintText);
 
         final TextInputLayout layout = new TextInputLayout(this);
         layout.addView(input);
 
         return layout;
     }
 
-    private class PasswordTextWatcher implements TextWatcher {
+    private static final class PasswordTextWatcher implements TextWatcher {
         EditText input1;
         EditText input2;
         AlertDialog dialog;
 
         PasswordTextWatcher(EditText aInput1, EditText aInput2, AlertDialog aDialog) {
             input1 = aInput1;
             input2 = aInput2;
             dialog = aDialog;
@@ -1207,17 +1207,17 @@ public class GeckoPreferences
         }
 
         @Override
         public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
         @Override
         public void onTextChanged(CharSequence s, int start, int before, int count) { }
     }
 
-    private class EmptyTextWatcher implements TextWatcher {
+    private static final class EmptyTextWatcher implements TextWatcher {
         EditText input;
         AlertDialog dialog;
 
         EmptyTextWatcher(EditText aInput, AlertDialog aDialog) {
             input = aInput;
             dialog = aDialog;
         }
 
--- a/mobile/android/base/java/org/mozilla/gecko/prompts/IconGridInput.java
+++ b/mobile/android/base/java/org/mozilla/gecko/prompts/IconGridInput.java
@@ -105,17 +105,17 @@ public class IconGridInput extends Promp
         return mSelected;
     }
 
     @Override
     public boolean getScrollable() {
         return true;
     }
 
-    private class IconGridAdapter extends ArrayAdapter<IconGridItem> {
+    private static final class IconGridAdapter extends ArrayAdapter<IconGridItem> {
         public IconGridAdapter(Context context, int resource, List<IconGridItem> items) {
             super(context, resource, items);
         }
 
         @Override
         public View getView(int position, View convert, ViewGroup parent) {
             final Context context = parent.getContext();
             if (convert == null) {
--- a/mobile/android/base/java/org/mozilla/gecko/updater/UpdateService.java
+++ b/mobile/android/base/java/org/mozilla/gecko/updater/UpdateService.java
@@ -778,17 +778,17 @@ public class UpdateService extends Inten
         SharedPreferences.Editor editor = mPrefs.edit();
         editor.putString(KEY_LAST_BUILDID, info.buildID);
         editor.putString(KEY_LAST_HASH_FUNCTION, info.hashFunction);
         editor.putString(KEY_LAST_HASH_VALUE, info.hashValue);
         editor.putString(KEY_LAST_FILE_NAME, downloaded.toString());
         editor.commit();
     }
 
-    private class UpdateInfo {
+    private static final class UpdateInfo {
         public URI uri;
         public String buildID;
         public String hashFunction;
         public String hashValue;
         public int size;
 
         private boolean isNonEmpty(String s) {
             return s != null && s.length() > 0;
--- a/mobile/android/base/java/org/mozilla/gecko/widget/ActivityChooserModel.java
+++ b/mobile/android/base/java/org/mozilla/gecko/widget/ActivityChooserModel.java
@@ -971,17 +971,17 @@ public class ActivityChooserModel extend
             builder.append("]");
             return builder.toString();
         }
     }
 
     /**
      * Represents an activity.
      */
-    public final class ActivityResolveInfo implements Comparable<ActivityResolveInfo> {
+    public static final class ActivityResolveInfo implements Comparable<ActivityResolveInfo> {
 
         /**
          * The {@link ResolveInfo} of the activity.
          */
         public final ResolveInfo resolveInfo;
 
         /**
          * Weight of the activity. Useful for sorting.
@@ -1034,17 +1034,17 @@ public class ActivityChooserModel extend
             builder.append("]");
             return builder.toString();
         }
     }
 
     /**
      * Default activity sorter implementation.
      */
-    private final class DefaultSorter implements ActivitySorter {
+    private static final class DefaultSorter implements ActivitySorter {
         private static final float WEIGHT_DECAY_COEFFICIENT = 0.95f;
 
         private final Map<String, ActivityResolveInfo> mPackageNameToActivityMap =
             new HashMap<String, ActivityResolveInfo>();
 
         @Override
         public void sort(Intent intent, List<ActivityResolveInfo> activities,
                 List<HistoricalRecord> historicalRecords) {
--- a/mobile/android/base/java/org/mozilla/gecko/widget/FadedHorizontalScrollView.java
+++ b/mobile/android/base/java/org/mozilla/gecko/widget/FadedHorizontalScrollView.java
@@ -147,17 +147,17 @@ public class FadedHorizontalScrollView e
         } else {
             mFadeTop = 0;
             mFadeBottom = 0;
         }
 
         mVerticalFadeBordersDirty = false;
     }
 
-    private class FadePaint extends Paint {
+    private static final class FadePaint extends Paint {
         public final Matrix matrix;
         public final Shader fade;
 
         public FadePaint() {
             matrix = new Matrix();
             fade = new LinearGradient(0, 0, 0, 1, 0xFF000000, 0, Shader.TileMode.CLAMP);
             setShader(fade);
             setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT));
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/login/State.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/login/State.java
@@ -6,17 +6,17 @@ package org.mozilla.gecko.fxa.login;
 
 import org.mozilla.gecko.fxa.login.FxAccountLoginStateMachine.ExecuteDelegate;
 import org.mozilla.gecko.sync.ExtendedJSONObject;
 import org.mozilla.gecko.sync.Utils;
 
 public abstract class State {
   public static final long CURRENT_VERSION = 3L;
 
-  public class NotASessionTokenState extends Exception {
+  public static final class NotASessionTokenState extends Exception {
 
     private static final long serialVersionUID = 8628129091996684799L;
 
     public NotASessionTokenState(String message) {
       super(message);
     }
   }
 
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/sync/JSONRecordFetcher.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/sync/JSONRecordFetcher.java
@@ -81,17 +81,17 @@ public class JSONRecordFetcher {
       final SyncStorageRecordRequest r = new SyncStorageRecordRequest(this.getURI());
       r.delegate = new JSONFetchHandler();
       r.get();
     } catch (Exception e) {
       delegate.handleError(e);
     }
   }
 
-  private class LatchedJSONRecordFetchDelegate implements JSONRecordFetchDelegate {
+  private static final class LatchedJSONRecordFetchDelegate implements JSONRecordFetchDelegate {
     public ExtendedJSONObject body = null;
     public Exception exception = null;
     private final CountDownLatch latch;
 
     public LatchedJSONRecordFetchDelegate(CountDownLatch latch) {
       this.latch = latch;
     }
 
@@ -137,9 +137,9 @@ public class JSONRecordFetcher {
     }
 
     if (delegate.exception != null) {
       throw delegate.exception;
     }
 
     throw new Exception("Unknown error.");
   }
-}
\ No newline at end of file
+}
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/sync/middleware/MiddlewareRepository.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/sync/middleware/MiddlewareRepository.java
@@ -4,17 +4,17 @@
 
 package org.mozilla.gecko.sync.middleware;
 
 import org.mozilla.gecko.sync.repositories.Repository;
 import org.mozilla.gecko.sync.repositories.delegates.RepositorySessionCreationDelegate;
 
 public abstract class MiddlewareRepository extends Repository {
 
-  public abstract class SessionCreationDelegate implements
+  public static abstract class SessionCreationDelegate implements
       RepositorySessionCreationDelegate {
 
     // We call through to our inner repository, so we don't need our own
     // deferral scheme.
     @Override
     public RepositorySessionCreationDelegate deferredCreationDelegate() {
       return this;
     }
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/sync/middleware/MiddlewareRepositorySession.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/sync/middleware/MiddlewareRepositorySession.java
@@ -74,17 +74,17 @@ public abstract class MiddlewareReposito
     }
   }
 
   @Override
   public void begin(RepositorySessionBeginDelegate delegate) throws InvalidSessionTransitionException {
     inner.begin(new MiddlewareRepositorySessionBeginDelegate(this, delegate));
   }
 
-  public class MiddlewareRepositorySessionFinishDelegate implements RepositorySessionFinishDelegate {
+  public static final class MiddlewareRepositorySessionFinishDelegate implements RepositorySessionFinishDelegate {
     private final MiddlewareRepositorySession outerSession;
     private final RepositorySessionFinishDelegate next;
 
     public MiddlewareRepositorySessionFinishDelegate(MiddlewareRepositorySession outerSession, RepositorySessionFinishDelegate next) {
       this.outerSession = outerSession;
       this.next = next;
     }
 
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/sync/net/SyncStorageRecordRequest.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/sync/net/SyncStorageRecordRequest.java
@@ -30,17 +30,17 @@ import java.net.URISyntaxException;
  * * Timeouts
  * * Network errors
  * * application/newlines
  * * JSON parsing
  * * Content-Type and Content-Length validation.
  */
 public class SyncStorageRecordRequest extends SyncStorageRequest {
 
-  public class SyncStorageRecordResourceDelegate extends SyncStorageResourceDelegate {
+  public static final class SyncStorageRecordResourceDelegate extends SyncStorageResourceDelegate {
     SyncStorageRecordResourceDelegate(SyncStorageRequest request) {
       super(request);
     }
   }
 
   public SyncStorageRecordRequest(URI uri) {
     super(uri);
   }
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/sync/net/SyncStorageRequest.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/sync/net/SyncStorageRequest.java
@@ -90,17 +90,17 @@ public class SyncStorageRequest implemen
   @Override
   public String getHostname() {
     return this.resource.getHostname();
   }
 
   /**
    * A ResourceDelegate that mediates between Resource-level notifications and the SyncStorageRequest.
    */
-  public class SyncStorageResourceDelegate extends BaseResourceDelegate {
+  public static class SyncStorageResourceDelegate extends BaseResourceDelegate {
     private static final String LOG_TAG = "SSResourceDelegate";
     protected SyncStorageRequest request;
 
     SyncStorageResourceDelegate(SyncStorageRequest request) {
       super(request);
       this.request = request;
     }
 
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/sync/stage/FormHistoryServerSyncStage.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/sync/stage/FormHistoryServerSyncStage.java
@@ -85,17 +85,17 @@ public class FormHistoryServerSyncStage 
   protected Repository getLocalRepository() {
     return new BufferingMiddlewareRepository(
             session.getSyncDeadline(),
             new MemoryBufferStorage(),
             new FormHistoryRepositorySession.FormHistoryRepository()
     );
   }
 
-  public class FormHistoryRecordFactory extends RecordFactory {
+  public static final class FormHistoryRecordFactory extends RecordFactory {
 
     @Override
     public Record createRecord(Record record) {
       FormHistoryRecord r = new FormHistoryRecord();
       r.initFromEnvelope((CryptoRecord) record);
       return r;
     }
   }
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/sync/stage/ServerSyncStage.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/sync/stage/ServerSyncStage.java
@@ -277,17 +277,17 @@ public abstract class ServerSyncStage ex
     }
     config.localBundle.setTimestamp(0L);
     config.remoteBundle.setTimestamp(0L);
     persistConfig(config);
     Logger.info(LOG_TAG, "Reset timestamps for " + this);
   }
 
   // Not thread-safe. Use with caution.
-  private class WipeWaiter {
+  private static final class WipeWaiter {
     public boolean sessionSucceeded = true;
     public boolean wipeSucceeded = true;
     public Exception error;
 
     public void notify(Exception e, boolean sessionSucceeded) {
       this.sessionSucceeded = sessionSucceeded;
       this.wipeSucceeded = false;
       this.error = e;