[jOOQ/jOOQ#14141] Generated text blocks for view sources should escape backslashes

This commit is contained in:
Lukas Eder 2022-10-27 09:34:55 +02:00
parent 5bed0b0e88
commit 157f822e7b

View File

@ -7272,11 +7272,18 @@ public class JavaGenerator extends AbstractGenerator {
}
// [#9817] Generate text blocks only if there are newlines or quotes
else if (generateTextBlocks0() && (string.contains("\n") || string.contains("\r") || string.contains("\""))) {
else if (generateTextBlocks0() && (
string.contains("\\")
|| string.contains("\n")
|| string.contains("\r")
|| string.contains("\"")
)) {
// TODO [#3450] Escape sequences?
// TODO [#10007] [#10318] Long textblocks?
// TODO [#10869] String interpolation in kotlin?
String result = string.replace("\"\"\"", "\\\"\\\"\\\"");
String result = string
.replace("\\", "\\\\")
.replace("\"\"\"", "\\\"\\\"\\\"");
// Only Java has incidental whitespace support (?)