Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/redundantEmbeddedExpression/afterAll.java
Tagir Valeev c3c0d7c172 [java-inspections] Report empty and trivial components of STR template (IDEA-323919)
GitOrigin-RevId: b7b184cc957846d3122d11e7266df44cb1c9102e
2023-09-06 18:13:55 +00:00

34 lines
1.2 KiB
Java

// "Fix all 'Redundant embedded expression in string template' problems in file" "true"
package java.lang;
import java.util.*;
public interface StringTemplate {
List<String> fragments();
List<Object> values();
native static StringTemplate of(String string);
Processor<String, RuntimeException> STR;
Processor<StringTemplate, RuntimeException> RAW;
interface Processor<R, E extends Throwable> {
R process(StringTemplate stringTemplate) throws E;
}
}
class Test {
public static void main(String[] args) {
System.out.println(STR."hello|null|world");
System.out.println(STR."hello|null|world");
System.out.println(STR."hello||world");
System.out.println(STR."hello|\r\n|world");
/*before*/
/*after*/
System.out.println(STR."hello|str|world \{1 + 1}");
System.out.println(STR."""
Hello!!! \{"""
World"""}""");
System.out.println(STR."hello|1|world \{1 + 1}");
System.out.println(STR."hello|1000|world \{1 + 1}");
System.out.println(STR."hello|\{1_000}|world \{1 + 1}");
System.out.println(STR."hello|1.0|world \{1 + 1}");
System.out.println(STR."hello|\{1.0d}|world \{1 + 1}");
}
}