Issue #1566: ModifiedControlVariable violations fixed

This commit is contained in:
Ruslan Diachenko 2015-08-13 21:32:39 +01:00 committed by Roman Ivanov
parent d808a4e4d9
commit 242028813d
4 changed files with 9 additions and 5 deletions

View File

@ -303,6 +303,8 @@
<property name="setterCanReturnItsClass" value="true"/>
</module>
<module name="ModifiedControlVariable"/>
<!--
<module name="AvoidInlineConditionals"/>
<module name="ClassDataAbstractionCoupling"/>
@ -317,7 +319,6 @@
<module name="JavadocTagContinuationIndentation"/>
<module name="JavaNCSS"/>
<module name="MissingCtor"/>
<module name="ModifiedControlVariable"/>
<module name="MultipleStringLiterals"/>
<module name="NPathComplexity"/>
<module name="OneTopLevelClass"/>

View File

@ -217,11 +217,12 @@ public class SuppressWarningsHolder
final List<Entry> entries = ENTRIES.get();
if (entries != null) {
for (String value : values) {
String checkName = value;
// strip off the checkstyle-only prefix if present
if (value.startsWith(CHECKSTYLE_PREFIX)) {
value = value.substring(CHECKSTYLE_PREFIX.length());
checkName = checkName.substring(CHECKSTYLE_PREFIX.length());
}
entries.add(new Entry(value, firstLine, firstColumn,
entries.add(new Entry(checkName, firstLine, firstColumn,
lastLine, lastColumn));
}
}

View File

@ -208,7 +208,7 @@ public final class MissingDeprecatedCheck extends Check {
boolean found = false;
for (int reindex = i + 1;
reindex < lines.length; reindex++) {
reindex < lines.length;) {
final Matcher multilineCont = MATCH_DEPRECATED_MULTILINE_CONT.matcher(lines[reindex]);
if (multilineCont.find()) {
@ -231,6 +231,7 @@ public final class MissingDeprecatedCheck extends Check {
found = true;
}
}
reindex++;
}
return found;
}

View File

@ -294,7 +294,7 @@ public class JavadocStyleCheck
*/
private static int findTextStart(String line) {
int textStart = -1;
for (int i = 0; i < line.length(); i++) {
for (int i = 0; i < line.length();) {
if (!Character.isWhitespace(line.charAt(i))) {
if (line.regionMatches(i, "/**", 0, "/**".length())) {
i += 2;
@ -307,6 +307,7 @@ public class JavadocStyleCheck
break;
}
}
i++;
}
return textStart;
}