diff --git a/java/java-tests/testData/codeInspection/escapedSpace/afterWithUnicode.java b/java/java-tests/testData/codeInspection/escapedSpace/afterWithUnicode.java new file mode 100644 index 000000000000..22310378e7e8 --- /dev/null +++ b/java/java-tests/testData/codeInspection/escapedSpace/afterWithUnicode.java @@ -0,0 +1,8 @@ +// "Replace '\s' sequences with spaces" "true-preview" +class X { + void test(String str) { + if (str.matches("\uuu1234 +")) { + + } + } +} \ No newline at end of file diff --git a/java/java-tests/testData/codeInspection/escapedSpace/beforeWithUnicode.java b/java/java-tests/testData/codeInspection/escapedSpace/beforeWithUnicode.java new file mode 100644 index 000000000000..d7903a922b9e --- /dev/null +++ b/java/java-tests/testData/codeInspection/escapedSpace/beforeWithUnicode.java @@ -0,0 +1,8 @@ +// "Replace '\s' sequences with spaces" "true-preview" +class X { + void test(String str) { + if (str.matches("\uuu1234\s+")) { + + } + } +} \ No newline at end of file diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/EscapedSpaceInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/EscapedSpaceInspection.java index 1fed920a47e9..6820b3da991e 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/EscapedSpaceInspection.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/EscapedSpaceInspection.java @@ -42,8 +42,10 @@ public class EscapedSpaceInspection extends AbstractBaseJavaLocalInspectionTool if (pos == -1 || pos == text.length() - 1) break; char next = text.charAt(pos + 1); if (next == 'u') { - // unicode escape - pos += 6; + // unicode escape can contain several 'u', according to the spec + pos += 2; + while (pos < text.length() && text.charAt(pos) == 'u') pos++; + pos += 4; continue; } pos += 2;