make local variables final.
This commit is contained in:
parent
dce9ad9e88
commit
6abdc24080
|
|
@ -80,7 +80,7 @@ public final class PackageNamesLoader
|
|||
Attributes aAtts)
|
||||
throws SAXException
|
||||
{
|
||||
if (aQName.equals("package")) {
|
||||
if ("package".equals(aQName)) {
|
||||
//push package name
|
||||
final String name = aAtts.getValue("name");
|
||||
if (name == null) {
|
||||
|
|
|
|||
|
|
@ -52,16 +52,16 @@ public class HideUtilityClassConstructorCheck extends Check
|
|||
boolean hasPublicCtor = false;
|
||||
|
||||
while (child != null) {
|
||||
int type = child.getType();
|
||||
final int type = child.getType();
|
||||
if (type == TokenTypes.METHOD_DEF
|
||||
|| type == TokenTypes.VARIABLE_DEF)
|
||||
{
|
||||
hasMethodOrField = true;
|
||||
final DetailAST modifiers =
|
||||
child.findFirstToken(TokenTypes.MODIFIERS);
|
||||
boolean isStatic =
|
||||
final boolean isStatic =
|
||||
modifiers.branchContains(TokenTypes.LITERAL_STATIC);
|
||||
boolean isPrivate =
|
||||
final boolean isPrivate =
|
||||
modifiers.branchContains(TokenTypes.LITERAL_PRIVATE);
|
||||
|
||||
if (!isStatic && !isPrivate) {
|
||||
|
|
|
|||
|
|
@ -368,7 +368,7 @@ public final class StrictDuplicateCodeCheck extends AbstractFileSetCheck
|
|||
for (int iLine = 0; iLine < iBlockCount; iLine++) {
|
||||
|
||||
final int iSum = iLineBlockChecksums[iLine];
|
||||
int[] jLines = jChecksumInfo.findLinesWithChecksum(iSum);
|
||||
final int[] jLines = jChecksumInfo.findLinesWithChecksum(iSum);
|
||||
// detailed analysis only if the iLine block occurs in jFile at all
|
||||
if (jLines.length > 0) {
|
||||
findDuplicateFromLine(aI, aJ, iLine, jLines, ignorePairs);
|
||||
|
|
@ -420,10 +420,11 @@ public final class StrictDuplicateCodeCheck extends AbstractFileSetCheck
|
|||
}
|
||||
}
|
||||
|
||||
int duplicateLines = verifiyDuplicateLines(aI, aJ, aILine, jLine);
|
||||
final int duplicateLines =
|
||||
verifiyDuplicateLines(aI, aJ, aILine, jLine);
|
||||
if (duplicateLines >= mMin) {
|
||||
reportDuplicate(duplicateLines, aILine, mFiles.get(aJ), jLine);
|
||||
int extend = duplicateLines - mMin;
|
||||
final int extend = duplicateLines - mMin;
|
||||
for (int i = 0; i < extend; i++) {
|
||||
final int offset = (i + 1);
|
||||
aIgnore.put(aILine + offset, jLine + offset);
|
||||
|
|
@ -499,7 +500,7 @@ public final class StrictDuplicateCodeCheck extends AbstractFileSetCheck
|
|||
*/
|
||||
private String[] getTrimmed(String[] aLines)
|
||||
{
|
||||
String[] ret = new String[aLines.length];
|
||||
final String[] ret = new String[aLines.length];
|
||||
for (int i = 0; i < ret.length; i++) {
|
||||
ret[i] = aLines[i].trim();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,12 +127,12 @@ public final class CrossLanguageRegexpHeaderCheck extends AbstractFileSetCheck
|
|||
final RegexpHeaderChecker regexpHeaderChecker =
|
||||
new RegexpHeaderChecker(
|
||||
mHeaderInfo, new FileSetCheckViolationMonitor());
|
||||
List<File> files = filter(aFiles);
|
||||
final List<File> files = filter(aFiles);
|
||||
for (final File file : files) {
|
||||
final String path = file.getPath();
|
||||
msgDispatcher.fireFileStarted(path);
|
||||
try {
|
||||
String[] lines = Utils.getLines(path);
|
||||
final String[] lines = Utils.getLines(path);
|
||||
regexpHeaderChecker.checkLines(lines);
|
||||
}
|
||||
catch (IOException ex) {
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ public abstract class AbstractComplexityCheck
|
|||
*/
|
||||
private void leaveMethodDef(DetailAST aAST)
|
||||
{
|
||||
BigInteger max = BigInteger.valueOf(mMax);
|
||||
final BigInteger max = BigInteger.valueOf(mMax);
|
||||
if (mCurrentValue.compareTo(max) > 0) {
|
||||
log(aAST, getMessageID(), mCurrentValue, max);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ public class SeverityMatchFilter
|
|||
/** {@inheritDoc} */
|
||||
public boolean accept(AuditEvent aEvent)
|
||||
{
|
||||
boolean result = mSeverityLevel.equals(aEvent.getSeverityLevel());
|
||||
final boolean result = mSeverityLevel.equals(aEvent.getSeverityLevel());
|
||||
if (mAcceptOnMatch) {
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue