Bug 1258789 - Add switch for whitespaceAround. r=grisha
authorMichael Comella <michael.l.comella@gmail.com>
Tue, 12 Apr 2016 18:19:14 -0700
changeset 316838 30c0b243df2dd2af133a5258c8bce100225285dc
parent 316837 53f8e479322be4b823b444f562b4dc06c4920b63
child 316839 ebe249484944f34aab6da0539be018751c9a5444
push id9480
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 17:12:58 +0000
treeherdermozilla-aurora@0d6a91c76a9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgrisha
bugs1258789
milestone48.0a1
Bug 1258789 - Add switch for whitespaceAround. r=grisha MozReview-Commit-ID: 167JoSl5go5
mobile/android/app/checkstyle.xml
mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
mobile/android/base/java/org/mozilla/gecko/DoorHangerPopup.java
mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
mobile/android/base/java/org/mozilla/gecko/GeckoAppShell.java
mobile/android/base/java/org/mozilla/gecko/GeckoEvent.java
mobile/android/base/java/org/mozilla/gecko/db/BrowserDatabaseHelper.java
mobile/android/base/java/org/mozilla/gecko/home/BookmarksListAdapter.java
mobile/android/base/java/org/mozilla/gecko/home/CombinedHistoryRecyclerView.java
mobile/android/base/java/org/mozilla/gecko/home/DynamicPanel.java
mobile/android/base/java/org/mozilla/gecko/home/HomeConfig.java
mobile/android/base/java/org/mozilla/gecko/home/HomeFragment.java
mobile/android/base/java/org/mozilla/gecko/home/PanelItemView.java
mobile/android/base/java/org/mozilla/gecko/home/PanelLayout.java
mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
mobile/android/base/java/org/mozilla/gecko/preferences/PanelsPreference.java
mobile/android/base/java/org/mozilla/gecko/prompts/Prompt.java
mobile/android/base/java/org/mozilla/gecko/reader/ReadingListHelper.java
--- a/mobile/android/app/checkstyle.xml
+++ b/mobile/android/app/checkstyle.xml
@@ -50,13 +50,13 @@
         </module>
         <module name="OuterTypeFilename"/> <!-- `class Lol` only in Lol.java -->
         <module name="WhitespaceAfter">
             <!-- TODO: (bug 1263059) Remove specific tokens to enable CAST check. -->
             <property name="tokens" value="COMMA, SEMI"/>
         </module>
         <module name="WhitespaceAround">
             <property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN,
-                    LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN"/>
+                    LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SWITCH"/>
         </module>
     </module>
 
 </module>
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -319,17 +319,17 @@ public class BrowserApp extends GeckoApp
             // isn't tied to a specific tab.
             if (msg != Tabs.TabEvents.RESTORED) {
                 throw new IllegalArgumentException("onTabChanged:" + msg + " must specify a tab.");
             }
             return;
         }
 
         Log.d(LOGTAG, "BrowserApp.onTabChanged: " + tab.getId() + ": " + msg);
-        switch(msg) {
+        switch (msg) {
             case SELECTED:
                 if (Tabs.getInstance().isSelectedTab(tab) && mDynamicToolbar.isEnabled()) {
                     mDynamicToolbar.setVisible(true, VisibilityTransition.ANIMATE);
                 }
                 // fall through
             case LOCATION_CHANGE:
                 if (mZoomedView != null) {
                     mZoomedView.stopZoomDisplay(false);
--- a/mobile/android/base/java/org/mozilla/gecko/DoorHangerPopup.java
+++ b/mobile/android/base/java/org/mozilla/gecko/DoorHangerPopup.java
@@ -143,17 +143,17 @@ public class DoorHangerPopup extends Anc
         }
 
         return config;
     }
 
     // This callback is automatically executed on the UI thread.
     @Override
     public void onTabChanged(final Tab tab, final Tabs.TabEvents msg, final Object data) {
-        switch(msg) {
+        switch (msg) {
             case CLOSED:
                 // Remove any doorhangers for a tab when it's closed (make
                 // a temporary set to avoid a ConcurrentModificationException)
                 removeTabDoorHangers(tab.getId(), true);
                 break;
 
             case LOCATION_CHANGE:
                 // Only remove doorhangers if the popup is hidden or if we're navigating to a new URL
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
@@ -273,17 +273,17 @@ public abstract class GeckoApp
     public FormAssistPopup getFormAssistPopup() {
         return mFormAssistPopup;
     }
 
     @Override
     public void onTabChanged(Tab tab, Tabs.TabEvents msg, Object data) {
         // When a tab is closed, it is always unselected first.
         // When a tab is unselected, another tab is always selected first.
-        switch(msg) {
+        switch (msg) {
             case UNSELECTED:
                 hidePlugins(tab);
                 break;
 
             case LOCATION_CHANGE:
                 // We only care about location change for the selected tab.
                 if (!Tabs.getInstance().isSelectedTab(tab))
                     break;
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoAppShell.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoAppShell.java
@@ -536,17 +536,17 @@ public class GeckoAppShell
     public static void enableSensor(int aSensortype) {
         GeckoInterface gi = getGeckoInterface();
         if (gi == null) {
             return;
         }
         SensorManager sm = (SensorManager)
             getApplicationContext().getSystemService(Context.SENSOR_SERVICE);
 
-        switch(aSensortype) {
+        switch (aSensortype) {
         case GeckoHalDefines.SENSOR_GAME_ROTATION_VECTOR:
             if (gGameRotationVectorSensor == null) {
                 gGameRotationVectorSensor = sm.getDefaultSensor(15);
                     // sm.getDefaultSensor(
                     //     Sensor.TYPE_GAME_ROTATION_VECTOR); // API >= 18
             }
             if (gGameRotationVectorSensor != null) {
                 sm.registerListener(gi.getSensorEventListener(),
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoEvent.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoEvent.java
@@ -360,17 +360,17 @@ public class GeckoEvent {
         }
         return GeckoHalDefines.SENSOR_ACCURACY_UNKNOWN;
     }
 
     public static GeckoEvent createSensorEvent(SensorEvent s) {
         int sensor_type = s.sensor.getType();
         GeckoEvent event = null;
 
-        switch(sensor_type) {
+        switch (sensor_type) {
 
         case Sensor.TYPE_ACCELEROMETER:
             event = GeckoEvent.get(NativeGeckoEvent.SENSOR_EVENT);
             event.mFlags = GeckoHalDefines.SENSOR_ACCELERATION;
             event.mMetaState = HalSensorAccuracyFor(s.accuracy);
             event.mX = s.values[0];
             event.mY = s.values[1];
             event.mZ = s.values[2];
--- a/mobile/android/base/java/org/mozilla/gecko/db/BrowserDatabaseHelper.java
+++ b/mobile/android/base/java/org/mozilla/gecko/db/BrowserDatabaseHelper.java
@@ -1364,17 +1364,17 @@ public final class BrowserDatabaseHelper
     @Override
     public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
         debug("Upgrading browser.db: " + db.getPath() + " from " +
                 oldVersion + " to " + newVersion);
 
         // We have to do incremental upgrades until we reach the current
         // database schema version.
         for (int v = oldVersion + 1; v <= newVersion; v++) {
-            switch(v) {
+            switch (v) {
                 case 4:
                     upgradeDatabaseFrom3to4(db);
                     break;
 
                 case 7:
                     upgradeDatabaseFrom6to7(db);
                     break;
 
--- a/mobile/android/base/java/org/mozilla/gecko/home/BookmarksListAdapter.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/BookmarksListAdapter.java
@@ -191,17 +191,17 @@ class BookmarksListAdapter extends Multi
 
     private boolean isCurrentFolder(FolderInfo folderInfo) {
         return (mParentStack.size() > 0 &&
                 mParentStack.peek().id == folderInfo.id);
     }
 
     public void swapCursor(Cursor c, FolderInfo folderInfo, RefreshType refreshType) {
         updateOpenFolderType(folderInfo);
-        switch(refreshType) {
+        switch (refreshType) {
             case PARENT:
                 if (!isCurrentFolder(folderInfo)) {
                     mParentStack.removeFirst();
                 }
                 break;
 
             case CHILD:
                 if (!isCurrentFolder(folderInfo)) {
--- a/mobile/android/base/java/org/mozilla/gecko/home/CombinedHistoryRecyclerView.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/CombinedHistoryRecyclerView.java
@@ -81,17 +81,17 @@ public class CombinedHistoryRecyclerView
         mDialogBuilder = builder;
     }
 
     @Override
     public void onItemClicked(RecyclerView recyclerView, int position, View v) {
         final int viewType = getAdapter().getItemViewType(position);
         final CombinedHistoryAdapter.ItemType itemType = CombinedHistoryAdapter.ItemType.viewTypeToItemType(viewType);
 
-        switch(itemType) {
+        switch (itemType) {
             case CLIENT:
                 mOnPanelLevelChangeListener.onPanelLevelChange(PanelLevel.CHILD);
                 ((CombinedHistoryAdapter) getAdapter()).showChildView(position);
                 break;
             case HIDDEN_DEVICES:
                 if (mDialogBuilder != null) {
                     mDialogBuilder.createAndShowDialog(((CombinedHistoryAdapter) getAdapter()).getHiddenClients());
                 }
--- a/mobile/android/base/java/org/mozilla/gecko/home/DynamicPanel.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/DynamicPanel.java
@@ -186,17 +186,17 @@ public class DynamicPanel extends HomeFr
     private void createPanelLayout() {
         final ContextMenuRegistry contextMenuRegistry = new ContextMenuRegistry() {
             @Override
             public void register(View view) {
                 registerForContextMenu(view);
             }
         };
 
-        switch(mPanelConfig.getLayoutType()) {
+        switch (mPanelConfig.getLayoutType()) {
             case FRAME:
                 final PanelDatasetHandler datasetHandler = new PanelDatasetHandler();
                 mPanelLayout = new FramePanelLayout(getActivity(), mPanelConfig, datasetHandler,
                         mUrlOpenListener, contextMenuRegistry);
                 break;
 
             default:
                 throw new IllegalStateException("Unrecognized layout type in DynamicPanel");
@@ -210,17 +210,17 @@ public class DynamicPanel extends HomeFr
      * Lazily creates layout for authentication UI.
      */
     private void createPanelAuthLayout() {
         mPanelAuthLayout = new PanelAuthLayout(getActivity(), mPanelConfig);
         mView.addView(mPanelAuthLayout, 0);
     }
 
     private void setUIMode(UIMode mode) {
-        switch(mode) {
+        switch (mode) {
             case PANEL:
                 if (mPanelAuthLayout != null) {
                     mPanelAuthLayout.setVisibility(View.GONE);
                 }
                 if (mPanelLayout == null) {
                     createPanelLayout();
                 }
                 mPanelLayout.setVisibility(View.VISIBLE);
--- a/mobile/android/base/java/org/mozilla/gecko/home/HomeConfig.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/HomeConfig.java
@@ -1628,17 +1628,17 @@ public final class HomeConfig {
         mBackend.setOnReloadListener(listener);
     }
 
     public static PanelConfig createBuiltinPanelConfig(Context context, PanelType panelType) {
         return createBuiltinPanelConfig(context, panelType, EnumSet.noneOf(PanelConfig.Flags.class));
     }
 
     public static int getTitleResourceIdForBuiltinPanelType(PanelType panelType) {
-        switch(panelType) {
+        switch (panelType) {
         case TOP_SITES:
             return R.string.home_top_sites_title;
 
         case BOOKMARKS:
             return R.string.bookmarks_title;
 
         case COMBINED_HISTORY:
         case HISTORY:
@@ -1654,17 +1654,17 @@ public final class HomeConfig {
             return R.string.recent_tabs_title;
 
         default:
             throw new IllegalArgumentException("Only for built-in panel types: " + panelType);
         }
     }
 
     public static String getIdForBuiltinPanelType(PanelType panelType) {
-        switch(panelType) {
+        switch (panelType) {
         case TOP_SITES:
             return TOP_SITES_PANEL_ID;
 
         case BOOKMARKS:
             return BOOKMARKS_PANEL_ID;
 
         case HISTORY:
             return HISTORY_PANEL_ID;
--- a/mobile/android/base/java/org/mozilla/gecko/home/HomeFragment.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/HomeFragment.java
@@ -373,17 +373,17 @@ public abstract class HomeFragment exten
 
             if (mPosition > -1) {
                 mDB.unpinSite(cr, mPosition);
                 if (mDB.hideSuggestedSite(mUrl)) {
                     cr.notifyChange(SuggestedSites.CONTENT_URI, null);
                 }
             }
 
-            switch(mType) {
+            switch (mType) {
                 case BOOKMARKS:
                     Telemetry.sendUIEvent(TelemetryContract.Event.UNSAVE, TelemetryContract.Method.CONTEXT_MENU, "bookmark");
                     mDB.removeBookmarksWithURL(cr, mUrl);
 
                     SavedReaderViewHelper rch = SavedReaderViewHelper.getSavedReaderViewHelper(mContext);
                     if (rch.isURLCached(mUrl)) {
                         ReadingListHelper.removeCachedReaderItem(mUrl, mContext);
                     }
--- a/mobile/android/base/java/org/mozilla/gecko/home/PanelItemView.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/PanelItemView.java
@@ -114,17 +114,17 @@ class PanelItemView extends LinearLayout
 
     private static class IconItemView extends PanelItemView {
         private IconItemView(Context context) {
             super(context, R.layout.panel_icon_item);
         }
     }
 
     public static PanelItemView create(Context context, ItemType itemType) {
-        switch(itemType) {
+        switch (itemType) {
             case ARTICLE:
                 return new ArticleItemView(context);
 
             case IMAGE:
                 return new ImageItemView(context);
 
             case ICON:
                 return new IconItemView(context);
--- a/mobile/android/base/java/org/mozilla/gecko/home/PanelLayout.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/PanelLayout.java
@@ -359,17 +359,17 @@ abstract class PanelLayout extends Frame
         ViewState viewState = mViewStates.get(viewConfig.getIndex());
         if (viewState == null) {
             viewState = new ViewState(viewConfig);
             mViewStates.put(viewConfig.getIndex(), viewState);
         }
 
         View view = viewState.getView();
         if (view == null) {
-            switch(viewConfig.getType()) {
+            switch (viewConfig.getType()) {
                 case LIST:
                     view = new PanelListView(getContext(), viewConfig);
                     break;
 
                 case GRID:
                     view = new PanelRecyclerView(getContext(), viewConfig);
                     break;
 
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
@@ -1338,17 +1338,17 @@ OnSharedPreferenceChangeListener
     }
 
     @Override
     protected Dialog onCreateDialog(int id) {
         AlertDialog.Builder builder = new AlertDialog.Builder(this);
         LinearLayout linearLayout = new LinearLayout(this);
         linearLayout.setOrientation(LinearLayout.VERTICAL);
         AlertDialog dialog;
-        switch(id) {
+        switch (id) {
             case DIALOG_CREATE_MASTER_PASSWORD:
                 final TextInputLayout inputLayout1 = getTextBox(R.string.masterpassword_password);
                 final TextInputLayout inputLayout2 = getTextBox(R.string.masterpassword_confirm);
                 linearLayout.addView(inputLayout1);
                 linearLayout.addView(inputLayout2);
 
                 final EditText input1 = inputLayout1.getEditText();
                 final EditText input2 = inputLayout2.getEditText();
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/PanelsPreference.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/PanelsPreference.java
@@ -120,17 +120,17 @@ public class PanelsPreference extends Cu
             }
         } else {
             setSummary("");
         }
     }
 
     @Override
     protected void onDialogIndexClicked(int index) {
-        switch(index) {
+        switch (index) {
             case INDEX_SET_DEFAULT_BUTTON:
                 mParentCategory.setDefault(this);
                 break;
 
             case INDEX_DISPLAY_BUTTON:
                 // Handle display options for the panel.
                 if (mIsRemovable) {
                     // For removable panels, the button displays text for removing the panel.
--- a/mobile/android/base/java/org/mozilla/gecko/prompts/Prompt.java
+++ b/mobile/android/base/java/org/mozilla/gecko/prompts/Prompt.java
@@ -133,17 +133,17 @@ public class Prompt implements OnClickLi
     }
 
     @Override
     public void onTabChanged(final Tab tab, final Tabs.TabEvents msg, final Object data) {
         if (tab != Tabs.getInstance().getTab(mTabId)) {
             return;
         }
 
-        switch(msg) {
+        switch (msg) {
             case SELECTED:
                 Log.i(LOGTAG, "Selected");
                 mDialog.show();
                 break;
             case UNSELECTED:
                 Log.i(LOGTAG, "Unselected");
                 mDialog.hide();
                 break;
@@ -251,17 +251,17 @@ public class Prompt implements OnClickLi
     }
 
     /* Adds the selected button to a result. This should only be called if there
      * are no lists shown on the dialog, since they also write their results to the button
      * attribute.
      */
     private void addButtonResult(final JSONObject result, int which) {
         int button = -1;
-        switch(which) {
+        switch (which) {
             case DialogInterface.BUTTON_POSITIVE : button = 0; break;
             case DialogInterface.BUTTON_NEUTRAL  : button = 1; break;
             case DialogInterface.BUTTON_NEGATIVE : button = 2; break;
         }
         try {
             result.put("button", button);
         } catch (JSONException ex) { }
     }
@@ -278,17 +278,17 @@ public class Prompt implements OnClickLi
      * @param builder
      *        The alert builder currently building this dialog.
      * @param listItems
      *        The items to add.
      * @param choiceMode
      *        One of the ListView.CHOICE_MODE constants to designate whether this list shows checkmarks, radios buttons, or nothing.
     */
     private void addListItems(AlertDialog.Builder builder, PromptListItem[] listItems, int choiceMode) {
-        switch(choiceMode) {
+        switch (choiceMode) {
             case ListView.CHOICE_MODE_MULTIPLE_MODAL:
             case ListView.CHOICE_MODE_MULTIPLE:
                 addMultiSelectList(builder, listItems);
                 break;
             case ListView.CHOICE_MODE_SINGLE:
                 addSingleSelectList(builder, listItems);
                 break;
             case ListView.CHOICE_MODE_NONE:
--- a/mobile/android/base/java/org/mozilla/gecko/reader/ReadingListHelper.java
+++ b/mobile/android/base/java/org/mozilla/gecko/reader/ReadingListHelper.java
@@ -39,17 +39,17 @@ public final class ReadingListHelper imp
     public void uninit() {
         EventDispatcher.getInstance().unregisterGeckoThreadListener((NativeEventListener) this,
             "Reader:FaviconRequest", "Reader:AddedToCache");
     }
 
     @Override
     public void handleMessage(final String event, final NativeJSObject message,
                               final EventCallback callback) {
-        switch(event) {
+        switch (event) {
             case "Reader:FaviconRequest": {
                 handleReaderModeFaviconRequest(callback, message.getString("url"));
                 break;
             }
             case "Reader:AddedToCache": {
                 // AddedToCache is a one way message: callback will be null, and we therefore shouldn't
                 // attempt to handle it.
                 handleAddedToCache(message.getString("url"), message.getString("path"), message.getInt("size"));