Extract increment operations to separate expressions. #1538

While increment or decrement expressions nested inside other expressions are admirably terse, such expressions may be confusing, and violate the general design principle that a given construct should do precisely one thing.
This commit is contained in:
Michal Kordas 2015-08-02 15:34:39 +02:00 committed by Roman Ivanov
parent 85ba2a3dce
commit d49eaaf2e4
3 changed files with 6 additions and 3 deletions

View File

@ -252,7 +252,8 @@ public final class FileText extends AbstractList<String> {
int lineNo = 1;
final Matcher matcher = LINE_TERMINATOR.matcher(fullText);
while (matcher.find()) {
lineBreaks[lineNo++] = matcher.end();
lineBreaks[lineNo] = matcher.end();
lineNo++;
}
if (lineNo < lineBreaks.length) {
lineBreaks[lineNo] = fullText.length();

View File

@ -327,7 +327,8 @@ public class DescendantTokenCheck extends Check {
final int[] result = new int[tokenNames.size()];
int i = 0;
for (String name : tokenNames) {
result[i++] = Utils.getTokenId(name);
result[i] = Utils.getTokenId(name);
i++;
}
return result;
}

View File

@ -115,7 +115,8 @@ public class HandlerFactory {
final int[] types = new int[typeSet.size()];
int index = 0;
for (final Integer val : typeSet) {
types[index++] = val;
types[index] = val;
index++;
}
return types;