PMD: Get closer to obeying unnecessary

Don't enable it just yet, it's way too pedantic with parenthesis.
This commit is contained in:
Daniel Martí 2016-03-31 21:54:11 +01:00
parent b4dd9c857e
commit fddce692db
8 changed files with 11 additions and 17 deletions

View File

@ -204,6 +204,7 @@ task pmd(type: Pmd, dependsOn: assembleDebug) {
'java-finalizers', 'java-finalizers',
'java-imports', 'java-imports',
'java-migrating', 'java-migrating',
//'java-unnecessary', // too nitpicky with parenthesis
] ]
source 'src/main/java' source 'src/main/java'
include '**/org/fdroid/**/*.java' include '**/org/fdroid/**/*.java'

View File

@ -526,7 +526,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
private void onAppChanged() { private void onAppChanged() {
if (!reset(app.packageName)) { if (!reset(app.packageName)) {
AppDetails.this.finish(); this.finish();
return; return;
} }

View File

@ -105,12 +105,10 @@ public final class PRNGFixes extends Compatibility {
// Install a Linux PRNG-based SecureRandom implementation as the // Install a Linux PRNG-based SecureRandom implementation as the
// default, if not yet installed. // default, if not yet installed.
Provider[] secureRandomProviders = Provider[] secureRandomProviders = Security.getProviders("SecureRandom.SHA1PRNG");
Security.getProviders("SecureRandom.SHA1PRNG"); if (secureRandomProviders == null
if ((secureRandomProviders == null) || secureRandomProviders.length < 1
|| (secureRandomProviders.length < 1) || !LinuxPRNGSecureRandomProvider.class.equals(secureRandomProviders[0].getClass())) {
|| (!LinuxPRNGSecureRandomProvider.class.equals(
secureRandomProviders[0].getClass()))) {
Security.insertProviderAt(new LinuxPRNGSecureRandomProvider(), 1); Security.insertProviderAt(new LinuxPRNGSecureRandomProvider(), 1);
} }

View File

@ -79,8 +79,8 @@ class BonjourFinder extends PeerFinder implements ServiceListener {
} }
Utils.debugLog(TAG, "Adding mDNS service listeners for " + HTTP_SERVICE_TYPE + " and " + HTTPS_SERVICE_TYPE); Utils.debugLog(TAG, "Adding mDNS service listeners for " + HTTP_SERVICE_TYPE + " and " + HTTPS_SERVICE_TYPE);
jmdns.addServiceListener(HTTP_SERVICE_TYPE, BonjourFinder.this); jmdns.addServiceListener(HTTP_SERVICE_TYPE, this);
jmdns.addServiceListener(HTTPS_SERVICE_TYPE, BonjourFinder.this); jmdns.addServiceListener(HTTPS_SERVICE_TYPE, this);
listServices(); listServices();
} }

View File

@ -197,11 +197,6 @@ public class InstallConfirmActivity extends Activity implements OnCancelListener
startInstallConfirm(); startInstallConfirm();
} }
@Override
public void onBackPressed() {
super.onBackPressed();
}
// Generic handling when pressing back key // Generic handling when pressing back key
public void onCancel(DialogInterface dialog) { public void onCancel(DialogInterface dialog) {
finish(); finish();

View File

@ -199,7 +199,7 @@ public class AvailableAppsFragment extends AppListFragment implements
private void setCurrentCategory(String category) { private void setCurrentCategory(String category) {
currentCategory = category; currentCategory = category;
Utils.debugLog(TAG, "Category '" + currentCategory + "' selected."); Utils.debugLog(TAG, "Category '" + currentCategory + "' selected.");
getLoaderManager().restartLoader(0, null, AvailableAppsFragment.this); getLoaderManager().restartLoader(0, null, this);
} }
@Override @Override

View File

@ -250,7 +250,7 @@ public class SwapAppsView extends ListView implements
Apk apk = getApkToInstall(); Apk apk = getApkToInstall();
String broadcastUrl = intent.getStringExtra(Downloader.EXTRA_ADDRESS); String broadcastUrl = intent.getStringExtra(Downloader.EXTRA_ADDRESS);
if (apk != null && apk.repoAddress != null && (!TextUtils.equals(Utils.getApkUrl(apk.repoAddress, apk), broadcastUrl))) { if (apk != null && apk.repoAddress != null && !TextUtils.equals(Utils.getApkUrl(apk.repoAddress, apk), broadcastUrl)) {
return; return;
} }

View File

@ -795,7 +795,7 @@ public class SwapWorkflowActivity extends AppCompatActivity {
private void handleDownloadComplete(File apkFile, String packageName) { private void handleDownloadComplete(File apkFile, String packageName) {
try { try {
Installer.getActivityInstaller(SwapWorkflowActivity.this, new Installer.InstallerCallback() { Installer.getActivityInstaller(this, new Installer.InstallerCallback() {
@Override @Override
public void onSuccess(int operation) { public void onSuccess(int operation) {
// TODO: Don't reload the view weely-neely, but rather get the view to listen // TODO: Don't reload the view weely-neely, but rather get the view to listen