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 int dimension = Integer.MIN_VALUE;
private String contents = null;
private String displayContents = null;
private String title = null;
private BarcodeFormat format = null;
private boolean encoded = false;
private String contents;
private String displayContents;
private String title;
private BarcodeFormat format;
private boolean encoded;
public QRCodeEncoder(String data, Bundle bundle, String type, String format, int dimension) {
this.dimension = dimension;

View File

@ -42,7 +42,7 @@ public class BoundedInputStream extends InputStream {
private final long max;
/** the number of bytes already returned */
private long pos = 0;
private long pos;
/** the marked position */
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.
@ -1424,8 +1424,8 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
private TextView progressPercent;
private ImageButton cancelButton;
protected final DisplayImageOptions displayImageOptions;
public static boolean installed = false;
public static boolean updateWanted = false;
public static boolean installed;
public static boolean updateWanted;
public AppDetailsHeaderFragment() {
displayImageOptions = new DisplayImageOptions.Builder()
@ -1643,7 +1643,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
private AppDetailsData data;
private AppInstallListener installListener;
private AppDetailsSummaryFragment summaryFragment = null;
private AppDetailsSummaryFragment summaryFragment;
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";
private FDroidApp fdroidApp = null;
private FDroidApp fdroidApp;
private ViewPager viewPager;
private TabManager tabManager = null;
private TabManager tabManager;
@Override
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;
@SuppressWarnings("unused")
BluetoothAdapter bluetoothAdapter = null;
BluetoothAdapter bluetoothAdapter;
static {
spongyCastleProvider = new org.spongycastle.jce.provider.BouncyCastleProvider();

View File

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

View File

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

View File

@ -53,8 +53,8 @@ public class RepoUpdater {
@NonNull protected final Repo repo;
private List<App> apps = new ArrayList<>();
private List<Apk> apks = new ArrayList<>();
private RepoUpdateRememberer rememberer = null;
protected boolean hasChanged = false;
private RepoUpdateRememberer rememberer;
protected boolean hasChanged;
@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<Apk> apksList = new ArrayList<>();
private App curapp = null;
private Apk curapk = null;
private App curapp;
private Apk curapk;
private final StringBuilder curchars = new StringBuilder();
// 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 FDroid parent;
private final ActionBar actionBar;
private Spinner actionBarSpinner = null;
private Spinner actionBarSpinner;
// Used to make sure we only search for the action bar spinner once
// in each orientation.

View File

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

View File

@ -237,7 +237,7 @@ public class AppProvider extends FDroidProvider {
*/
private static class AppQuerySelection extends QuerySelection {
private boolean naturalJoinToInstalled = false;
private boolean naturalJoinToInstalled;
public AppQuerySelection() {
// 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 boolean isSuggestedApkTableAdded = false;
private boolean requiresInstalledTable = false;
private boolean categoryFieldAdded = false;
private boolean countFieldAppended = false;
private boolean isSuggestedApkTableAdded;
private boolean requiresInstalledTable;
private boolean categoryFieldAdded;
private boolean countFieldAppended;
@Override
protected String getRequiredTables() {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -61,7 +61,7 @@ public class ApkDownloader implements AsyncDownloader.Listener {
public static final int ERROR_DOWNLOAD_FAILED = 102;
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.
@ -76,8 +76,8 @@ public class ApkDownloader implements AsyncDownloader.Listener {
@NonNull private final SanitizedFile potentiallyCachedFile;
private ProgressListener listener;
private AsyncDownloader dlWrapper = null;
private boolean isComplete = false;
private AsyncDownloader dlWrapper;
private boolean isComplete;
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 final Downloader downloader;
private DownloadThread downloadThread = null;
private DownloadThread downloadThread;
private final Listener listener;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -56,8 +56,8 @@ public class InstallConfirmActivity extends Activity implements OnCancelListener
// Buttons to indicate user acceptance
private Button mOk;
private Button mCancel;
CaffeinatedScrollView mScrollView = null;
private boolean mOkCanInstall = false;
CaffeinatedScrollView mScrollView;
private boolean mOkCanInstall;
private static final String TAB_ID_ALL = "all";
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
* opened from, e.g. the main menu.
*/
private boolean isImportingRepo = false;
private boolean isImportingRepo;
@Override
protected void onCreate(Bundle savedInstanceState) {

View File

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

View File

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

View File

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

View File

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