mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Java: warn on string template single line trailing whitespace (IDEA-331315)
GitOrigin-RevId: c3c1d5ef02d3086a2c8dbf29a9fea5b1d31d18d4
This commit is contained in:
committed by
intellij-monorepo-bot
parent
5ba9a83c24
commit
ac330832ba
-1
@@ -47,7 +47,6 @@ public final class TrailingWhitespacesInTextBlockInspection extends AbstractBase
|
||||
private boolean checkTextBlock(@NotNull PsiElement textBlock, @NotNull String suffix) {
|
||||
String text = textBlock.getText();
|
||||
String[] lines = text.split("\n", -1);
|
||||
if (lines.length < 2) return false;
|
||||
int indent = getIndent(textBlock);
|
||||
if (indent == -1) return false;
|
||||
int offset = 0;
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class StringTemplateOneLine {
|
||||
|
||||
public void foo(String type) {
|
||||
String s = STR."""
|
||||
Hello \{type}""";
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
class StringTemplateOneLine {
|
||||
|
||||
public void foo(String type) {
|
||||
String s = STR."""
|
||||
Hello \{type}<warning descr="Trailing whitespace characters inside text block"><caret> </warning>""";
|
||||
}
|
||||
}
|
||||
+1
@@ -22,6 +22,7 @@ public class TrailingWhitespacesInTextBlockInspectionTest extends LightJavaInspe
|
||||
public void testStringTemplate4Java21Preview() { doTestEscape(); }
|
||||
public void testStringTemplate5() { doTest(); }
|
||||
public void testStringTemplate6() { doTestAll(); }
|
||||
public void testStringTemplateOneLine() { doTestAll(); }
|
||||
public void testTrailingSpaces() { doTestAll(); }
|
||||
public void testTrailingTabs() { doTestEscape(); }
|
||||
public void testWithBlankLines() { doTestAll(); }
|
||||
|
||||
Reference in New Issue
Block a user