Make code in UnnecessaryUnicodeEscapeInspection shorter

The keyword "while" at the beginning of a line usually starts a while
loop instead of ending a do-while loop. To avoid further confusion,
replace the do-while loop with a typical while-loop.
This commit is contained in:
Roland Illig
2018-11-21 14:47:29 +01:00
committed by Bas Leijdekkers
parent 32378af5a5
commit d6bb3f8c80
@@ -131,14 +131,10 @@ public class UnnecessaryUnicodeEscapeInspection extends BaseInspection {
if (!isEscape) {
continue;
}
int nextChar = i;
do {
nextChar++;
if (nextChar >= length) {
break;
}
int nextChar = i + 1;
while (nextChar < length && text.charAt(nextChar) == 'u') {
nextChar++; // \\uuuu0061 is a legal Unicode escape
}
while (text.charAt(nextChar) == 'u'); // \\uuuu0061 is a legal unicode escape
if (nextChar == i + 1 || nextChar + 3 >= length) {
continue;
}