checkstyle: Add UnnecessaryParentheses
This commit is contained in:
		
							parent
							
								
									561d7833d1
								
							
						
					
					
						commit
						0a13cf5c63
					
				| @ -373,7 +373,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A | ||||
|     @Override | ||||
|     protected void onCreate(Bundle savedInstanceState) { | ||||
| 
 | ||||
|         fdroidApp = ((FDroidApp) getApplication()); | ||||
|         fdroidApp = (FDroidApp) getApplication(); | ||||
|         fdroidApp.applyTheme(this); | ||||
| 
 | ||||
|         super.onCreate(savedInstanceState); | ||||
| @ -1523,7 +1523,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A | ||||
|          * Shows or hides progress bar and related views. | ||||
|          */ | ||||
|         private void setProgressVisible(boolean visible) { | ||||
|             int state = (visible) ? View.VISIBLE : View.GONE; | ||||
|             int state = visible ? View.VISIBLE : View.GONE; | ||||
|             progressBar.setVisibility(state); | ||||
|             progressSize.setVisibility(state); | ||||
|             progressPercent.setVisibility(state); | ||||
| @ -1614,7 +1614,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A | ||||
|                 if (updateWanted) { | ||||
|                     if (getApp().suggestedVercode > 0) { | ||||
|                         final Apk apkToInstall = ApkProvider.Helper.find(activity, getApp().id, getApp().suggestedVercode); | ||||
|                         (activity).install(apkToInstall); | ||||
|                         activity.install(apkToInstall); | ||||
|                         return; | ||||
|                     } | ||||
|                 } | ||||
|  | ||||
| @ -69,7 +69,7 @@ public class FDroid extends ActionBarActivity { | ||||
|     @Override | ||||
|     protected void onCreate(Bundle savedInstanceState) { | ||||
| 
 | ||||
|         fdroidApp = ((FDroidApp) getApplication()); | ||||
|         fdroidApp = (FDroidApp) getApplication(); | ||||
|         fdroidApp.applyTheme(this); | ||||
| 
 | ||||
|         super.onCreate(savedInstanceState); | ||||
|  | ||||
| @ -140,7 +140,7 @@ public class FDroidApp extends Application { | ||||
|     public static void initWifiSettings() { | ||||
|         port = 8888; | ||||
|         ipAddressString = null; | ||||
|         subnetInfo = (new SubnetUtils("0.0.0.0/32").getInfo()); | ||||
|         subnetInfo = new SubnetUtils("0.0.0.0/32").getInfo(); | ||||
|         ssid = ""; | ||||
|         bssid = ""; | ||||
|     } | ||||
|  | ||||
| @ -462,7 +462,7 @@ public final class Utils { | ||||
|         } | ||||
| 
 | ||||
|         public static String str(CommaSeparatedList instance) { | ||||
|             return (instance == null ? null : instance.toString()); | ||||
|             return instance == null ? null : instance.toString(); | ||||
|         } | ||||
| 
 | ||||
|         @Override | ||||
|  | ||||
| @ -11,7 +11,7 @@ public abstract class Compatibility { | ||||
| 
 | ||||
|     // like maxSdkVersion | ||||
|     protected static boolean upToApi(int apiLevel) { | ||||
|         return (apiLevel < 1 || getApi() <= apiLevel); | ||||
|         return apiLevel < 1 || getApi() <= apiLevel; | ||||
|     } | ||||
| 
 | ||||
|     protected static int getApi() { | ||||
|  | ||||
| @ -340,8 +340,8 @@ public class App extends ValueObject implements Comparable<App> { | ||||
|         apk.sig = Utils.hashBytes(fdroidSig, "md5"); | ||||
| 
 | ||||
|         this.installedApk = apk; | ||||
|         this.system = ((appInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0); | ||||
|         this.updatedSystemApp = ((appInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0); | ||||
|         this.system = (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0; | ||||
|         this.updatedSystemApp = (appInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0; | ||||
|         this.uninstallable = !this.system || this.updatedSystemApp; | ||||
|     } | ||||
| 
 | ||||
| @ -405,7 +405,7 @@ public class App extends ValueObject implements Comparable<App> { | ||||
|     public boolean hasUpdates() { | ||||
|         boolean updates = false; | ||||
|         if (suggestedVercode > 0) { | ||||
|             updates = (installedVersionCode > 0 && installedVersionCode < suggestedVercode); | ||||
|             updates = installedVersionCode > 0 && installedVersionCode < suggestedVercode; | ||||
|         } | ||||
|         return updates; | ||||
|     } | ||||
|  | ||||
| @ -301,7 +301,7 @@ public class DBHelper extends SQLiteOpenHelper { | ||||
|                     while (!cursor.isAfterLast()) { | ||||
|                         Repo repo = new Repo(); | ||||
|                         repo.address = cursor.getString(0); | ||||
|                         repo.inuse = (cursor.getInt(1) == 1); | ||||
|                         repo.inuse = cursor.getInt(1) == 1; | ||||
|                         repo.pubkey = cursor.getString(2); | ||||
|                         oldrepos.add(repo); | ||||
|                         cursor.moveToNext(); | ||||
| @ -491,8 +491,8 @@ public class DBHelper extends SQLiteOpenHelper { | ||||
| 
 | ||||
|     private static boolean columnExists(SQLiteDatabase db, | ||||
|             String table, String column) { | ||||
|         return (db.rawQuery("select * from " + table + " limit 0,1", null) | ||||
|                 .getColumnIndex(column) != -1); | ||||
|         return db.rawQuery("select * from " + table + " limit 0,1", null) | ||||
|                 .getColumnIndex(column) != -1; | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | ||||
| @ -255,8 +255,8 @@ public class PrivilegedInstaller extends Installer { | ||||
|             return; | ||||
|         } | ||||
| 
 | ||||
|         final boolean isSystem = ((appInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0); | ||||
|         final boolean isUpdate = ((appInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0); | ||||
|         final boolean isSystem = (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0; | ||||
|         final boolean isUpdate = (appInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0; | ||||
| 
 | ||||
|         if (isSystem && !isUpdate) { | ||||
|             // Cannot remove system apps unless we're uninstalling updates | ||||
|  | ||||
| @ -88,11 +88,9 @@ public class BluetoothDownloader extends Downloader { | ||||
|     @Override | ||||
|     public boolean isCached() { | ||||
|         FileDetails details = getFileDetails(); | ||||
|         return ( | ||||
|             details != null && | ||||
|         return details != null && | ||||
|             details.getCacheTag() != null && | ||||
|             details.getCacheTag().equals(getCacheTag()) | ||||
|             ); | ||||
|             details.getCacheTag().equals(getCacheTag()); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|  | ||||
| @ -223,10 +223,10 @@ public class WifiStateChangeService extends Service { | ||||
|             return null; | ||||
|         } else { | ||||
|             return String.format(Locale.ENGLISH, "%d.%d.%d.%d", | ||||
|                     (ipAddress & 0xff), | ||||
|                     (ipAddress >> 8 & 0xff), | ||||
|                     (ipAddress >> 16 & 0xff), | ||||
|                     (ipAddress >> 24 & 0xff)); | ||||
|                     ipAddress & 0xff, | ||||
|                     ipAddress >> 8 & 0xff, | ||||
|                     ipAddress >> 16 & 0xff, | ||||
|                     ipAddress >> 24 & 0xff); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -120,7 +120,7 @@ public class InstallExtensionDialogActivity extends FragmentActivity { | ||||
| 
 | ||||
|             @Override | ||||
|             protected Boolean doInBackground(Void... params) { | ||||
|                 return (Shell.SU.version(true) != null); | ||||
|                 return Shell.SU.version(true) != null; | ||||
|             } | ||||
| 
 | ||||
|             @Override | ||||
|  | ||||
| @ -433,14 +433,14 @@ public class AppSecurityPermissions { | ||||
|     private boolean isDisplayablePermission(PermissionInfo pInfo, int newReqFlags, | ||||
|             int existingReqFlags) { | ||||
|         final int base = pInfo.protectionLevel & PermissionInfo.PROTECTION_MASK_BASE; | ||||
|         final boolean isNormal = (base == PermissionInfo.PROTECTION_NORMAL); | ||||
|         final boolean isDangerous = (base == PermissionInfo.PROTECTION_DANGEROUS); | ||||
|         final boolean isNormal = base == PermissionInfo.PROTECTION_NORMAL; | ||||
|         final boolean isDangerous = base == PermissionInfo.PROTECTION_DANGEROUS; | ||||
|         final boolean isRequired = | ||||
|                 ((newReqFlags & PackageInfo.REQUESTED_PERMISSION_REQUIRED) != 0); | ||||
|                 (newReqFlags & PackageInfo.REQUESTED_PERMISSION_REQUIRED) != 0; | ||||
|         final boolean wasGranted = | ||||
|                 ((existingReqFlags & PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0); | ||||
|                 (existingReqFlags & PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0; | ||||
|         final boolean isGranted = | ||||
|                 ((newReqFlags & PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0); | ||||
|                 (newReqFlags & PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0; | ||||
| 
 | ||||
|         // Dangerous and normal permissions are always shown to the user if the permission | ||||
|         // is required, or it was previously granted | ||||
| @ -450,7 +450,7 @@ public class AppSecurityPermissions { | ||||
|         } | ||||
| 
 | ||||
|         final boolean isDevelopment = | ||||
|                 ((pInfo.protectionLevel & PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0); | ||||
|                 (pInfo.protectionLevel & PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0; | ||||
| 
 | ||||
|         // Development permissions are only shown to the user if they are already | ||||
|         // granted to the app -- if we are installing an app and they are not | ||||
|  | ||||
| @ -93,7 +93,7 @@ public class InstallConfirmActivity extends Activity implements OnCancelListener | ||||
|             mScrollView = new CaffeinatedScrollView(this); | ||||
|             mScrollView.setFillViewport(true); | ||||
|             final boolean newPermissionsFound = | ||||
|                     (perms.getPermissionCount(AppSecurityPermissions.WHICH_NEW) > 0); | ||||
|                     perms.getPermissionCount(AppSecurityPermissions.WHICH_NEW) > 0; | ||||
|             if (newPermissionsFound) { | ||||
|                 permVisible = true; | ||||
|                 mScrollView.addView(perms.getPermissionsView( | ||||
|  | ||||
| @ -140,9 +140,9 @@ public abstract class AppListAdapter extends CursorAdapter { | ||||
|     } | ||||
| 
 | ||||
|     private void layoutIcon(ImageView icon, boolean compact) { | ||||
|         int size = (int) mContext.getResources().getDimension((compact | ||||
|         int size = (int) mContext.getResources().getDimension(compact | ||||
|             ? R.dimen.applist_icon_compact_size | ||||
|             : R.dimen.applist_icon_normal_size)); | ||||
|             : R.dimen.applist_icon_normal_size); | ||||
| 
 | ||||
|         LinearLayout.LayoutParams params = | ||||
|             (LinearLayout.LayoutParams) icon.getLayoutParams(); | ||||
|  | ||||
| @ -173,7 +173,7 @@ public class SelectAppsView extends ListView implements | ||||
|         adapter.swapCursor(cursor); | ||||
| 
 | ||||
|         for (int i = 0; i < getCount(); i++) { | ||||
|             Cursor c = ((Cursor) getItemAtPosition(i)); | ||||
|             Cursor c = (Cursor) getItemAtPosition(i); | ||||
|             String packageName = c.getString(c.getColumnIndex(InstalledAppProvider.DataColumns.APP_ID)); | ||||
|             getState().ensureFDroidSelected(); | ||||
|             for (String selected : getState().getAppsToSwap()) { | ||||
|  | ||||
| @ -213,7 +213,7 @@ public class StartSwapView extends ScrollView implements SwapWorkflowActivity.In | ||||
|             int textResource = getManager().isBluetoothDiscoverable() ? R.string.swap_visible_bluetooth : R.string.swap_not_visible_bluetooth; | ||||
|             textBluetoothVisible.setText(textResource); | ||||
| 
 | ||||
|             final SwitchCompat bluetoothSwitch = ((SwitchCompat) findViewById(R.id.switch_bluetooth)); | ||||
|             final SwitchCompat bluetoothSwitch = (SwitchCompat) findViewById(R.id.switch_bluetooth); | ||||
|             Utils.debugLog(TAG, getManager().isBluetoothDiscoverable() ? "Initially marking switch as checked, because Bluetooth is discoverable." : "Initially marking switch as not-checked, because Bluetooth is not discoverable."); | ||||
|             bluetoothSwitch.setChecked(getManager().isBluetoothDiscoverable()); | ||||
|             bluetoothSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { | ||||
|  | ||||
| @ -150,9 +150,9 @@ public class SwapConnecting extends LinearLayout implements SwapWorkflowActivity | ||||
|         @Override | ||||
|         public void onReceive(Context context, Intent intent) { | ||||
| 
 | ||||
|             TextView progressText = ((TextView) findViewById(R.id.heading)); | ||||
|             TextView errorText    = ((TextView) findViewById(R.id.error)); | ||||
|             Button   backButton   = ((Button) findViewById(R.id.back)); | ||||
|             TextView progressText = (TextView) findViewById(R.id.heading); | ||||
|             TextView errorText    = (TextView) findViewById(R.id.error); | ||||
|             Button   backButton   = (Button) findViewById(R.id.back); | ||||
| 
 | ||||
|             String message; | ||||
|             if (intent.hasExtra(getMessageExtra())) { | ||||
|  | ||||
| @ -44,13 +44,13 @@ public class PrivilegedService extends Service { | ||||
| 
 | ||||
|     private boolean hasPrivilegedPermissionsImpl() { | ||||
|         boolean hasInstallPermission = | ||||
|                 (getPackageManager().checkPermission(Manifest.permission.INSTALL_PACKAGES, getPackageName()) | ||||
|                         == PackageManager.PERMISSION_GRANTED); | ||||
|                 getPackageManager().checkPermission(Manifest.permission.INSTALL_PACKAGES, getPackageName()) | ||||
|                         == PackageManager.PERMISSION_GRANTED; | ||||
|         boolean hasDeletePermission = | ||||
|                 (getPackageManager().checkPermission(Manifest.permission.DELETE_PACKAGES, getPackageName()) | ||||
|                         == PackageManager.PERMISSION_GRANTED); | ||||
|                 getPackageManager().checkPermission(Manifest.permission.DELETE_PACKAGES, getPackageName()) | ||||
|                         == PackageManager.PERMISSION_GRANTED; | ||||
| 
 | ||||
|         return (hasInstallPermission && hasDeletePermission); | ||||
|         return hasInstallPermission && hasDeletePermission; | ||||
|     } | ||||
| 
 | ||||
|     private void installPackageImpl(Uri packageURI, int flags, String installerPackageName, | ||||
|  | ||||
| @ -46,6 +46,7 @@ | ||||
|         <module name="TypecastParenPad" /> | ||||
|         <module name="WhitespaceAfter" /> | ||||
|         <module name="WhitespaceAround" /> | ||||
|         <module name="UnnecessaryParentheses" /> | ||||
| 
 | ||||
|         <module name="ModifierOrder" /> | ||||
|         <module name="RedundantModifier" /> | ||||
| @ -63,6 +64,7 @@ | ||||
|         <!--<module name="MissingSwitchDefault" />--> | ||||
| 
 | ||||
|         <module name="FinalClass" /> | ||||
| 
 | ||||
|         <!--<module name="HideUtilityClassConstructor" />--> | ||||
|         <!--<module name="InterfaceIsType" />--> | ||||
|         <!--<module name="VisibilityModifier" />--> | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Daniel Martí
						Daniel Martí