Inspectopedia Help

Text block can be replaced with regular string literal

Reports text blocks that can be replaced with regular string literals.

Example:

Object obj = engine.eval(""" function hello() { print('"Hello, world"'); } hello(); """);

After the quick fix is applied:

Object obj = engine.eval("function hello() {\n" + " print('\"Hello, world\"');\n" + "}\n" + "\n" + "hello();\n");

Text block appeared in Java 15. This inspection can help to downgrade for backward compatibility with earlier Java versions.

New in 2019.3

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023