Bug 1437430: Make some immutable final fields static; r=mcomella
authorAndrew Gaul <andrew@gaul.org>
Sun, 11 Feb 2018 22:36:58 -0800
changeset 766811 e0a19b7fc6f6a44a990dacf210e871eda7eeddce
parent 766810 e2f69088b1d7074deeda9acd0b912d520de6b4ff
child 766812 6a5c578363175af82fa91ca20f871d58f67fd0f6
push id102399
push userbmo:mratcliffe@mozilla.com
push dateTue, 13 Mar 2018 10:12:19 +0000
reviewersmcomella
bugs1437430
milestone61.0a1
Bug 1437430: Make some immutable final fields static; r=mcomella Adding static reduces memory overhead from per-instance to per-class and allows initialization at compile-time instead of run-time. Found via a proposed error-prone pull request: https://github.com/google/error-prone/pull/930 MozReview-Commit-ID: CMj6vqFeCdI
mobile/android/base/java/org/mozilla/gecko/ActionModeCompat.java
mobile/android/base/java/org/mozilla/gecko/ActionModeCompatView.java
mobile/android/base/java/org/mozilla/gecko/SiteIdentity.java
mobile/android/base/java/org/mozilla/gecko/home/CombinedHistoryPanel.java
mobile/android/base/java/org/mozilla/gecko/preferences/CustomListPreference.java
mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
mobile/android/base/java/org/mozilla/gecko/preferences/ModifiableHintPreference.java
mobile/android/base/java/org/mozilla/gecko/preferences/PanelsPreference.java
mobile/android/base/java/org/mozilla/gecko/preferences/SearchEnginePreference.java
mobile/android/base/java/org/mozilla/gecko/prompts/ColorPickerInput.java
mobile/android/services/src/androidTest/java/org/mozilla/gecko/background/db/TestPasswordsRepository.java
mobile/android/services/src/androidTest/java/org/mozilla/gecko/background/db/ThreadedRepositoryTestCase.java
mobile/android/services/src/androidTest/java/org/mozilla/gecko/background/helpers/AndroidSyncTestCase.java
mobile/android/services/src/main/java/org/mozilla/gecko/fxa/authenticator/AndroidFxAccount.java
mobile/android/services/src/main/java/org/mozilla/gecko/sync/net/GzipNonChunkedCompressingEntity.java
mobile/android/services/src/main/java/org/mozilla/gecko/sync/repositories/NonPersistentRepositoryStateProvider.java
mobile/android/services/src/main/java/org/mozilla/gecko/sync/repositories/uploaders/RecordUploadRunnable.java
mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/StringHelper.java
mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testAddSearchEngine.java
mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testBrowserProvider.java
mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testGeckoProfile.java
--- a/mobile/android/base/java/org/mozilla/gecko/ActionModeCompat.java
+++ b/mobile/android/base/java/org/mozilla/gecko/ActionModeCompat.java
@@ -16,17 +16,17 @@ import android.widget.Toast;
 import org.mozilla.gecko.menu.GeckoMenu;
 import org.mozilla.gecko.menu.GeckoMenuItem;
 import org.mozilla.gecko.widget.ActionModePresenter;
 import org.mozilla.gecko.widget.GeckoPopupMenu;
 
 class ActionModeCompat extends ActionMode implements GeckoPopupMenu.OnMenuItemClickListener,
         GeckoPopupMenu.OnMenuItemLongClickListener,
         View.OnClickListener {
-    private final String LOGTAG = "GeckoActionModeCompat";
+    private static final String LOGTAG = "GeckoActionModeCompat";
 
     private final Callback mCallback;
     private final ActionModeCompatView mView;
     private final ActionModePresenter mPresenter;
 
     public ActionModeCompat(@NonNull ActionModePresenter presenter,
                             @Nullable Callback callback,
                             @NonNull ActionModeCompatView view) {
--- a/mobile/android/base/java/org/mozilla/gecko/ActionModeCompatView.java
+++ b/mobile/android/base/java/org/mozilla/gecko/ActionModeCompatView.java
@@ -20,17 +20,17 @@ import android.view.ViewGroup;
 import android.view.animation.Animation;
 import android.view.animation.ScaleAnimation;
 import android.view.animation.TranslateAnimation;
 import android.widget.Button;
 import android.widget.ImageButton;
 import android.widget.LinearLayout;
 
 class ActionModeCompatView extends LinearLayout implements GeckoMenu.ActionItemBarPresenter {
-    private final String LOGTAG = "GeckoActionModeCompatPresenter";
+    private static final String LOGTAG = "GeckoActionModeCompatPresenter";
 
     private static final int SPEC = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
 
     private Button mTitleView;
     private ImageButton mMenuButton;
     private ViewGroup mActionButtonBar;
     private GeckoPopupMenu mPopupMenu;
 
--- a/mobile/android/base/java/org/mozilla/gecko/SiteIdentity.java
+++ b/mobile/android/base/java/org/mozilla/gecko/SiteIdentity.java
@@ -7,17 +7,17 @@ package org.mozilla.gecko;
 
 import org.mozilla.gecko.util.GeckoBundle;
 
 import java.util.Locale;
 
 import android.text.TextUtils;
 
 public class SiteIdentity {
-    private final String LOGTAG = "GeckoSiteIdentity";
+    private static final String LOGTAG = "GeckoSiteIdentity";
     private SecurityMode mSecurityMode;
     private boolean mSecure;
     private MixedMode mMixedModeActive;
     private MixedMode mMixedModeDisplay;
     private TrackingMode mTrackingMode;
     private boolean mSecurityException;
     private String mHost;
     private String mOwner;
--- a/mobile/android/base/java/org/mozilla/gecko/home/CombinedHistoryPanel.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/CombinedHistoryPanel.java
@@ -59,18 +59,18 @@ import java.util.List;
 import static org.mozilla.gecko.home.CombinedHistoryPanel.OnPanelLevelChangeListener.PanelLevel.PARENT;
 import static org.mozilla.gecko.home.CombinedHistoryPanel.OnPanelLevelChangeListener.PanelLevel.CHILD_SYNC;
 import static org.mozilla.gecko.home.CombinedHistoryPanel.OnPanelLevelChangeListener.PanelLevel.CHILD_RECENT_TABS;
 
 public class CombinedHistoryPanel extends HomeFragment implements RemoteClientsDialogFragment.RemoteClientsListener {
     private static final String LOGTAG = "GeckoCombinedHistoryPnl";
 
     private static final String[] STAGES_TO_SYNC_ON_REFRESH = new String[] { "clients", "tabs" };
-    private final int LOADER_ID_HISTORY = 0;
-    private final int LOADER_ID_REMOTE = 1;
+    private static final int LOADER_ID_HISTORY = 0;
+    private static final int LOADER_ID_REMOTE = 1;
 
     // String placeholders to mark formatting.
     private final static String FORMAT_S1 = "%1$s";
     private final static String FORMAT_S2 = "%2$s";
 
     private CombinedHistoryRecyclerView mRecyclerView;
     private CombinedHistoryAdapter mHistoryAdapter;
     private ClientsAdapter mClientsAdapter;
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/CustomListPreference.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/CustomListPreference.java
@@ -16,17 +16,17 @@ import android.widget.TextView;
 
 /**
  * Represents an element in a <code>CustomListCategory</code> preference menu.
  * This preference con display a dialog when clicked, and also supports
  * being set as a default item within the preference list category.
  */
 
 public abstract class CustomListPreference extends Preference implements View.OnLongClickListener {
-    protected String LOGTAG = "CustomListPreference";
+    protected static final String LOGTAG = "CustomListPreference";
 
     // Indices of the buttons of the Dialog.
     public static final int INDEX_SET_DEFAULT_BUTTON = 0;
 
     // Dialog item labels.
     private String[] mDialogItems;
 
     // Dialog displayed when this element is tapped.
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
@@ -876,18 +876,18 @@ public class GeckoPreferences
             restoreDefaultSearchEngines();
             Telemetry.sendUIEvent(TelemetryContract.Event.SEARCH_RESTORE_DEFAULTS, Method.MENU);
             return true;
        }
 
         return super.onOptionsItemSelected(item);
     }
 
-    final private int DIALOG_CREATE_MASTER_PASSWORD = 0;
-    final private int DIALOG_REMOVE_MASTER_PASSWORD = 1;
+    private static final int DIALOG_CREATE_MASTER_PASSWORD = 0;
+    private static final int DIALOG_REMOVE_MASTER_PASSWORD = 1;
 
     public static void setCharEncodingState(boolean enabled) {
         sIsCharEncodingEnabled = enabled;
     }
 
     public static boolean getCharEncodingState() {
         return sIsCharEncodingEnabled;
     }
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/ModifiableHintPreference.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/ModifiableHintPreference.java
@@ -17,20 +17,20 @@ import android.util.AttributeSet;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.TextView;
 
 class ModifiableHintPreference extends Preference {
     private static final String LOGTAG = "ModifiableHintPref";
     private final Context mContext;
 
-    private final String MATCH_STRING = "%I";
-    private final int RESID_TEXT_VIEW = R.id.label_search_hint;
-    private final int RESID_DRAWABLE = R.drawable.ab_add_search_engine;
-    private final double SCALE_FACTOR = 0.5;
+    private static final String MATCH_STRING = "%I";
+    private static final int RESID_TEXT_VIEW = R.id.label_search_hint;
+    private static final int RESID_DRAWABLE = R.drawable.ab_add_search_engine;
+    private static final double SCALE_FACTOR = 0.5;
 
     public ModifiableHintPreference(Context context, AttributeSet attrs) {
         super(context, attrs);
         mContext = context;
     }
 
     public ModifiableHintPreference(Context context, AttributeSet attrs, int defStyle) {
         super(context, attrs, defStyle);
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/PanelsPreference.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/PanelsPreference.java
@@ -17,17 +17,17 @@ import android.content.DialogInterface.O
 import android.content.DialogInterface.OnShowListener;
 import android.content.res.Resources;
 import android.util.Log;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.TextView;
 
 public class PanelsPreference extends CustomListPreference {
-    protected String LOGTAG = "PanelsPreference";
+    protected static final String LOGTAG = "PanelsPreference";
 
     // Position state of this Preference in enclosing category.
     private static final int STATE_IS_FIRST = 0;
     private static final int STATE_IS_LAST = 1;
 
     /**
      * Index of the context menu button for controlling display options.
      * For (removable) Dynamic panels, this button removes the panel.
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/SearchEnginePreference.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/SearchEnginePreference.java
@@ -23,17 +23,17 @@ import android.text.SpannableString;
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.View;
 
 /**
  * Represents an element in the list of search engines on the preferences menu.
  */
 public class SearchEnginePreference extends CustomListPreference {
-    protected String LOGTAG = "SearchEnginePreference";
+    protected static final String LOGTAG = "SearchEnginePreference";
 
     protected static final int INDEX_REMOVE_BUTTON = 1;
 
     // The icon to display in the prompt when clicked.
     private BitmapDrawable mPromptIcon;
 
     // The bitmap backing the drawable above - needed separately for the FaviconView.
     private Bitmap mIconBitmap;
--- a/mobile/android/base/java/org/mozilla/gecko/prompts/ColorPickerInput.java
+++ b/mobile/android/base/java/org/mozilla/gecko/prompts/ColorPickerInput.java
@@ -13,17 +13,17 @@ import android.content.Context;
 import android.graphics.Color;
 import android.view.LayoutInflater;
 import android.view.View;
 
 public class ColorPickerInput extends PromptInput {
     public static final String INPUT_TYPE = "color";
     public static final String LOGTAG = "GeckoColorPickerInput";
 
-    private final boolean mShowAdvancedButton = true;
+    private static final boolean mShowAdvancedButton = true;
     private final int mInitialColor;
 
     public ColorPickerInput(GeckoBundle obj) {
         super(obj);
         String init = obj.getString("value");
         mInitialColor = Color.rgb(Integer.parseInt(init.substring(1, 3), 16),
                                   Integer.parseInt(init.substring(3, 5), 16),
                                   Integer.parseInt(init.substring(5, 7), 16));
--- a/mobile/android/services/src/androidTest/java/org/mozilla/gecko/background/db/TestPasswordsRepository.java
+++ b/mobile/android/services/src/androidTest/java/org/mozilla/gecko/background/db/TestPasswordsRepository.java
@@ -28,18 +28,18 @@ import org.mozilla.gecko.sync.repositori
 import org.mozilla.gecko.sync.repositories.domain.Record;
 
 import android.content.ContentProviderClient;
 import android.content.ContentValues;
 import android.content.Context;
 import android.database.Cursor;
 
 public class TestPasswordsRepository extends AndroidSyncTestCase {
-  private final String NEW_PASSWORD1 = "password";
-  private final String NEW_PASSWORD2 = "drowssap";
+  private static final String NEW_PASSWORD1 = "password";
+  private static final String NEW_PASSWORD2 = "drowssap";
 
   @Override
   public void setUp() {
     wipe();
     assertTrue(WaitHelper.getTestWaiter().isIdle());
   }
 
   public void testFetchAll() throws Exception {
--- a/mobile/android/services/src/androidTest/java/org/mozilla/gecko/background/db/ThreadedRepositoryTestCase.java
+++ b/mobile/android/services/src/androidTest/java/org/mozilla/gecko/background/db/ThreadedRepositoryTestCase.java
@@ -31,17 +31,17 @@ import org.mozilla.gecko.sync.repositori
 import org.mozilla.gecko.sync.repositories.android.DataAccessor;
 import org.mozilla.gecko.sync.repositories.delegates.RepositorySessionWipeDelegate;
 import org.mozilla.gecko.sync.repositories.domain.Record;
 
 import android.content.ContentValues;
 import android.content.Context;
 
 public abstract class ThreadedRepositoryTestCase extends AndroidSyncTestCase {
-  protected static String LOG_TAG = "BrowserRepositoryTest";
+  protected static final String LOG_TAG = "BrowserRepositoryTest";
 
   protected static void wipe(DataAccessor helper) {
     Logger.debug(LOG_TAG, "Wiping.");
     try {
       helper.wipe();
     } catch (NullPointerException e) {
       // This will be handled in begin, here we can just ignore
       // the error if it actually occurs since this is just test
--- a/mobile/android/services/src/androidTest/java/org/mozilla/gecko/background/helpers/AndroidSyncTestCase.java
+++ b/mobile/android/services/src/androidTest/java/org/mozilla/gecko/background/helpers/AndroidSyncTestCase.java
@@ -10,17 +10,17 @@ import org.mozilla.gecko.background.test
 import android.app.Activity;
 import android.content.Context;
 import android.test.ActivityInstrumentationTestCase2;
 
 /**
  * AndroidSyncTestCase provides helper methods for testing.
  */
 public class AndroidSyncTestCase extends ActivityInstrumentationTestCase2<Activity> {
-  protected static String LOG_TAG = "AndroidSyncTestCase";
+  protected static final String LOG_TAG = "AndroidSyncTestCase";
 
   public AndroidSyncTestCase() {
     super(Activity.class);
     WaitHelper.resetTestWaiter();
   }
 
   public Context getApplicationContext() {
     return this.getInstrumentation().getTargetContext();
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/authenticator/AndroidFxAccount.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/authenticator/AndroidFxAccount.java
@@ -152,17 +152,17 @@ public class AndroidFxAccount {
     keysToCarryOver.add(ACCOUNT_KEY_DESCRIPTOR);
     ACCOUNT_KEY_TO_CARRY_OVER_ON_RENAME_SET = Collections.unmodifiableList(keysToCarryOver);
   }
 
   private static final String PREF_KEY_LAST_SYNCED_TIMESTAMP = "lastSyncedTimestamp";
 
   protected final Context context;
   private final AccountManager accountManager;
-  private final long neverSynced = -1;
+  private static final long neverSynced = -1;
 
   // This is really, really meant to be final. Only changed when account name changes.
   // See Bug 1368147.
   protected volatile Account account;
 
   /**
    * Create an Android Firefox Account instance backed by an Android Account
    * instance.
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/sync/net/GzipNonChunkedCompressingEntity.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/sync/net/GzipNonChunkedCompressingEntity.java
@@ -19,17 +19,17 @@ import java.io.OutputStream;
  * This differs from {@link GzipCompressingEntity} in that it does not chunk
  * the sent data, therefore replacing the "Transfer-Encoding" HTTP header with
  * the "Content-Length" header required by some servers.
  *
  * However, to measure the content length, the gzipped content will be temporarily
  * stored in memory so be careful what content you send!
  */
 public class GzipNonChunkedCompressingEntity extends GzipCompressingEntity {
-    final int MAX_BUFFER_SIZE_BYTES = 10 * 1000 * 1000; // 10 MB.
+    static final int MAX_BUFFER_SIZE_BYTES = 10 * 1000 * 1000; // 10 MB.
 
     private byte[] gzippedContent;
 
     public GzipNonChunkedCompressingEntity(final HttpEntity entity) {
         super(entity);
     }
 
     /**
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/sync/repositories/NonPersistentRepositoryStateProvider.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/sync/repositories/NonPersistentRepositoryStateProvider.java
@@ -14,17 +14,17 @@ import java.util.Map;
  * Simple non-persistent implementation of a repository state provider.
  *
  * Just like in the persistent implementation, changes to values are visible only after a commit.
  *
  * @author grisha
  */
 public class NonPersistentRepositoryStateProvider implements RepositoryStateProvider {
     // We'll have at least OFFSET and H.W.M. values set.
-    private final int INITIAL_CAPACITY = 2;
+    private static final int INITIAL_CAPACITY = 2;
     private final Map<String, Object> nonCommittedValuesMap = Collections.synchronizedMap(
             new HashMap<String, Object>(INITIAL_CAPACITY)
     );
 
     // NB: Any changes are made by creating a new map instead of altering an existing one.
     private volatile Map<String, Object> committedValuesMap = new HashMap<>(INITIAL_CAPACITY);
 
     @Override
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/sync/repositories/uploaders/RecordUploadRunnable.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/sync/repositories/uploaders/RecordUploadRunnable.java
@@ -22,17 +22,17 @@ import java.util.ArrayList;
 
 import ch.boye.httpclientandroidlib.entity.ContentProducer;
 import ch.boye.httpclientandroidlib.entity.EntityTemplate;
 
 /**
  * Responsible for creating and posting a <code>SyncStorageRequest</code> request object.
  */
 public class RecordUploadRunnable implements Runnable {
-    public final String LOG_TAG = "RecordUploadRunnable";
+    public static final String LOG_TAG = "RecordUploadRunnable";
 
     public final static byte[] RECORDS_START = { 91 };      // [ in UTF-8
     public final static byte[] RECORD_SEPARATOR = { 44 };   // , in UTF-8
     public final static byte[] RECORDS_END = { 93 };        // ] in UTF-8
 
     private static final String QUERY_PARAM_BATCH = "batch";
     private static final String QUERY_PARAM_TRUE = "true";
     private static final String QUERY_PARAM_BATCH_COMMIT = "commit";
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/StringHelper.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/StringHelper.java
@@ -8,51 +8,51 @@ package org.mozilla.gecko.tests;
 import android.content.res.Resources;
 
 import org.mozilla.gecko.R;
 
 public class StringHelper {
     private static StringHelper instance;
 
     // This needs to be accessed statically, before an instance of StringHelper can be created.
-    public static String STATIC_ABOUT_HOME_URL = "about:home";
+    public static final String STATIC_ABOUT_HOME_URL = "about:home";
 
     public final String OK;
     public final String CANCEL;
     public final String CLEAR;
 
     // Note: DEFAULT_BOOKMARKS_TITLES.length == DEFAULT_BOOKMARKS_URLS.length
     public final String[] DEFAULT_BOOKMARKS_TITLES;
     public final String[] DEFAULT_BOOKMARKS_URLS;
     public final int DEFAULT_BOOKMARKS_COUNT;
 
     // About pages
-    public final String ABOUT_BLANK_URL = "about:blank";
+    public static final String ABOUT_BLANK_URL = "about:blank";
     public final String ABOUT_FIREFOX_URL;
-    public final String ABOUT_HOME_URL = "about:home";
-    public final String ABOUT_ADDONS_URL = "about:addons";
-    public final String ABOUT_SCHEME = "about:";
+    public static final String ABOUT_HOME_URL = "about:home";
+    public static final String ABOUT_ADDONS_URL = "about:addons";
+    public static final String ABOUT_SCHEME = "about:";
 
     // About pages' titles
-    public final String ABOUT_HOME_TITLE = "";
+    public static final String ABOUT_HOME_TITLE = "";
 
     // Context Menu item strings
-    public final String CONTEXT_MENU_BOOKMARK_LINK = "Bookmark Link";
-    public final String CONTEXT_MENU_OPEN_LINK_IN_NEW_TAB = "Open Link in New Tab";
+    public static final String CONTEXT_MENU_BOOKMARK_LINK = "Bookmark Link";
+    public static final String CONTEXT_MENU_OPEN_LINK_IN_NEW_TAB = "Open Link in New Tab";
     public final String CONTEXT_MENU_OPEN_IN_NEW_TAB;
-    public final String CONTEXT_MENU_OPEN_LINK_IN_PRIVATE_TAB = "Open Link in Private Tab";
+    public static final String CONTEXT_MENU_OPEN_LINK_IN_PRIVATE_TAB = "Open Link in Private Tab";
     public final String CONTEXT_MENU_OPEN_IN_PRIVATE_TAB;
-    public final String CONTEXT_MENU_COPY_LINK = "Copy Link";
-    public final String CONTEXT_MENU_SHARE_LINK = "Share Link";
+    public static final String CONTEXT_MENU_COPY_LINK = "Copy Link";
+    public static final String CONTEXT_MENU_SHARE_LINK = "Share Link";
     public final String CONTEXT_MENU_EDIT;
     public final String CONTEXT_MENU_SHARE;
     public final String CONTEXT_MENU_REMOVE;
     public final String CONTEXT_MENU_COPY_ADDRESS;
     public final String CONTEXT_MENU_EDIT_SITE_SETTINGS;
-    public final String CONTEXT_MENU_SITE_SETTINGS_SAVE_PASSWORD = "Save Password";
+    public static final String CONTEXT_MENU_SITE_SETTINGS_SAVE_PASSWORD = "Save Password";
     public final String CONTEXT_MENU_ADD_TO_HOME_SCREEN;
     public final String CONTEXT_MENU_PIN_SITE;
     public final String CONTEXT_MENU_UNPIN_SITE;
 
     // Context Menu menu items
     public final String[] CONTEXT_MENU_ITEMS_IN_PRIVATE_TAB;
 
     public final String[] CONTEXT_MENU_ITEMS_IN_NORMAL_TAB;
@@ -60,71 +60,71 @@ public class StringHelper {
     public final String[] BOOKMARK_CONTEXT_MENU_ITEMS;
 
     public final String[] CONTEXT_MENU_ITEMS_IN_URL_BAR;
 
     public final String TITLE_PLACE_HOLDER;
 
     // Robocop page urls
     // Note: please use getAbsoluteUrl(String url) on each robocop url to get the correct url
-    public final String ROBOCOP_BIG_LINK_URL = "/robocop/robocop_big_link.html";
-    public final String ROBOCOP_BIG_MAILTO_URL = "/robocop/robocop_big_mailto.html";
-    public final String ROBOCOP_BLANK_PAGE_01_URL = "/robocop/robocop_blank_01.html";
-    public final String ROBOCOP_BLANK_PAGE_02_URL = "/robocop/robocop_blank_02.html";
-    public final String ROBOCOP_BLANK_PAGE_03_URL = "/robocop/robocop_blank_03.html";
-    public final String ROBOCOP_BLANK_PAGE_04_URL = "/robocop/robocop_blank_04.html";
-    public final String ROBOCOP_BLANK_PAGE_05_URL = "/robocop/robocop_blank_05.html";
-    public final String ROBOCOP_BOXES_URL = "/robocop/robocop_boxes.html";
-    public final String ROBOCOP_GEOLOCATION_URL = "/robocop/robocop_geolocation.html";
-    public final String ROBOCOP_LOGIN_01_URL= "/robocop/robocop_login_01.html";
-    public final String ROBOCOP_LOGIN_02_URL= "/robocop/robocop_login_02.html";
-    public final String ROBOCOP_POPUP_URL = "/robocop/robocop_popup.html";
-    public final String ROBOCOP_OFFLINE_STORAGE_URL = "/robocop/robocop_offline_storage.html";
-    public final String ROBOCOP_PICTURE_LINK_URL = "/robocop/robocop_picture_link.html";
-    public final String ROBOCOP_SEARCH_URL = "/robocop/robocop_search.html";
-    public final String ROBOCOP_TEXT_PAGE_URL = "/robocop/robocop_text_page.html";
-    public final String ROBOCOP_INPUT_URL = "/robocop/robocop_input.html";
-    public final String ROBOCOP_READER_MODE_BASIC_ARTICLE = "/robocop/reader_mode_pages/basic_article.html";
-    public final String ROBOCOP_LINK_TO_SLOW_LOADING = "/robocop/robocop_link_to_slow_loading.html";
-    public final String ROBOCOP_MEDIA_PLAYBACK_JS_URL = "/robocop/robocop_media_playback_js.html";
-    public final String ROBOCOP_MEDIA_PLAYBACK_LOOP_URL = "/robocop/robocop_media_playback_loop.html";
+    public static final String ROBOCOP_BIG_LINK_URL = "/robocop/robocop_big_link.html";
+    public static final String ROBOCOP_BIG_MAILTO_URL = "/robocop/robocop_big_mailto.html";
+    public static final String ROBOCOP_BLANK_PAGE_01_URL = "/robocop/robocop_blank_01.html";
+    public static final String ROBOCOP_BLANK_PAGE_02_URL = "/robocop/robocop_blank_02.html";
+    public static final String ROBOCOP_BLANK_PAGE_03_URL = "/robocop/robocop_blank_03.html";
+    public static final String ROBOCOP_BLANK_PAGE_04_URL = "/robocop/robocop_blank_04.html";
+    public static final String ROBOCOP_BLANK_PAGE_05_URL = "/robocop/robocop_blank_05.html";
+    public static final String ROBOCOP_BOXES_URL = "/robocop/robocop_boxes.html";
+    public static final String ROBOCOP_GEOLOCATION_URL = "/robocop/robocop_geolocation.html";
+    public static final String ROBOCOP_LOGIN_01_URL= "/robocop/robocop_login_01.html";
+    public static final String ROBOCOP_LOGIN_02_URL= "/robocop/robocop_login_02.html";
+    public static final String ROBOCOP_POPUP_URL = "/robocop/robocop_popup.html";
+    public static final String ROBOCOP_OFFLINE_STORAGE_URL = "/robocop/robocop_offline_storage.html";
+    public static final String ROBOCOP_PICTURE_LINK_URL = "/robocop/robocop_picture_link.html";
+    public static final String ROBOCOP_SEARCH_URL = "/robocop/robocop_search.html";
+    public static final String ROBOCOP_TEXT_PAGE_URL = "/robocop/robocop_text_page.html";
+    public static final String ROBOCOP_INPUT_URL = "/robocop/robocop_input.html";
+    public static final String ROBOCOP_READER_MODE_BASIC_ARTICLE = "/robocop/reader_mode_pages/basic_article.html";
+    public static final String ROBOCOP_LINK_TO_SLOW_LOADING = "/robocop/robocop_link_to_slow_loading.html";
+    public static final String ROBOCOP_MEDIA_PLAYBACK_JS_URL = "/robocop/robocop_media_playback_js.html";
+    public static final String ROBOCOP_MEDIA_PLAYBACK_LOOP_URL = "/robocop/robocop_media_playback_loop.html";
 
-    private final String ROBOCOP_JS_HARNESS_URL = "/robocop/robocop_javascript.html";
+    private static final String ROBOCOP_JS_HARNESS_URL = "/robocop/robocop_javascript.html";
 
     // Robocop page images
-    public final String ROBOCOP_PICTURE_URL = "/robocop/Firefox.jpg";
+    public static final String ROBOCOP_PICTURE_URL = "/robocop/Firefox.jpg";
 
     // Robocop page titles
-    public final String ROBOCOP_BIG_LINK_TITLE = "Big Link";
-    public final String ROBOCOP_BIG_MAILTO_TITLE = "Big Mailto";
-    public final String ROBOCOP_BLANK_PAGE_01_TITLE = "Browser Blank Page 01";
-    public final String ROBOCOP_BLANK_PAGE_02_TITLE = "Browser Blank Page 02";
-    public final String ROBOCOP_GEOLOCATION_TITLE = "Geolocation Test Page";
-    public final String ROBOCOP_PICTURE_LINK_TITLE = "Picture Link";
-    public final String ROBOCOP_SEARCH_TITLE = "Robocop Search Engine";
+    public static final String ROBOCOP_BIG_LINK_TITLE = "Big Link";
+    public static final String ROBOCOP_BIG_MAILTO_TITLE = "Big Mailto";
+    public static final String ROBOCOP_BLANK_PAGE_01_TITLE = "Browser Blank Page 01";
+    public static final String ROBOCOP_BLANK_PAGE_02_TITLE = "Browser Blank Page 02";
+    public static final String ROBOCOP_GEOLOCATION_TITLE = "Geolocation Test Page";
+    public static final String ROBOCOP_PICTURE_LINK_TITLE = "Picture Link";
+    public static final String ROBOCOP_SEARCH_TITLE = "Robocop Search Engine";
 
     // Distribution tile labels
-    public final String DISTRIBUTION1_LABEL = "Distribution 1";
-    public final String DISTRIBUTION2_LABEL = "Distribution 2";
+    public static final String DISTRIBUTION1_LABEL = "Distribution 1";
+    public static final String DISTRIBUTION2_LABEL = "Distribution 2";
 
     // Settings menu strings
     public final String GENERAL_SECTION_LABEL;
     public final String SEARCH_SECTION_LABEL;
     public final String PRIVACY_SECTION_LABEL;
     public final String ACCESSIBILITY_SECTION_LABEL;
     public final String NOTIFICATIONS_SECTION_LABEL;
     public final String ADVANCED_SECTION_LABEL;
     public final String CLEAR_PRIVATE_DATA_SECTION_LABEL;
     public final String DEFAULT_BROWSER_SECTION_LABEL;
     public final String MOZILLA_SECTION_LABEL;
 
     // Mozilla
-    public final String BRAND_NAME = "(Fennec|Nightly|Firefox Aurora|Firefox Beta|Firefox)";
-    public final String ABOUT_LABEL = "About " + BRAND_NAME ;
-    public final String LOCATION_SERVICES_LABEL = "Mozilla Location Service";
+    public static final String BRAND_NAME = "(Fennec|Nightly|Firefox Aurora|Firefox Beta|Firefox)";
+    public static final String ABOUT_LABEL = "About " + BRAND_NAME ;
+    public static final String LOCATION_SERVICES_LABEL = "Mozilla Location Service";
 
     // Labels for the about:home tabs
     public final String HISTORY_LABEL;
     public final String TOP_SITES_LABEL;
     public final String BOOKMARKS_LABEL;
     public final String TODAY_LABEL;
 
     // Desktop default bookmarks folders
@@ -150,49 +150,49 @@ public class StringHelper {
     public final String TAB_QUEUE_LABEL;
     public final String TAB_QUEUE_SUMMARY;
 
     // Android 3.0+
     public final String TOOLS_LABEL;
     public final String PAGE_LABEL;
 
     // Android 2.3 and lower only
-    public final String MORE_LABEL = "More";
+    public static final String MORE_LABEL = "More";
     public final String RELOAD_LABEL;
     public final String FORWARD_LABEL;
     public final String BOOKMARK_LABEL;
 
     // Bookmark Toast Notification
     public final String BOOKMARK_ADDED_LABEL;
     public final String BOOKMARK_REMOVED_LABEL;
     public final String BOOKMARK_UPDATED_LABEL;
     public final String BOOKMARK_OPTIONS_LABEL;
 
     // Edit Bookmark screen
     public final String EDIT_BOOKMARK;
 
     // Strings used in doorhanger messages and buttons
-    public final String GEO_MESSAGE = "Share your location with";
+    public static final String GEO_MESSAGE = "Share your location with";
     public final String GEO_ALLOW;
-    public final String GEO_DENY = "Don't share";
+    public static final String GEO_DENY = "Don't share";
 
-    public final String OFFLINE_MESSAGE = "to store data on your device for offline use";
-    public final String OFFLINE_ALLOW = "Allow";
-    public final String OFFLINE_DENY = "Don't allow";
+    public static final String OFFLINE_MESSAGE = "to store data on your device for offline use";
+    public static final String OFFLINE_ALLOW = "Allow";
+    public static final String OFFLINE_DENY = "Don't allow";
 
-    public final String LOGIN_MESSAGE = "Would you like " + BRAND_NAME + " to remember this login?";
-    public final String LOGIN_ALLOW = "Remember";
-    public final String LOGIN_DENY = "Never";
+    public static final String LOGIN_MESSAGE = "Would you like " + BRAND_NAME + " to remember this login?";
+    public static final String LOGIN_ALLOW = "Remember";
+    public static final String LOGIN_DENY = "Never";
 
-    public final String POPUP_MESSAGE = "prevented this site from opening";
+    public static final String POPUP_MESSAGE = "prevented this site from opening";
     public final String POPUP_ALLOW;
-    public final String POPUP_DENY = "Don't show";
+    public static final String POPUP_DENY = "Don't show";
 
     // Strings used as content description, e.g. for ImageButtons
-    public final String CONTENT_DESCRIPTION_READER_MODE_BUTTON = "Enter Reader View";
+    public static final String CONTENT_DESCRIPTION_READER_MODE_BUTTON = "Enter Reader View";
 
     // Home Panel Settings
     public final String CUSTOMIZE_HOME;
     public final String ENABLED;
     public final String HISTORY;
     public final String PANELS;
 
     // General Settings
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testAddSearchEngine.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testAddSearchEngine.java
@@ -21,19 +21,19 @@ import com.robotium.solo.Condition;
 
 /**
  * Test adding a search engine from an input field context menu.
  * 1. Get the number of existing search engines from the SearchEngines:Data event and as displayed in about:home.
  * 2. Load a page with a text field, open the context menu and add a search engine from the page.
  * 3. Get the number of search engines after adding the new one and verify it has increased by 1.
  */
 public class testAddSearchEngine extends AboutHomeTest {
-    private final int MAX_WAIT_TEST_MS = 5000;
-    private final String SEARCH_TEXT = "Firefox for Android";
-    private final String ADD_SEARCHENGINE_OPTION_TEXT = "Add as Search Engine";
+    private static final int MAX_WAIT_TEST_MS = 5000;
+    private static final String SEARCH_TEXT = "Firefox for Android";
+    private static final String ADD_SEARCHENGINE_OPTION_TEXT = "Add as Search Engine";
 
     public void testAddSearchEngine() {
         String blankPageURL = getAbsoluteUrl(mStringHelper.ROBOCOP_BLANK_PAGE_01_URL);
         String searchEngineURL = getAbsoluteUrl(mStringHelper.ROBOCOP_SEARCH_URL);
 
         blockForGeckoReady();
         int height = mDriver.getGeckoTop() + 150;
         int width = mDriver.getGeckoLeft() + 150;
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testBrowserProvider.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testBrowserProvider.java
@@ -1163,19 +1163,19 @@ public class testBrowserProvider extends
 
             mAsserter.is(new String(c.getBlob(c.getColumnIndex(BrowserContract.Combined.FAVICON)), "UTF8"),
                          newFavicon, "Updated favicon has corresponding favicon image");
             c.close();
         }
     }
 
     private class TestUpdateOrInsertHistory extends TestCase {
-        private final String TEST_URL_1 = "http://example.com";
-        private final String TEST_URL_2 = "http://example.org";
-        private final String TEST_TITLE = "Example";
+        private static final String TEST_URL_1 = "http://example.com";
+        private static final String TEST_URL_2 = "http://example.org";
+        private static final String TEST_TITLE = "Example";
 
         private long getHistoryEntryIdByUrl(String url) {
             Cursor c = mProvider.query(BrowserContract.History.CONTENT_URI,
                                        new String[] { BrowserContract.History._ID },
                                        BrowserContract.History.URL + " = ?",
                                        new String[] { url },
                                        null);
             c.moveToFirst();
@@ -1444,18 +1444,18 @@ public class testBrowserProvider extends
         @Override
         public void test() throws Exception {
             testInsertionViaContentProvider();
             testInsertionViaUrlMetadata();
             // testRetrievalViaUrlMetadata depends on data added in the previous two tests
             testRetrievalViaUrlMetadata();
         }
 
-        final String url1 = "http://mozilla.org";
-        final String url2 = "http://hello.org";
+        static final String url1 = "http://mozilla.org";
+        static final String url2 = "http://hello.org";
 
         private void testInsertionViaContentProvider() throws Exception {
             final String tileImage = "http://mozilla.org/tileImage.png";
             final String tileColor = "#FF0000";
             final String touchIcon = "http://mozilla.org/touchIcon.png";
 
             // We can only use update since the redirection machinery doesn't exist for insert
             mProvider.update(URLImageDataTable.CONTENT_URI.buildUpon().appendQueryParameter(BrowserContract.PARAM_INSERT_IF_NEEDED, "true").build(),
--- a/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testGeckoProfile.java
+++ b/mobile/android/tests/browser/robocop/src/org/mozilla/gecko/tests/testGeckoProfile.java
@@ -19,17 +19,17 @@ import android.content.Context;
 import android.text.TextUtils;
 
 /**
  * This patch tests GeckoProfile. It has unit tests for basic getting and removing of profiles, as well as
  * some guest mode tests. It does not test locking and unlocking profiles yet. It does not test the file management in GeckoProfile.
  */
 
 public class testGeckoProfile extends PixelTest {
-    private final String TEST_PROFILE_NAME = "testProfile";
+    private static final String TEST_PROFILE_NAME = "testProfile";
     private File mozDir;
     public void testGeckoProfile() {
         blockForGeckoReady();
 
         try {
             mozDir = GeckoProfileDirectories.getMozillaDirectory(getActivity());
         } catch(Exception ex) {
             // If we can't get the moz dir, something is wrong. Just fail quickly.