Bug 1258789 - Add plus operator to WhitespaceAround and fix. r=grisha draft
authorMichael Comella <michael.l.comella@gmail.com>
Tue, 12 Apr 2016 18:42:40 -0700
changeset 350249 da4ccbacf82ac546cbcd79f0ad26a26f0305f230
parent 350248 52395f96af35872f3f06edcedd7f3bbef44eab82
child 350250 17d1c516fc4a52622615f82a930cddfbfe680435
push id15281
push usermichael.l.comella@gmail.com
push dateWed, 13 Apr 2016 02:23:27 +0000
reviewersgrisha
bugs1258789
milestone48.0a1
Bug 1258789 - Add plus operator to WhitespaceAround and fix. r=grisha MozReview-Commit-ID: 419NkkMHWCG
mobile/android/app/checkstyle.xml
mobile/android/base/java/org/mozilla/gecko/ANRReporter.java
mobile/android/base/java/org/mozilla/gecko/DownloadsIntegration.java
mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
mobile/android/base/java/org/mozilla/gecko/GeckoJavaSampler.java
mobile/android/base/java/org/mozilla/gecko/GeckoProfile.java
mobile/android/base/java/org/mozilla/gecko/SessionParser.java
mobile/android/base/java/org/mozilla/gecko/db/BrowserProvider.java
mobile/android/base/java/org/mozilla/gecko/favicons/decoders/IconDirectoryEntry.java
mobile/android/base/java/org/mozilla/gecko/gfx/GeckoLayerClient.java
mobile/android/base/java/org/mozilla/gecko/home/BrowserSearch.java
mobile/android/base/java/org/mozilla/gecko/mozglue/GeckoLoader.java
mobile/android/base/java/org/mozilla/gecko/util/GeckoJarReader.java
mobile/android/base/java/org/mozilla/gecko/widget/DateTimePicker.java
--- a/mobile/android/app/checkstyle.xml
+++ b/mobile/android/app/checkstyle.xml
@@ -55,13 +55,14 @@
         </module>
         <module name="WhitespaceAround">
             <property name="allowEmptyConstructors" value="true"/>
             <property name="allowEmptyMethods" value="true"/>
             <property name="allowEmptyTypes" value="true"/>
             <property name="allowEmptyLoops" value="true"/>
             <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_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE,
-                    LOR, LT, NOT_EQUAL, QUESTION, SL, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN,"/>
+                    LOR, LT, NOT_EQUAL, QUESTION, SL, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN, LITERAL_ASSERT, TYPE_EXTENSION_AND,
+                    PLUS, PLUS_ASSIGN"/>
         </module>
     </module>
 
 </module>
--- a/mobile/android/base/java/org/mozilla/gecko/ANRReporter.java
+++ b/mobile/android/base/java/org/mozilla/gecko/ANRReporter.java
@@ -314,17 +314,17 @@ public final class ANRReporter extends B
             "\"simpleMeasurements\":{" +
                 "\"uptime\":" + String.valueOf(getUptimeMins()) +
             "}," +
             "\"info\":{" +
                 "\"reason\":\"android-anr-report\"," +
                 "\"OS\":" + JSONObject.quote(SysInfo.getName()) + "," +
                 "\"version\":\"" + String.valueOf(SysInfo.getVersion()) + "\"," +
                 "\"appID\":" + JSONObject.quote(AppConstants.MOZ_APP_ID) + "," +
-                "\"appVersion\":" + JSONObject.quote(AppConstants.MOZ_APP_VERSION)+ "," +
+                "\"appVersion\":" + JSONObject.quote(AppConstants.MOZ_APP_VERSION) + "," +
                 "\"appName\":" + JSONObject.quote(AppConstants.MOZ_APP_BASENAME) + "," +
                 "\"appBuildID\":" + JSONObject.quote(AppConstants.MOZ_APP_BUILDID) + "," +
                 "\"appUpdateChannel\":" + JSONObject.quote(AppConstants.MOZ_UPDATE_CHANNEL) + "," +
                 // Technically the platform build ID may be different, but we'll never know
                 "\"platformBuildID\":" + JSONObject.quote(AppConstants.MOZ_APP_BUILDID) + "," +
                 "\"locale\":" + JSONObject.quote(Locales.getLanguageTag(Locale.getDefault())) + "," +
                 "\"cpucount\":" + String.valueOf(SysInfo.getCPUCount()) + "," +
                 "\"memsize\":" + String.valueOf(SysInfo.getMemSize()) + "," +
--- a/mobile/android/base/java/org/mozilla/gecko/DownloadsIntegration.java
+++ b/mobile/android/base/java/org/mozilla/gecko/DownloadsIntegration.java
@@ -137,17 +137,17 @@ public class DownloadsIntegration implem
             // one from the file extension below.
             mimeType = "";
         }
 
         // If the platform didn't give us a mimetype, try to guess one from the filename
         if (TextUtils.isEmpty(mimeType)) {
             final int extPosition = aFile.lastIndexOf(".");
             if (extPosition > 0 && extPosition < aFile.length() - 1) {
-                mimeType = GeckoAppShell.getMimeTypeFromExtension(aFile.substring(extPosition+1));
+                mimeType = GeckoAppShell.getMimeTypeFromExtension(aFile.substring(extPosition + 1));
             }
         }
 
         // addCompletedDownload will throw if it received any null parameters. Use aMimeType or a default
         // if we still don't have one.
         if (TextUtils.isEmpty(mimeType)) {
             if (TextUtils.isEmpty(aMimeType)) {
                 mimeType = UNKNOWN_MIME_TYPES.get(0);
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoApp.java
@@ -930,17 +930,17 @@ public abstract class GeckoApp
     private void setImageAs(final String aSrc) {
         boolean isDataURI = aSrc.startsWith("data:");
         Bitmap image = null;
         InputStream is = null;
         ByteArrayOutputStream os = null;
         try {
             if (isDataURI) {
                 int dataStart = aSrc.indexOf(",");
-                byte[] buf = Base64.decode(aSrc.substring(dataStart+1), Base64.DEFAULT);
+                byte[] buf = Base64.decode(aSrc.substring(dataStart + 1), Base64.DEFAULT);
                 image = BitmapUtils.decodeByteArray(buf);
             } else {
                 int byteRead;
                 byte[] buf = new byte[4192];
                 os = new ByteArrayOutputStream();
                 URL url = new URL(aSrc);
                 is = url.openStream();
 
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoJavaSampler.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoJavaSampler.java
@@ -97,17 +97,17 @@ public class GeckoJavaSampler {
                     Thread.sleep(mInterval);
                 } catch (InterruptedException e) {
                     e.printStackTrace();
                 }
                 synchronized (GeckoJavaSampler.class) {
                     if (!mPauseSampler) {
                         StackTraceElement[] bt = sMainThread.getStackTrace();
                         mSamples.get(0)[mSamplePos] = new Sample(bt);
-                        mSamplePos = (mSamplePos+1) % mSamples.get(0).length;
+                        mSamplePos = (mSamplePos + 1) % mSamples.get(0).length;
                     }
                     if (mStopSampler) {
                         break;
                     }
                 }
             }
         }
 
--- a/mobile/android/base/java/org/mozilla/gecko/GeckoProfile.java
+++ b/mobile/android/base/java/org/mozilla/gecko/GeckoProfile.java
@@ -912,26 +912,26 @@ public final class GeckoProfile {
                     continue;
                 }
 
                 if (section.getName().startsWith("Profile")) {
                     // ok, we have stupid Profile#-named things.  Rename backwards.
                     try {
                         int sectionNumber = Integer.parseInt(section.getName().substring("Profile".length()));
                         String curSection = "Profile" + sectionNumber;
-                        String nextSection = "Profile" + (sectionNumber+1);
+                        String nextSection = "Profile" + (sectionNumber + 1);
 
                         sections.remove(curSection);
 
                         while (sections.containsKey(nextSection)) {
                             parser.renameSection(nextSection, curSection);
                             sectionNumber++;
 
                             curSection = nextSection;
-                            nextSection = "Profile" + (sectionNumber+1);
+                            nextSection = "Profile" + (sectionNumber + 1);
                         }
                     } catch (NumberFormatException nex) {
                         // uhm, malformed Profile thing; we can't do much.
                         Log.e(LOGTAG, "Malformed section name in profiles.ini: " + section.getName());
                         return false;
                     }
                 } else {
                     // this really shouldn't be the case, but handle it anyway
--- a/mobile/android/base/java/org/mozilla/gecko/SessionParser.java
+++ b/mobile/android/base/java/org/mozilla/gecko/SessionParser.java
@@ -95,17 +95,17 @@ public abstract class SessionParser {
 
                     String title = entry.optString("title");
                     if (title.length() == 0) {
                         title = url;
                     }
 
                     totalCount++;
                     boolean selected = false;
-                    if (optSelected == i+1) {
+                    if (optSelected == i + 1) {
                         selected = true;
                         selectedIndex = totalCount;
                     }
                     sessionTabs.add(new SessionTab(title, url, selected, tab));
                 }
             }
         } catch (JSONException e) {
             Log.e(LOGTAG, "JSON error", e);
--- a/mobile/android/base/java/org/mozilla/gecko/db/BrowserProvider.java
+++ b/mobile/android/base/java/org/mozilla/gecko/db/BrowserProvider.java
@@ -305,17 +305,17 @@ public class BrowserProvider extends Sha
 
         final String sortOrder = BrowserContract.getFrecencySortOrder(false, true);
         final long toRemove = rows - retain;
         debug("Expiring at most " + toRemove + " rows earlier than " + keepAfter + ".");
 
         final String sql;
         if (keepAfter > 0) {
             sql = "DELETE FROM " + TABLE_HISTORY + " " +
-                  "WHERE MAX(" + History.DATE_LAST_VISITED + ", " + History.DATE_MODIFIED +") < " + keepAfter + " " +
+                  "WHERE MAX(" + History.DATE_LAST_VISITED + ", " + History.DATE_MODIFIED + ") < " + keepAfter + " " +
                   " AND " + History._ID + " IN ( SELECT " +
                     History._ID + " FROM " + TABLE_HISTORY + " " +
                     "ORDER BY " + sortOrder + " LIMIT " + toRemove +
                   ")";
         } else {
             sql = "DELETE FROM " + TABLE_HISTORY + " WHERE " + History._ID + " " +
                   "IN ( SELECT " + History._ID + " FROM " + TABLE_HISTORY + " " +
                   "ORDER BY " + sortOrder + " LIMIT " + toRemove + ")";
--- a/mobile/android/base/java/org/mozilla/gecko/favicons/decoders/IconDirectoryEntry.java
+++ b/mobile/android/base/java/org/mozilla/gecko/favicons/decoders/IconDirectoryEntry.java
@@ -79,17 +79,17 @@ public class IconDirectoryEntry implemen
 
         // Fail if the entry describes a region outside the buffer.
         if (payloadOffset < 0 || entryLength < 0 || payloadOffset + entryLength > regionOffset + regionLength) {
             return getErroneousEntry();
         }
 
         // Extract the image dimensions.
         int imageWidth = buffer[entryOffset] & 0xFF;
-        int imageHeight = buffer[entryOffset+1] & 0xFF;
+        int imageHeight = buffer[entryOffset + 1] & 0xFF;
 
         // Because Microsoft, a size value of zero represents an image size of 256.
         if (imageWidth == 0) {
             imageWidth = 256;
         }
 
         if (imageHeight == 0) {
             imageHeight = 256;
--- a/mobile/android/base/java/org/mozilla/gecko/gfx/GeckoLayerClient.java
+++ b/mobile/android/base/java/org/mozilla/gecko/gfx/GeckoLayerClient.java
@@ -490,17 +490,17 @@ class GeckoLayerClient implements LayerV
         // precision updates.
         if (!lowPrecision) {
             if (!FloatUtils.fuzzyEquals(resolution, mProgressiveUpdateDisplayPort.resolution) ||
                 !FloatUtils.fuzzyEquals(x, mProgressiveUpdateDisplayPort.getLeft()) ||
                 !FloatUtils.fuzzyEquals(y, mProgressiveUpdateDisplayPort.getTop()) ||
                 !FloatUtils.fuzzyEquals(x + width, mProgressiveUpdateDisplayPort.getRight()) ||
                 !FloatUtils.fuzzyEquals(y + height, mProgressiveUpdateDisplayPort.getBottom())) {
                 mProgressiveUpdateDisplayPort =
-                    new DisplayPortMetrics(x, y, x+width, y+height, resolution);
+                    new DisplayPortMetrics(x, y, x + width, y + height, resolution);
             }
         }
 
         // If we're not doing low precision draws and we're about to
         // checkerboard, enable low precision drawing.
         if (!lowPrecision && !mProgressiveUpdateWasInDanger) {
             if (DisplayPortCalculator.aboutToCheckerboard(viewportMetrics,
                   mPanZoomController.getVelocityVector(), mProgressiveUpdateDisplayPort)) {
--- a/mobile/android/base/java/org/mozilla/gecko/home/BrowserSearch.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/BrowserSearch.java
@@ -985,17 +985,17 @@ public class BrowserSearch extends HomeF
             String actualQuery = BrowserContract.SearchHistory.QUERY + " LIKE ?";
             String[] queryArgs = new String[] { '%' + mSearchTerm + '%' };
 
             // For deduplication, the worst case is that all the first NETWORK_SUGGESTION_MAX history suggestions are duplicates
             // of search engine suggestions, and the there is a duplicate for the search term itself. A duplicate of the
             // search term  can occur if the user has previously searched for the same thing.
             final int maxSavedSuggestions = NETWORK_SUGGESTION_MAX + 1 + getContext().getResources().getInteger(R.integer.max_saved_suggestions);
 
-            final String sortOrderAndLimit = BrowserContract.SearchHistory.DATE +" DESC LIMIT " + maxSavedSuggestions;
+            final String sortOrderAndLimit = BrowserContract.SearchHistory.DATE + " DESC LIMIT " + maxSavedSuggestions;
             final Cursor result =  cr.query(BrowserContract.SearchHistory.CONTENT_URI, columns, actualQuery, queryArgs, sortOrderAndLimit);
 
             if (result == null) {
                 return new ArrayList<>();
             }
 
             final ArrayList<String> savedSuggestions = new ArrayList<>();
             try {
--- a/mobile/android/base/java/org/mozilla/gecko/mozglue/GeckoLoader.java
+++ b/mobile/android/base/java/org/mozilla/gecko/mozglue/GeckoLoader.java
@@ -66,17 +66,17 @@ public final class GeckoLoader {
                 return;
             }
 
             StringBuilder pluginSearchPath = new StringBuilder();
             for (int i = 0; i < pluginDirs.length; i++) {
                 pluginSearchPath.append(pluginDirs[i]);
                 pluginSearchPath.append(":");
             }
-            putenv("MOZ_PLUGIN_PATH="+pluginSearchPath);
+            putenv("MOZ_PLUGIN_PATH=" + pluginSearchPath);
 
             File pluginDataDir = context.getDir("plugins", 0);
             putenv("ANDROID_PLUGIN_DATADIR=" + pluginDataDir.getPath());
 
             File pluginPrivateDataDir = context.getDir("plugins_private", 0);
             putenv("ANDROID_PLUGIN_DATADIR_PRIVATE=" + pluginPrivateDataDir.getPath());
 
         } catch (Exception ex) {
--- a/mobile/android/base/java/org/mozilla/gecko/util/GeckoJarReader.java
+++ b/mobile/android/base/java/org/mozilla/gecko/util/GeckoJarReader.java
@@ -233,17 +233,17 @@ public final class GeckoJarReader {
     private static Stack<String> parseUrl(String url, Stack<String> results) {
         if (results == null) {
             results = new Stack<String>();
         }
 
         if (url.startsWith("jar:")) {
             int jarEnd = url.lastIndexOf("!");
             String subStr = url.substring(4, jarEnd);
-            results.push(url.substring(jarEnd+2)); // remove the !/ characters
+            results.push(url.substring(jarEnd + 2)); // remove the !/ characters
             return parseUrl(subStr, results);
         } else {
             results.push(url);
             return results;
         }
     }
 
     public static String getJarURL(Context context, String pathInsideJAR) {
--- a/mobile/android/base/java/org/mozilla/gecko/widget/DateTimePicker.java
+++ b/mobile/android/base/java/org/mozilla/gecko/widget/DateTimePicker.java
@@ -144,17 +144,17 @@ public class DateTimePicker extends Fram
                     throw new IllegalArgumentException();
                 }
             } else {
                 if (DEBUG) Log.d(LOGTAG, "Sdk version < 10, using old behavior");
                 if (picker == mDaySpinner && mDayEnabled){
                     mTempDate.set(Calendar.DAY_OF_MONTH, newVal);
                 } else if (picker == mMonthSpinner && mMonthEnabled){
                     mTempDate.set(Calendar.MONTH, newVal);
-                    if (mTempDate.get(Calendar.MONTH) == newVal+1){
+                    if (mTempDate.get(Calendar.MONTH) == newVal + 1){
                         mTempDate.set(Calendar.MONTH, newVal);
                         mTempDate.set(Calendar.DAY_OF_MONTH,
                         mTempDate.getActualMaximum(Calendar.DAY_OF_MONTH));
                     }
                 } else if (picker == mWeekSpinner){
                     mTempDate.set(Calendar.WEEK_OF_YEAR, newVal);
                 } else if (picker == mYearSpinner && mYearEnabled){
                     int month = mTempDate.get(Calendar.MONTH);