<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div>Sorry to not answer sooner,<br></div><div>the reason to not allow anything after the first """ is that we may add modifiers after the """ in the future,<br data-mce-bogus="1"></div><div>by example, if we do not want the character '\' to be escaped, in the future you may able to write<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div> String text = """ no-escape<br data-mce-bogus="1"></div><div> some text with a \n<br data-mce-bogus="1"></div><div> """;<br data-mce-bogus="1"></div><div><br></div><div>regards,<br data-mce-bogus="1"></div><div>Rémi<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From: </b>"Vikram Bakshi" <vab2048@gmail.com><br><b>To: </b>"amber-dev" <amber-dev@openjdk.java.net><br><b>Sent: </b>Tuesday, November 22, 2022 11:42:07 AM<br><b>Subject: </b>Relaxing constraint for text blocks to start on new line?<br></blockquote></div><div data-marker="__QUOTED_TEXT__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div dir="ltr"><div>Hello,</div><br><div>Text blocks are a great feature of the Java language. On the JEP page one of the listed goals of text blocks is to:</div><span style="color:rgb(0,0,255)"><i></i></span><div><span style="color:rgb(0,0,255)"><i>
</i></span><li><br><span style="color:rgb(0,0,255)"><i></i></span><span style="color:rgb(0,0,255)"></span></li><li><span style="color:rgb(0,0,255)"><i>Enhance the readability of strings in Java programs that denote code written in non-Java languages.</i></span>
</li></div><br><div>Currently when attempting to use text blocks for short strings which can fit on one line for a non-Java language (e.g. JSON) we still need to start the string on another line.</div><br><div>For example:</div><br><div>```java</div><div>var json = """</div><div> { "color": "red", "value": "#f00" } """<br></div><div>```<br></div><br><div>It would be a lot nicer to have the ability to use the triple quote to define strings like this on one line:</div><br><div>
<div>```java</div><div>var json = """{ "color": "red", "value": "#f00" } """<br></div><div>```</div><br><div>Currently that is not possible and using a normal quote for strings, ", requires us to escape all of the subsequent quotes on the same line - which is a real pain.</div><br><div>Obviously we can just continue to start on the next line to avoid the issue - but is it possible to consider an extension to text blocks which allow for this use case (short one line strings)?</div><br><div>Regards,</div><div>Vikram<br></div>
</div></div><br></blockquote></div></div></body></html>