avoid unnecessary unicode escape warnings

GitOrigin-RevId: fc6a3de26e047c646fa068a220356a9ebd20150c
This commit is contained in:
Bas Leijdekkers
2022-09-30 18:05:14 +02:00
committed by intellij-monorepo-bot
parent fe31ff2e97
commit 80e45ca73f
4 changed files with 5 additions and 5 deletions

View File

@@ -32,7 +32,7 @@ public interface RegExpChar extends RegExpAtom, RegExpClassElement {
/** An octal encoded character value, e.g.: \0141 */
OCT,
/** A unicode escape character, e.g.: \u0061 */
/** A unicode escape character, e.g.: \uFFFD */
UNICODE,
/** A named character, e.g.: \N{LATIN SMALL LETTER A} */

View File

@@ -539,7 +539,7 @@ public final class PsiLiteralUtil {
}
private static int parseUnicodeEscapeBackwards(@NotNull String s, int index, @NotNull Predicate<? super Character> charPredicate) {
// \u1234 needs at least 6 positions
// \uFFFD needs at least 6 positions
if (index - 5 < 0) return -1;
int start = findSlashU(s, index - 4);
@@ -617,7 +617,7 @@ public final class PsiLiteralUtil {
if (i >= line.length()) return -1;
char c = line.charAt(i++);
if (c == '\\') {
// like \u0020
// like \uFFFD
char c1 = line.charAt(i++);
if (c1 == 'u') {
while (i < line.length() && line.charAt(i) == 'u') i++;

View File

@@ -136,7 +136,7 @@ public class UnnecessaryUnicodeEscapeInspection extends BaseInspection {
}
int nextChar = i + 1;
while (nextChar < length && text.charAt(nextChar) == 'u') {
nextChar++; // \\uuuu0061 is a legal Unicode escape
nextChar++; // \uuuuFFFD is a legal Unicode escape
}
if (nextChar == i + 1 || nextChar + 3 >= length) {
continue;

View File

@@ -130,7 +130,7 @@ public class UnicodeUnescapeIntention extends Intention {
break;
}
}
while (text.charAt(nextChar) == 'u'); // \uuuu0061 is a legal unicode escape
while (text.charAt(nextChar) == 'u'); // \uuuuFFFD is a legal unicode escape
if (nextChar == i + 1 || nextChar + 3 >= length) {
break;
}