More static analysis

pull/437/head
Alex Baker 9 years ago
parent efe29333e5
commit 905c9a1ac9

@ -0,0 +1,19 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Convert2streamapi" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="Guava" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="LoggerInitializedWithForeignClass" enabled="false" level="WARNING" enabled_by_default="false">
<option name="loggerClassName" value="org.apache.log4j.Logger,org.slf4j.LoggerFactory,org.apache.commons.logging.LogFactory,java.util.logging.Logger" />
<option name="loggerFactoryMethodName" value="getLogger,getLogger,getLog,getLogger" />
</inspection_tool>
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
<option name="processCode" value="true" />
<option name="processLiterals" value="true" />
<option name="processComments" value="true" />
</inspection_tool>
<inspection_tool class="StaticPseudoFunctionalStyleMethod" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="TryFinallyCanBeTryWithResources" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="TryWithIdenticalCatches" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

@ -2,6 +2,8 @@
<lint> <lint>
<issue id="InconsistentArrays" severity="error"/> <issue id="InconsistentArrays" severity="error"/>
<issue id="MissingTranslation" severity="ignore"/> <issue id="MissingTranslation" severity="ignore"/>
<issue id="VectorRaster" severity="ignore" />
<issue id="MissingQuantity" severity="ignore"/> <issue id="MissingQuantity" severity="ignore"/>
<issue id="ImpliedQuantity" severity="ignore"/> <issue id="ImpliedQuantity" severity="ignore"/>
</lint> </lint>

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest
package="org.tasks"> package="org.tasks">
<application/> <application/>

@ -21,6 +21,7 @@ package com.android.vending.billing;
* To get the IAB result that caused this exception to be thrown, * To get the IAB result that caused this exception to be thrown,
* call {@link #getResult()}. * call {@link #getResult()}.
*/ */
@SuppressWarnings("ALL")
public class IabException extends Exception { public class IabException extends Exception {
IabResult mResult; IabResult mResult;

@ -30,8 +30,6 @@ import android.os.RemoteException;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import com.android.vending.billing.IInAppBillingService;
import org.json.JSONException; import org.json.JSONException;
import java.util.ArrayList; import java.util.ArrayList;
@ -69,6 +67,7 @@ import java.util.concurrent.Executor;
* has not yet completed will result in an exception being thrown. * has not yet completed will result in an exception being thrown.
* *
*/ */
@SuppressWarnings("ALL")
public class IabHelper { public class IabHelper {
private final Executor executor; private final Executor executor;

@ -23,6 +23,7 @@ package com.android.vending.billing;
* can also inquire whether a result is a success or a failure by * can also inquire whether a result is a success or a failure by
* calling {@link #isSuccess()} and {@link #isFailure()}. * calling {@link #isSuccess()} and {@link #isFailure()}.
*/ */
@SuppressWarnings("ALL")
public class IabResult { public class IabResult {
int mResponse; int mResponse;
String mMessage; String mMessage;

@ -24,6 +24,7 @@ import java.util.Map;
* Represents a block of information about in-app items. * Represents a block of information about in-app items.
* An Inventory is returned by such methods as {@link IabHelper#queryInventory}. * An Inventory is returned by such methods as {@link IabHelper#queryInventory}.
*/ */
@SuppressWarnings("ALL")
public class Inventory { public class Inventory {
Map<String,SkuDetails> mSkuMap = new HashMap<String,SkuDetails>(); Map<String,SkuDetails> mSkuMap = new HashMap<String,SkuDetails>();
Map<String,Purchase> mPurchaseMap = new HashMap<String,Purchase>(); Map<String,Purchase> mPurchaseMap = new HashMap<String,Purchase>();

@ -21,6 +21,7 @@ import org.json.JSONObject;
/** /**
* Represents an in-app billing purchase. * Represents an in-app billing purchase.
*/ */
@SuppressWarnings("ALL")
public class Purchase { public class Purchase {
String mItemType; // ITEM_TYPE_INAPP or ITEM_TYPE_SUBS String mItemType; // ITEM_TYPE_INAPP or ITEM_TYPE_SUBS
String mOrderId; String mOrderId;

@ -37,6 +37,7 @@ import java.security.spec.X509EncodedKeySpec;
* make it harder for an attacker to replace the code with stubs that treat all * make it harder for an attacker to replace the code with stubs that treat all
* purchases as verified. * purchases as verified.
*/ */
@SuppressWarnings("ALL")
public class Security { public class Security {
private static final String TAG = "IABUtil/Security"; private static final String TAG = "IABUtil/Security";

@ -21,6 +21,7 @@ import org.json.JSONObject;
/** /**
* Represents an in-app product's listing details. * Represents an in-app product's listing details.
*/ */
@SuppressWarnings("ALL")
public class SkuDetails { public class SkuDetails {
private final String mItemType; private final String mItemType;
private final String mSku; private final String mSku;

@ -100,7 +100,7 @@ public class GtasksTaskListUpdater extends OrderedMetadataListUpdater<GtasksList
public void correctOrderAndIndentForList(String listId) { public void correctOrderAndIndentForList(String listId) {
orderAndIndentHelper(listId, new AtomicLong(0L), Task.NO_ID, 0, orderAndIndentHelper(listId, new AtomicLong(0L), Task.NO_ID, 0,
new HashSet<Long>()); new HashSet<>());
} }
private void orderAndIndentHelper(final String listId, final AtomicLong order, final long parent, final int indentLevel, final Set<Long> alreadyChecked) { private void orderAndIndentHelper(final String listId, final AtomicLong order, final long parent, final int indentLevel, final Set<Long> alreadyChecked) {

@ -99,6 +99,7 @@ public class GtasksSyncService {
@Override @Override
public void run() { public void run() {
//noinspection InfiniteLoopStatement
while (true) { while (true) {
SyncOnSaveOperation op; SyncOnSaveOperation op;
try { try {

@ -125,7 +125,7 @@ public class CustomFilterAdapter extends ArrayAdapter<CriterionInstance> {
editText.setText(item.selectedText); editText.setText(item.selectedText);
editText.setHint(textInCriterion.hint); editText.setHint(textInCriterion.hint);
frameLayout.addView(editText, new FrameLayout.LayoutParams( frameLayout.addView(editText, new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.FILL_PARENT, FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.WRAP_CONTENT)); FrameLayout.LayoutParams.WRAP_CONTENT));
dialog.setView(frameLayout). dialog.setView(frameLayout).
setPositiveButton(android.R.string.ok, (dialogInterface, which) -> { setPositiveButton(android.R.string.ok, (dialogInterface, which) -> {

@ -59,10 +59,10 @@ public class NNumberPickerDialog extends AlertDialog implements OnClickListener
setTitle(title); setTitle(title);
LayoutParams npLayout = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams npLayout = new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.FILL_PARENT); LayoutParams.MATCH_PARENT);
npLayout.gravity = 1; npLayout.gravity = 1;
LayoutParams sepLayout = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams sepLayout = new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.FILL_PARENT); LayoutParams.MATCH_PARENT);
for(int i = 0; i < incrementBy.length; i++) { for(int i = 0; i < incrementBy.length; i++) {
NumberPicker np = new NumberPicker(context, null); NumberPicker np = new NumberPicker(context, null);
np.setIncrementBy(incrementBy[i]); np.setIncrementBy(incrementBy[i]);

@ -23,12 +23,11 @@ import org.tasks.R;
*/ */
public class RandomReminderControlSet { public class RandomReminderControlSet {
private final Spinner periodSpinner;
private int selectedIndex; private int selectedIndex;
private final int[] hours; private final int[] hours;
public RandomReminderControlSet(Context context, View parentView, long reminderPeriod) { public RandomReminderControlSet(Context context, View parentView, long reminderPeriod) {
periodSpinner = (Spinner) parentView.findViewById(R.id.reminder_random_interval); Spinner periodSpinner = (Spinner) parentView.findViewById(R.id.reminder_random_interval);
periodSpinner.setVisibility(View.VISIBLE); periodSpinner.setVisibility(View.VISIBLE);
// create adapter // create adapter
ArrayAdapter<String> adapter = new ArrayAdapter<>( ArrayAdapter<String> adapter = new ArrayAdapter<>(

@ -33,7 +33,7 @@ public class FilterCounter {
@Inject @Inject
public FilterCounter(TaskDao taskDao) { public FilterCounter(TaskDao taskDao) {
this(taskDao, new ThreadPoolExecutor(0, 1, 1, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>())); this(taskDao, new ThreadPoolExecutor(0, 1, 1, TimeUnit.SECONDS, new LinkedBlockingQueue<>()));
} }
FilterCounter(TaskDao taskDao, ExecutorService executorService) { FilterCounter(TaskDao taskDao, ExecutorService executorService) {

@ -93,7 +93,7 @@ public abstract class InjectingPreferenceActivity extends AppCompatPreferenceAct
} }
} }
@SuppressWarnings("deprecation") @SuppressWarnings({"deprecation", "EmptyMethod"})
@Override @Override
public void addPreferencesFromResource(int preferencesResId) { public void addPreferencesFromResource(int preferencesResId) {
super.addPreferencesFromResource(preferencesResId); super.addPreferencesFromResource(preferencesResId);

@ -1,10 +1,12 @@
package org.tasks.locale; package org.tasks.locale;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.os.Build;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v4.text.TextUtilsCompat; import android.support.v4.text.TextUtilsCompat;
import android.view.ContextThemeWrapper; import android.view.ContextThemeWrapper;
@ -111,6 +113,7 @@ public class Locale {
: context; : context;
} }
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private Configuration getLocaleConfiguration() { private Configuration getLocaleConfiguration() {
Configuration configuration = new Configuration(); Configuration configuration = new Configuration();
configuration.locale = getLocale(); configuration.locale = getLocale();

@ -1,9 +1,11 @@
package org.tasks.themes; package org.tasks.themes;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity; import android.app.Activity;
import android.app.ActivityManager; import android.app.ActivityManager;
import android.content.res.Resources; import android.content.res.Resources;
import android.os.Build;
import android.support.v4.widget.DrawerLayout; import android.support.v4.widget.DrawerLayout;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.view.View; import android.view.View;
@ -78,6 +80,7 @@ public class ThemeColor {
} }
} }
@TargetApi(Build.VERSION_CODES.M)
private int applyLightStatusBarFlag(int flag) { private int applyLightStatusBarFlag(int flag) {
return isDark return isDark
? flag | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR ? flag | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR

@ -17,7 +17,7 @@ public class HiddenTopArrayAdapter<T> extends ArrayAdapter<T> {
private List<String> hints; private List<String> hints;
public HiddenTopArrayAdapter(Context context, int resources, List<T> objects) { public HiddenTopArrayAdapter(Context context, int resources, List<T> objects) {
this(context, resources, objects, new ArrayList<String>()); this(context, resources, objects, new ArrayList<>());
} }
public HiddenTopArrayAdapter(Context context, int resource, List<T> objects, List<String> hints) { public HiddenTopArrayAdapter(Context context, int resource, List<T> objects, List<String> hints) {

@ -136,7 +136,7 @@ public class ScrimInsetsFrameLayout extends FrameLayout {
mOnInsetsCallback = onInsetsCallback; mOnInsetsCallback = onInsetsCallback;
} }
public static interface OnInsetsCallback { public interface OnInsetsCallback {
public void onInsetsChanged(Rect insets); void onInsetsChanged(Rect insets);
} }
} }
Loading…
Cancel
Save