PMD: Enable and obey UnnecessaryParentheses

This works on statements, not expressions, so it's a lot easier and
saner to obey than UselessParentheses.
This commit is contained in:
Daniel Martí 2016-04-28 17:58:00 +01:00
parent e5bc365b64
commit ac8d3ff600
2 changed files with 2 additions and 1 deletions

View File

@ -219,7 +219,7 @@ public class WifiStateChangeService extends Service {
if (inetAddress.equals(address.getAddress()) && !TextUtils.isEmpty(FDroidApp.ipAddressString)) { if (inetAddress.equals(address.getAddress()) && !TextUtils.isEmpty(FDroidApp.ipAddressString)) {
String cidr = String.format(Locale.ENGLISH, "%s/%d", String cidr = String.format(Locale.ENGLISH, "%s/%d",
FDroidApp.ipAddressString, address.getNetworkPrefixLength()); FDroidApp.ipAddressString, address.getNetworkPrefixLength());
FDroidApp.subnetInfo = (new SubnetUtils(cidr)).getInfo(); FDroidApp.subnetInfo = new SubnetUtils(cidr).getInfo();
break; break;
} }
} }

View File

@ -20,6 +20,7 @@
<rule ref="rulesets/java/optimizations.xml/UseArraysAsList"/> <rule ref="rulesets/java/optimizations.xml/UseArraysAsList"/>
<rule ref="rulesets/java/controversial.xml/UnnecessaryConstructor"/> <rule ref="rulesets/java/controversial.xml/UnnecessaryConstructor"/>
<rule ref="rulesets/java/controversial.xml/UnnecessaryParentheses"/>
<rule ref="rulesets/java/strictexception.xml/AvoidRethrowingException"/> <rule ref="rulesets/java/strictexception.xml/AvoidRethrowingException"/>
<rule ref="rulesets/java/strictexception.xml/AvoidCatchingThrowable"/> <rule ref="rulesets/java/strictexception.xml/AvoidCatchingThrowable"/>