checkstyle: Add ExplicitInitialization

This commit is contained in:
Daniel Martí 2015-10-08 22:01:09 +02:00
parent 38cc95b035
commit 174e37e4e0
33 changed files with 62 additions and 61 deletions

View File

@ -37,11 +37,11 @@ public final class QRCodeEncoder {
private static final int BLACK = 0xFF000000; private static final int BLACK = 0xFF000000;
private int dimension = Integer.MIN_VALUE; private int dimension = Integer.MIN_VALUE;
private String contents = null; private String contents;
private String displayContents = null; private String displayContents;
private String title = null; private String title;
private BarcodeFormat format = null; private BarcodeFormat format;
private boolean encoded = false; private boolean encoded;
public QRCodeEncoder(String data, Bundle bundle, String type, String format, int dimension) { public QRCodeEncoder(String data, Bundle bundle, String type, String format, int dimension) {
this.dimension = dimension; this.dimension = dimension;

View File

@ -42,7 +42,7 @@ public class BoundedInputStream extends InputStream {
private final long max; private final long max;
/** the number of bytes already returned */ /** the number of bytes already returned */
private long pos = 0; private long pos;
/** the marked position */ /** the marked position */
private long mark = -1; private long mark = -1;

View File

@ -353,7 +353,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
} }
} }
private boolean inProcessOfChangingConfiguration = false; private boolean inProcessOfChangingConfiguration;
/** /**
* Attempt to extract the appId from the intent which launched this activity. * Attempt to extract the appId from the intent which launched this activity.
@ -1424,8 +1424,8 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
private TextView progressPercent; private TextView progressPercent;
private ImageButton cancelButton; private ImageButton cancelButton;
protected final DisplayImageOptions displayImageOptions; protected final DisplayImageOptions displayImageOptions;
public static boolean installed = false; public static boolean installed;
public static boolean updateWanted = false; public static boolean updateWanted;
public AppDetailsHeaderFragment() { public AppDetailsHeaderFragment() {
displayImageOptions = new DisplayImageOptions.Builder() displayImageOptions = new DisplayImageOptions.Builder()
@ -1643,7 +1643,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
private AppDetailsData data; private AppDetailsData data;
private AppInstallListener installListener; private AppInstallListener installListener;
private AppDetailsSummaryFragment summaryFragment = null; private AppDetailsSummaryFragment summaryFragment;
private FrameLayout headerView; private FrameLayout headerView;

View File

@ -60,11 +60,11 @@ public class FDroid extends ActionBarActivity {
public static final String ACTION_ADD_REPO = "org.fdroid.fdroid.FDroid.ACTION_ADD_REPO"; public static final String ACTION_ADD_REPO = "org.fdroid.fdroid.FDroid.ACTION_ADD_REPO";
private FDroidApp fdroidApp = null; private FDroidApp fdroidApp;
private ViewPager viewPager; private ViewPager viewPager;
private TabManager tabManager = null; private TabManager tabManager;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {

View File

@ -78,7 +78,7 @@ public class FDroidApp extends Application {
private static final org.spongycastle.jce.provider.BouncyCastleProvider spongyCastleProvider; private static final org.spongycastle.jce.provider.BouncyCastleProvider spongyCastleProvider;
@SuppressWarnings("unused") @SuppressWarnings("unused")
BluetoothAdapter bluetoothAdapter = null; BluetoothAdapter bluetoothAdapter;
static { static {
spongyCastleProvider = new org.spongycastle.jce.provider.BouncyCastleProvider(); spongyCastleProvider = new org.spongycastle.jce.provider.BouncyCastleProvider();

View File

@ -57,7 +57,7 @@ public class FDroidCertPins {
"87e3bf322427c1405d2736c381e01d1a71d4a039", "87e3bf322427c1405d2736c381e01d1a71d4a039",
}; };
public static List<String> PINLIST = null; public static List<String> PINLIST;
public static String[] getPinList() { public static String[] getPinList() {
if (PINLIST == null) { if (PINLIST == null) {

View File

@ -16,7 +16,7 @@ public class ProgressBufferedInputStream extends BufferedInputStream {
final Bundle data; final Bundle data;
final int totalBytes; final int totalBytes;
int currentBytes = 0; int currentBytes;
/** /**
* Reports progress to the specified {@link ProgressListener}, with the * Reports progress to the specified {@link ProgressListener}, with the

View File

@ -53,8 +53,8 @@ public class RepoUpdater {
@NonNull protected final Repo repo; @NonNull protected final Repo repo;
private List<App> apps = new ArrayList<>(); private List<App> apps = new ArrayList<>();
private List<Apk> apks = new ArrayList<>(); private List<Apk> apks = new ArrayList<>();
private RepoUpdateRememberer rememberer = null; private RepoUpdateRememberer rememberer;
protected boolean hasChanged = false; protected boolean hasChanged;
@Nullable protected ProgressListener progressListener; @Nullable protected ProgressListener progressListener;
/** /**

View File

@ -40,8 +40,8 @@ public class RepoXMLHandler extends DefaultHandler {
private final List<App> apps = new ArrayList<>(); private final List<App> apps = new ArrayList<>();
private final List<Apk> apksList = new ArrayList<>(); private final List<Apk> apksList = new ArrayList<>();
private App curapp = null; private App curapp;
private Apk curapk = null; private Apk curapk;
private final StringBuilder curchars = new StringBuilder(); private final StringBuilder curchars = new StringBuilder();
// After processing the XML, these will be -1 if the index didn't specify // After processing the XML, these will be -1 if the index didn't specify

View File

@ -23,7 +23,7 @@ public class TabManager {
private final ViewPager pager; private final ViewPager pager;
private final FDroid parent; private final FDroid parent;
private final ActionBar actionBar; private final ActionBar actionBar;
private Spinner actionBarSpinner = null; private Spinner actionBarSpinner;
// Used to make sure we only search for the action bar spinner once // Used to make sure we only search for the action bar spinner once
// in each orientation. // in each orientation.

View File

@ -305,7 +305,7 @@ public class ApkProvider extends FDroidProvider {
private static class Query extends QueryBuilder { private static class Query extends QueryBuilder {
private boolean repoTableRequired = false; private boolean repoTableRequired;
@Override @Override
protected String getRequiredTables() { protected String getRequiredTables() {

View File

@ -237,7 +237,7 @@ public class AppProvider extends FDroidProvider {
*/ */
private static class AppQuerySelection extends QuerySelection { private static class AppQuerySelection extends QuerySelection {
private boolean naturalJoinToInstalled = false; private boolean naturalJoinToInstalled;
public AppQuerySelection() { public AppQuerySelection() {
// The same as no selection, because "1" will always resolve to true when executing the SQL query. // The same as no selection, because "1" will always resolve to true when executing the SQL query.
@ -286,10 +286,10 @@ public class AppProvider extends FDroidProvider {
private static class Query extends QueryBuilder { private static class Query extends QueryBuilder {
private boolean isSuggestedApkTableAdded = false; private boolean isSuggestedApkTableAdded;
private boolean requiresInstalledTable = false; private boolean requiresInstalledTable;
private boolean categoryFieldAdded = false; private boolean categoryFieldAdded;
private boolean countFieldAppended = false; private boolean countFieldAppended;
@Override @Override
protected String getRequiredTables() { protected String getRequiredTables() {

View File

@ -25,7 +25,7 @@ public abstract class FDroidProvider extends ContentProvider {
private DBHelper dbHelper; private DBHelper dbHelper;
private boolean isApplyingBatch = false; private boolean isApplyingBatch;
protected abstract String getTableName(); protected abstract String getTableName();

View File

@ -18,7 +18,7 @@ public class NewRepoConfig {
private static final String TAG = "NewRepoConfig"; private static final String TAG = "NewRepoConfig";
private String errorMessage; private String errorMessage;
private boolean isValidRepo = false; private boolean isValidRepo;
private String uriString; private String uriString;
private String host; private String host;

View File

@ -7,8 +7,8 @@ abstract class QueryBuilder {
private final List<String> fields = new ArrayList<>(); private final List<String> fields = new ArrayList<>();
private final StringBuilder tables = new StringBuilder(getRequiredTables()); private final StringBuilder tables = new StringBuilder(getRequiredTables());
private String selection = null; private String selection;
private String orderBy = null; private String orderBy;
protected abstract String getRequiredTables(); protected abstract String getRequiredTables();

View File

@ -82,8 +82,8 @@ public final class LocalRepoManager {
private final Map<String, App> apps = new HashMap<>(); private final Map<String, App> apps = new HashMap<>();
public final SanitizedFile xmlIndex; public final SanitizedFile xmlIndex;
private SanitizedFile xmlIndexJar = null; private SanitizedFile xmlIndexJar;
private SanitizedFile xmlIndexJarUnsigned = null; private SanitizedFile xmlIndexJarUnsigned;
public final SanitizedFile webRoot; public final SanitizedFile webRoot;
public final SanitizedFile fdroidDir; public final SanitizedFile fdroidDir;
public final SanitizedFile fdroidDirCaps; public final SanitizedFile fdroidDirCaps;

View File

@ -16,7 +16,7 @@ public abstract class PeerFinder<T extends Peer> {
private static final String TAG = "PeerFinder"; private static final String TAG = "PeerFinder";
protected boolean isScanning = false; protected boolean isScanning;
protected final Context context; protected final Context context;
public abstract void scan(); public abstract void scan();

View File

@ -18,17 +18,17 @@ public final class BluetoothSwap extends SwapType {
private static final String TAG = "BluetoothSwap"; private static final String TAG = "BluetoothSwap";
public static final String BLUETOOTH_NAME_TAG = "FDroid:"; public static final String BLUETOOTH_NAME_TAG = "FDroid:";
private static BluetoothSwap mInstance = null; private static BluetoothSwap mInstance;
@NonNull @NonNull
private final BluetoothAdapter adapter; private final BluetoothAdapter adapter;
private BroadcastReceiver receiver; private BroadcastReceiver receiver;
private boolean isDiscoverable = false; private boolean isDiscoverable;
@Nullable @Nullable
private BluetoothServer server; private BluetoothServer server;
private String deviceBluetoothName = null; private String deviceBluetoothName;
public static SwapType create(@NonNull Context context) { public static SwapType create(@NonNull Context context) {
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();

View File

@ -23,7 +23,7 @@ public class WifiSwap extends SwapType {
private static final String TAG = "WifiSwap"; private static final String TAG = "WifiSwap";
private Handler webServerThreadHandler = null; private Handler webServerThreadHandler;
private LocalHTTPD localHttpd; private LocalHTTPD localHttpd;
private final BonjourBroadcast bonjourBroadcast; private final BonjourBroadcast bonjourBroadcast;

View File

@ -61,7 +61,7 @@ public class ApkDownloader implements AsyncDownloader.Listener {
public static final int ERROR_DOWNLOAD_FAILED = 102; public static final int ERROR_DOWNLOAD_FAILED = 102;
private static final String EVENT_SOURCE_ID = "sourceId"; private static final String EVENT_SOURCE_ID = "sourceId";
private static long downloadIdCounter = 0; private static long downloadIdCounter;
/** /**
* Used as a key to pass data through with an error event, explaining the type of event. * Used as a key to pass data through with an error event, explaining the type of event.
@ -76,8 +76,8 @@ public class ApkDownloader implements AsyncDownloader.Listener {
@NonNull private final SanitizedFile potentiallyCachedFile; @NonNull private final SanitizedFile potentiallyCachedFile;
private ProgressListener listener; private ProgressListener listener;
private AsyncDownloader dlWrapper = null; private AsyncDownloader dlWrapper;
private boolean isComplete = false; private boolean isComplete;
private final long id = ++downloadIdCounter; private final long id = ++downloadIdCounter;

View File

@ -17,7 +17,7 @@ class AsyncDownloadWrapper extends Handler implements AsyncDownloader {
private static final String MSG_DATA = "data"; private static final String MSG_DATA = "data";
private final Downloader downloader; private final Downloader downloader;
private DownloadThread downloadThread = null; private DownloadThread downloadThread;
private final Listener listener; private final Listener listener;

View File

@ -31,9 +31,9 @@ public abstract class Downloader {
private final File outputFile; private final File outputFile;
protected final URL sourceUrl; protected final URL sourceUrl;
protected String cacheTag = null; protected String cacheTag;
protected int bytesRead = 0; protected int bytesRead;
protected int totalBytes = 0; protected int totalBytes;
public abstract InputStream getInputStream() throws IOException; public abstract InputStream getInputStream() throws IOException;
public abstract void close(); public abstract void close();

View File

@ -34,7 +34,7 @@ public class HttpDownloader extends Downloader {
protected HttpURLConnection connection; protected HttpURLConnection connection;
private InputStream stream; private InputStream stream;
private int statusCode = -1; private int statusCode = -1;
private boolean onlyStream = false; private boolean onlyStream;
HttpDownloader(Context context, URL url, File destFile) HttpDownloader(Context context, URL url, File destFile)
throws FileNotFoundException, MalformedURLException { throws FileNotFoundException, MalformedURLException {

View File

@ -16,8 +16,8 @@ public class BluetoothConnection {
private static final String TAG = "BluetoothConnection"; private static final String TAG = "BluetoothConnection";
private InputStream input = null; private InputStream input;
private OutputStream output = null; private OutputStream output;
protected final BluetoothSocket socket; protected final BluetoothSocket socket;
public BluetoothConnection(BluetoothSocket socket) throws IOException { public BluetoothConnection(BluetoothSocket socket) throws IOException {
@ -54,4 +54,4 @@ public class BluetoothConnection {
public void close() throws IOException { public void close() throws IOException {
closeQuietly(); closeQuietly();
} }
} }

View File

@ -35,7 +35,7 @@ public class BluetoothServer extends Thread {
private final File webRoot; private final File webRoot;
private final BluetoothSwap swap; private final BluetoothSwap swap;
private boolean isRunning = false; private boolean isRunning;
public BluetoothServer(BluetoothSwap swap, File webRoot) { public BluetoothServer(BluetoothSwap swap, File webRoot) {
this.webRoot = webRoot; this.webRoot = webRoot;

View File

@ -152,7 +152,7 @@ public class Response {
private InputStream contentStream; private InputStream contentStream;
private int statusCode = 200; private int statusCode = 200;
private int fileSize = -1; private int fileSize = -1;
private String etag = null; private String etag;
public Builder() { } public Builder() { }

View File

@ -28,7 +28,7 @@ public class AppDiff {
public final PackageManager mPm; public final PackageManager mPm;
public final PackageInfo mPkgInfo; public final PackageInfo mPkgInfo;
public ApplicationInfo mInstalledAppInfo = null; public ApplicationInfo mInstalledAppInfo;
public AppDiff(PackageManager mPm, Uri mPackageURI) { public AppDiff(PackageManager mPm, Uri mPackageURI) {
this.mPm = mPm; this.mPm = mPm;

View File

@ -56,8 +56,8 @@ public class InstallConfirmActivity extends Activity implements OnCancelListener
// Buttons to indicate user acceptance // Buttons to indicate user acceptance
private Button mOk; private Button mOk;
private Button mCancel; private Button mCancel;
CaffeinatedScrollView mScrollView = null; CaffeinatedScrollView mScrollView;
private boolean mOkCanInstall = false; private boolean mOkCanInstall;
private static final String TAB_ID_ALL = "all"; private static final String TAB_ID_ALL = "all";
private static final String TAB_ID_NEW = "new"; private static final String TAB_ID_NEW = "new";

View File

@ -91,7 +91,7 @@ public class ManageReposActivity extends ActionBarActivity {
* True if activity started with an intent such as from QR code. False if * True if activity started with an intent such as from QR code. False if
* opened from, e.g. the main menu. * opened from, e.g. the main menu.
*/ */
private boolean isImportingRepo = false; private boolean isImportingRepo;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {

View File

@ -42,8 +42,8 @@ public class AvailableAppsFragment extends AppListFragment implements
private List<String> categories; private List<String> categories;
private Spinner categorySpinner; private Spinner categorySpinner;
private String currentCategory = null; private String currentCategory;
private AppListAdapter adapter = null; private AppListAdapter adapter;
@Override @Override
protected String getFromTitle() { protected String getFromTitle() {

View File

@ -25,7 +25,7 @@ public abstract class ThemeableListFragment extends ListFragment {
return headerView; return headerView;
} }
private View headerView = null; private View headerView;
private View getHeaderView(LayoutInflater inflater, ViewGroup container) { private View getHeaderView(LayoutInflater inflater, ViewGroup container) {
if (getHeaderLayout() > 0) { if (getHeaderLayout() > 0) {

View File

@ -115,9 +115,9 @@ public class SwapWorkflowActivity extends AppCompatActivity {
private Toolbar toolbar; private Toolbar toolbar;
private InnerView currentView; private InnerView currentView;
private boolean hasPreparedLocalRepo = false; private boolean hasPreparedLocalRepo;
private PrepareSwapRepo updateSwappableAppsTask = null; private PrepareSwapRepo updateSwappableAppsTask;
private NewRepoConfig confirmSwapConfig = null; private NewRepoConfig confirmSwapConfig;
@NonNull @NonNull
private final ServiceConnection serviceConnection = new ServiceConnection() { private final ServiceConnection serviceConnection = new ServiceConnection() {
@ -138,7 +138,7 @@ public class SwapWorkflowActivity extends AppCompatActivity {
}; };
@Nullable @Nullable
private SwapService service = null; private SwapService service;
@NonNull @NonNull
public SwapService getService() { public SwapService getService() {

View File

@ -47,6 +47,7 @@
<module name="WhitespaceAfter" /> <module name="WhitespaceAfter" />
<module name="WhitespaceAround" /> <module name="WhitespaceAround" />
<module name="UnnecessaryParentheses" /> <module name="UnnecessaryParentheses" />
<module name="ExplicitInitialization" />
<module name="ModifierOrder" /> <module name="ModifierOrder" />
<module name="RedundantModifier" /> <module name="RedundantModifier" />