diff --git a/java/java-psi-api/src/com/intellij/psi/util/PsiLiteralUtil.java b/java/java-psi-api/src/com/intellij/psi/util/PsiLiteralUtil.java index 303c79e9ccd6..dd1e0c0ae831 100644 --- a/java/java-psi-api/src/com/intellij/psi/util/PsiLiteralUtil.java +++ b/java/java-psi-api/src/com/intellij/psi/util/PsiLiteralUtil.java @@ -227,13 +227,11 @@ public class PsiLiteralUtil { private static int parseBackSlash(@NotNull String str, int idx) { char c = str.charAt(idx); if (c != '\\') return -1; - int nextIdx = parseHexBackSlash(str, idx); - if (nextIdx > 0) return nextIdx; - nextIdx = parseOctalBackSlash(str, idx); + int nextIdx = parseEscapedBackSlash(str, idx); return nextIdx > 0 ? nextIdx : idx + 1; } - private static int parseHexBackSlash(@NotNull String str, int idx) { + private static int parseEscapedBackSlash(@NotNull String str, int idx) { int next = idx + 1; if (next >= str.length() || str.charAt(next) != 'u') return -1; while (str.charAt(next) == 'u') { @@ -248,16 +246,4 @@ public class PsiLiteralUtil { } return -1; } - - private static int parseOctalBackSlash(@NotNull String str, int idx) { - int next = idx + 1; - if (next + 2 >= str.length()) return -1; - try { - int code = Integer.parseInt(str.substring(next, next + 3), 8); - if (code == '\\') return next + 3; - } - catch (NumberFormatException ignored) { - } - return -1; - } } \ No newline at end of file diff --git a/java/java-tests/testData/inspection/textBlockBackwardMigration/afterEscapeSequence.java b/java/java-tests/testData/inspection/textBlockBackwardMigration/afterEscapeSequence.java index 0bc2182875a2..44fda43a06c6 100644 --- a/java/java-tests/testData/inspection/textBlockBackwardMigration/afterEscapeSequence.java +++ b/java/java-tests/testData/inspection/textBlockBackwardMigration/afterEscapeSequence.java @@ -3,7 +3,7 @@ class TextBlockMigration { void escapeSequence() { - String oneLineTextBlock = "\"this is one \"line\"\n text block\\\"\n"; + String oneLineTextBlock = "\"this is one \"line\"\n text block\134\\\"\n"; } } \ No newline at end of file diff --git a/java/java-tests/testData/inspection/textBlockBackwardMigration/beforeEscapeSequence.java b/java/java-tests/testData/inspection/textBlockBackwardMigration/beforeEscapeSequence.java index fca419921461..18464ec16b60 100644 --- a/java/java-tests/testData/inspection/textBlockBackwardMigration/beforeEscapeSequence.java +++ b/java/java-tests/testData/inspection/textBlockBackwardMigration/beforeEscapeSequence.java @@ -4,7 +4,7 @@ class TextBlockMigration { void escapeSequence() { String oneLineTextBlock = """ - \u005c"this is one "line"\n text block\134\" + \u005c"this is one "line"\n text block\134\u005c\\" """; }