Bug 1258794 - Add trailing whitespace checkstyle check & fix issues. r=nalexander

MozReview-Commit-ID: IUslNabcTHO

--HG--
extra : rebase_source : 2981fa4d68dfde41159ab5f987dfcab0b28ef0ec
This commit is contained in:
Michael Comella 2016-04-06 10:08:46 -07:00
parent 669f79e139
commit 90ec31ddaa
30 changed files with 65 additions and 61 deletions

View File

@ -38,6 +38,10 @@
<module name="FileTabCharacter"> <!-- No tabs! -->
<property name="eachLine" value="true"/>
</module>
<module name="RegexpSingleline"> <!-- excess whitespace -->
<property name="format" value="\s+$"/>
<property name="message" value="Trailing whitespace"/>
</module>
<module name="TreeWalker">
<module name="GenericWhitespace"/> <!-- whitespace for generics -->

View File

@ -309,7 +309,7 @@ class ActionBarTextSelection extends Layer implements TextSelection, GeckoEventL
private class TextSelectionActionModeCallback implements Callback {
private JSONArray mItems;
private ActionModeCompat mActionMode;
public TextSelectionActionModeCallback(JSONArray items) {
mItems = items;
}

View File

@ -234,17 +234,17 @@ public class CrashReporter extends AppCompatActivity
private void savePrefs() {
SharedPreferences.Editor editor = GeckoSharedPrefs.forApp(this).edit();
final boolean allowContact = ((CheckBox) findViewById(R.id.allow_contact)).isChecked();
final boolean includeUrl = ((CheckBox) findViewById(R.id.include_url)).isChecked();
final boolean sendReport = ((CheckBox) findViewById(R.id.send_report)).isChecked();
final String contactEmail = ((EditText) findViewById(R.id.email)).getText().toString();
editor.putBoolean(PREFS_ALLOW_CONTACT, allowContact);
editor.putBoolean(PREFS_INCLUDE_URL, includeUrl);
editor.putBoolean(PREFS_SEND_REPORT, sendReport);
editor.putString(PREFS_CONTACT_EMAIL, contactEmail);
// A slight performance improvement via async apply() vs. blocking on commit().
editor.apply();
}

View File

@ -198,7 +198,7 @@ public class FormAssistPopup extends RelativeLayout implements GeckoEventListene
addView(mAutoCompleteList);
}
AutoCompleteListAdapter adapter = new AutoCompleteListAdapter(mContext, R.layout.autocomplete_list_item);
adapter.populateSuggestionsList(suggestions);
mAutoCompleteList.setAdapter(adapter);

View File

@ -28,7 +28,7 @@ import org.mozilla.gecko.util.ThreadUtils;
import java.io.File;
import java.lang.reflect.Method;
public class GeckoApplication extends Application
public class GeckoApplication extends Application
implements ContextGetter {
private static final String LOG_TAG = "GeckoApplication";
@ -110,7 +110,7 @@ public class GeckoApplication extends Application
// shutdown, closing the disk cache cleanly. If the android
// low memory killer subsequently kills us, the disk cache will
// be left in a consistent state, avoiding costly cleanup and
// re-creation.
// re-creation.
GeckoThread.onPause();
mPausedGecko = true;

View File

@ -92,7 +92,7 @@ public final class GeckoProfile {
* Access to this member should be synchronized to avoid
* races during creation -- particularly between getDir and GeckoView#init.
*
* Not final because this is lazily computed.
* Not final because this is lazily computed.
*/
private File mProfileDir;

View File

@ -939,7 +939,7 @@ public class GeckoSmsManager
for (int i = 1; i < mNumbersCount; ++i) {
formatter.format(", '%s'", mNumbers[i]);
}
formatter.format(") AND ");
}

View File

@ -637,7 +637,7 @@ public class GeckoView extends LayerView
* Defaults to cancel requests.
*/
public void onAlert(GeckoView view, GeckoView.Browser browser, String message, GeckoView.PromptResult result);
/**
* Tell the host application to display a confirmation dialog.
* @param view The GeckoView that initiated the callback.
@ -647,7 +647,7 @@ public class GeckoView extends LayerView
* Defaults to cancel requests.
*/
public void onConfirm(GeckoView view, GeckoView.Browser browser, String message, GeckoView.PromptResult result);
/**
* Tell the host application to display an input prompt dialog.
* @param view The GeckoView that initiated the callback.
@ -658,7 +658,7 @@ public class GeckoView extends LayerView
* Defaults to cancel requests.
*/
public void onPrompt(GeckoView view, GeckoView.Browser browser, String message, String defaultValue, GeckoView.PromptResult result);
/**
* Tell the host application to display a remote debugging request dialog.
* @param view The GeckoView that initiated the callback.
@ -685,7 +685,7 @@ public class GeckoView extends LayerView
* @param url The resource being loaded.
*/
public void onPageStart(GeckoView view, GeckoView.Browser browser, String url);
/**
* A Browser has finished loading content from the network.
* @param view The GeckoView that initiated the callback.

View File

@ -53,7 +53,7 @@ class TextSelectionHandle extends ImageView implements View.OnTouchListener {
private float mLeft;
private float mTop;
private boolean mIsRTL;
private boolean mIsRTL;
private PointF mGeckoPoint;
private PointF mTouchStart;

View File

@ -110,7 +110,7 @@ public class PropertyAnimator implements Runnable {
float interpolation = mInterpolator.getInterpolation(timePassed * mDurationReciprocal);
for (ElementHolder element : mElementsList) {
for (ElementHolder element : mElementsList) {
float delta = element.from + ((element.to - element.from) * interpolation);
invalidate(element, delta);
}

View File

@ -157,7 +157,7 @@ public abstract class SQLiteBridgeContentProvider extends ContentProvider {
}
return bridge;
}
/**
* Returns the absolute path of a database file depending on the specified profile and dbName.
* @param profile
@ -183,7 +183,7 @@ public abstract class SQLiteBridgeContentProvider extends ContentProvider {
* current provider instance.
* @param profile
* the id of the profile to be used to retrieve the related SQLiteBridge
* @return the <code>SQLiteBridge</code> related to the specified profile id or <code>null</code> if it was
* @return the <code>SQLiteBridge</code> related to the specified profile id or <code>null</code> if it was
* not possible to retrieve a valid SQLiteBridge
*/
private SQLiteBridge getDatabaseForProfile(String profile) {
@ -202,7 +202,7 @@ public abstract class SQLiteBridgeContentProvider extends ContentProvider {
return db;
}
final String dbPath = getDatabasePathForProfile(profile, dbName);
if (dbPath == null) {
if (dbPath == null) {
Log.e(mLogTag, "Failed to get a valid db path for profile '" + profile + "'' dbName '" + dbName + "'");
return null;
}
@ -232,7 +232,7 @@ public abstract class SQLiteBridgeContentProvider extends ContentProvider {
* Returns a SQLiteBridge object according to the specified file path.
* @param dbPath
* the path of the file to be used to retrieve the related SQLiteBridge
* @return the <code>SQLiteBridge</code> related to the specified file path or <code>null</code> if it was
* @return the <code>SQLiteBridge</code> related to the specified file path or <code>null</code> if it was
* not possible to retrieve a valid <code>SQLiteBridge</code>
*
*/
@ -255,7 +255,7 @@ public abstract class SQLiteBridgeContentProvider extends ContentProvider {
* Returns a SQLiteBridge object to be used to perform operations on the given <code>Uri</code>.
* @param uri
* the <code>Uri</code> to be used to retrieve the related SQLiteBridge
* @return a <code>SQLiteBridge</code> object to be used on the given uri or <code>null</code> if it was
* @return a <code>SQLiteBridge</code> object to be used on the given uri or <code>null</code> if it was
* not possible to retrieve a valid <code>SQLiteBridge</code>
*
*/

View File

@ -567,7 +567,7 @@ public class Distribution {
} else {
value = status / 100;
}
Telemetry.addToHistogram(HISTOGRAM_CODE_CATEGORY, value);
if (status != 200) {

View File

@ -380,7 +380,7 @@ final class DisplayPortCalculator {
margins.left = xAmount / 2.0f;
}
margins.right = xAmount - margins.left;
if (velocity.y > VELOCITY_THRESHOLD) {
margins.top = yAmount * REVERSE_BUFFER;
} else if (velocity.y < -VELOCITY_THRESHOLD) {

View File

@ -67,7 +67,7 @@ public class TextureGenerator {
Log.e(LOGTAG, String.format("Failed to generate textures: %#x", error), new Exception());
return;
}
for (int i = 0; i < numNeeded; i++) {
mTextureIds.offer(textures[i]);
}

View File

@ -52,7 +52,7 @@ public class LightweightTheme implements GeckoEventListener {
private boolean mIsLight;
public static interface OnChangeListener {
// The View should change its background/text color.
// The View should change its background/text color.
public void onLightweightThemeChanged();
// The View should reset to its default background/text color.

View File

@ -34,7 +34,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class GeckoMenu extends ListView
public class GeckoMenu extends ListView
implements Menu,
AdapterView.OnItemClickListener,
GeckoMenuItem.OnShowAsActionChangedListener {
@ -76,7 +76,7 @@ public class GeckoMenu extends ListView
/*
* An interface for a presenter of action-items.
* Either an Activity or a View can be a presenter, that can watch for events
* and add/remove action-items. If not ActionItemBarPresenter, the menu uses a
* and add/remove action-items. If not ActionItemBarPresenter, the menu uses a
* DefaultActionItemBar, that shows the action-items as a header over list-view.
*/
public static interface ActionItemBarPresenter {
@ -509,7 +509,7 @@ public class GeckoMenu extends ListView
mPrimaryActionItems.remove(item);
mItems.remove(item);
if (mPrimaryActionItems.size() == 0 &&
if (mPrimaryActionItems.size() == 0 &&
mPrimaryActionItemBar instanceof DefaultActionItemBar) {
removePrimaryActionBarView();
}
@ -840,7 +840,7 @@ public class GeckoMenu extends ListView
// Initialize the view.
view.setShowIcon(mShowIcons);
view.initialize(item);
return (View) view;
return (View) view;
}
@Override

View File

@ -11,7 +11,7 @@ import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
public class GeckoSubMenu extends GeckoMenu
public class GeckoSubMenu extends GeckoMenu
implements SubMenu {
private static final String LOGTAG = "GeckoSubMenu";
@ -65,7 +65,7 @@ public class GeckoSubMenu extends GeckoMenu
}
@Override
public SubMenu setHeaderView(View view) {
public SubMenu setHeaderView(View view) {
return this;
}

View File

@ -78,7 +78,7 @@ public class MenuItemDefault extends TextView
if (item == null)
return;
setTitle(item.getTitle());
setTitle(item.getTitle());
setIcon(item.getIcon());
setEnabled(item.isEnabled());
setCheckable(item.isCheckable());

View File

@ -16,7 +16,7 @@ import android.widget.LinearLayout;
/**
* The outer container for the custom menu. On phones with h/w menu button,
* this is given to Android which inflates it to the right panel. On phones
* this is given to Android which inflates it to the right panel. On phones
* with s/w menu button, this is added to a MenuPopup.
*/
public class MenuPanel extends LinearLayout {

View File

@ -59,7 +59,7 @@ class MultiChoicePreference extends DialogPreference implements DialogInterface.
public void setEntries(CharSequence[] entries) {
mEntries = entries.clone();
}
/**
* @param entriesResId The entries array as a resource.
*/
@ -108,7 +108,7 @@ class MultiChoicePreference extends DialogPreference implements DialogInterface.
/**
* The list of translated strings corresponding to each preference.
*
*
* @return The array of entries.
*/
public CharSequence[] getEntries() {
@ -117,7 +117,7 @@ class MultiChoicePreference extends DialogPreference implements DialogInterface.
/**
* The list of values corresponding to each preference.
*
*
* @return The array of values.
*/
public CharSequence[] getEntryValues() {
@ -127,7 +127,7 @@ class MultiChoicePreference extends DialogPreference implements DialogInterface.
/**
* The list of initial values for each preference. Each string in this list
* should be either "true" or "false".
*
*
* @return The array of initial values.
*/
public CharSequence[] getInitialValues() {
@ -142,7 +142,7 @@ class MultiChoicePreference extends DialogPreference implements DialogInterface.
/**
* The list of values for each preference. These values are updated after
* the dialog has been displayed.
*
*
* @return The array of values.
*/
public Set<String> getValues() {

View File

@ -145,7 +145,7 @@ public class IconGridInput extends PromptInput implements OnItemClickListener {
lp.width = lp.height = mIconSize;
}
}
private class IconGridItem {
final String label;
final String description;

View File

@ -280,7 +280,7 @@ public class Prompt implements OnClickListener, OnCancelListener, OnItemClickLis
* @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.
* 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) {

View File

@ -218,7 +218,7 @@ public class PromptInput {
mView = (View)input;
} else if (mType.equals("datetime-local") || mType.equals("datetime")) {
DateTimePicker input = new DateTimePicker(context, "yyyy-MM-dd HH:mm", mValue.replace("T"," ").replace("Z", ""),
DateTimePicker.PickersState.DATETIME,
DateTimePicker.PickersState.DATETIME,
mMinValue.replace("T"," ").replace("Z",""), mMaxValue.replace("T"," ").replace("Z", ""));
input.toggleCalendar(true);
mView = (View)input;

View File

@ -106,7 +106,7 @@ public final class HardwareCodecCapabilityUtils {
}
public static boolean getHWDecoderCapability() {
if (Versions.feature20Plus) {
if (Versions.feature20Plus) {
for (int i = 0; i < MediaCodecList.getCodecCount(); ++i) {
MediaCodecInfo info = MediaCodecList.getCodecInfoAt(i);
if (info.isEncoder()) {

View File

@ -37,14 +37,14 @@ public final class INIParser extends INISection {
public void writeTo(File f) {
if (f == null)
return;
FileWriter outputStream = null;
try {
outputStream = new FileWriter(f);
} catch (IOException e1) {
e1.printStackTrace();
}
BufferedWriter writer = new BufferedWriter(outputStream);
try {
write(writer);
@ -85,15 +85,15 @@ public final class INIParser extends INISection {
super.parse();
parse(mFile);
}
// parse a passed in file
private void parse(File f) throws IOException {
// Set up internal data members
mSections = new Hashtable<String, INISection>();
if (f == null || !f.exists())
return;
FileReader inputStream = null;
try {
inputStream = new FileReader(f);
@ -101,16 +101,16 @@ public final class INIParser extends INISection {
// If the file doesn't exist. Just return;
return;
}
BufferedReader buf = new BufferedReader(inputStream);
String line = null; // current line of text we are parsing
INISection currentSection = null; // section we are currently parsing
while ((line = buf.readLine()) != null) {
if (line != null)
line = line.trim();
// blank line or a comment. ignore it
if (line == null || line.length() == 0 || line.charAt(0) == ';') {
debug("Ignore line: " + line);
@ -120,11 +120,11 @@ public final class INIParser extends INISection {
mSections.put(currentSection.getName(), currentSection);
} else {
debug("Parse as property: " + line);
String[] pieces = line.split("=");
if (pieces.length != 2)
continue;
String key = pieces[0].trim();
String value = pieces[1].trim();
if (currentSection != null) {
@ -150,7 +150,7 @@ public final class INIParser extends INISection {
getSections();
return mSections.get(key);
}
// remove an entire section from the file
public void removeSection(String name) {
// ensure that we have parsed the file

View File

@ -38,7 +38,7 @@ public class INISection {
Log.i(LOGTAG, msg);
}
}
// get a global property out of the hash table. will return null if the property doesn't exist
public Object getProperty(String key) {
getProperties(); // ensure that we have parsed the file
@ -86,9 +86,9 @@ public class INISection {
if (value == null)
removeProperty(key);
else
mProperties.put(key.trim(), value);
}
mProperties.put(key.trim(), value);
}
// remove a property
public void removeProperty(String name) {
// ensure that we have parsed the file

View File

@ -19,7 +19,7 @@ import android.os.Looper;
* Android uses a "Params" type parameter to represent the type of all the parameters to this task.
* It then uses arguments of type Params... to permit arbitrarily-many of these to be passed
* fluently.
*
*
* Unfortunately, since Java does not support generic array types (and since varargs desugars to a
* single array parameter) that behaviour exposes a hole in the type system. See:
* http://docs.oracle.com/javase/tutorial/java/generics/nonReifiableVarargsType.html#vulnerabilities

View File

@ -387,7 +387,7 @@ public class DateTimePicker extends FrameLayout {
if (mIs12HourMode) {
mHourSpinner = setupSpinner(R.id.hour, 1, 12);
mAMPMSpinnerInput = (EditText) mAMPMSpinner.getChildAt(1);
mAMPMSpinner.setDisplayedValues(mShortAMPMs);
mAMPMSpinner.setDisplayedValues(mShortAMPMs);
} else {
mHourSpinner = setupSpinner(R.id.hour, 0, 23);
mAMPMSpinnerInput = null;

View File

@ -149,7 +149,7 @@ public class GeckoActionProvider {
}
for (int i = 0; i < historySize; i++) {
view.addActionButton(dataModel.getActivity(i).loadIcon(packageManager),
view.addActionButton(dataModel.getActivity(i).loadIcon(packageManager),
dataModel.getActivity(i).loadLabel(packageManager));
}

View File

@ -1438,7 +1438,7 @@ public class TwoWayView extends AdapterView<ListAdapter> implements
if (maybeStartScrolling(delta)) {
return true;
}
break;
}