I agree, but long lines are inevitable. There are plenty of examples of this 
already. Pulling the text block out of line and putting in a separate statement 
or as a static final is a good middle ground versus externalizing.

What will make these scenarios more palatable would be the introduction of a 
line continuation mechanism.  This was discussed earlier on this this list re 
"\<line-terminator>" .

Cheers,

-- Jim


> On Aug 12, 2019, at 3:08 AM, Tagir Valeev <amae...@gmail.com> wrote:
> 
> > Guideline: It is sometimes reasonable to fully left justify a wide string 
> > in order to avoid horizontal scrolling or line wrapping.
> 
> If lines are too long and make reading the source file harder, I'd recommend 
> externalizing the string instead (putting into the resource file). If this is 
> hard to do, I would leave it as is. Horizontal scrolling is not a big 
> problem, but left indentation breaks the flow in the common case when you 
> actually don't need to read the text block content. Well "sometimes 
> reasonable" looks ok to me, but I would not agree with Alex that this should 
> be "recommended".
> 
> With best regards,
> Tagir Valeev.
> 
> On Mon, Aug 12, 2019 at 1:01 PM Tagir Valeev <amae...@gmail.com 
> <mailto:amae...@gmail.com>> wrote:
> Hello!
> 
> In general, looks good, thanks!
> 
> > Guideline: Avoid aligning the opening and closing delimiters and the text 
> > block's left margin. This requires reindentation of the text block if the 
> > variable name or modifiers are changed.
> 
> I'm not sure about this recommendation. Reindentation could be necessary in 
> other cases as well, e.g. if you move this declaration to the nested block. I 
> think every IDE will take care of any necessary reindentation for you. It's 
> similar to a method declaration that contains several parameters one per 
> line. E.g. (from OpenJDK Collectors class):
> 
> public static Collector<CharSequence, ?, String> joining(CharSequence 
> delimiter,
>                                                              CharSequence 
> prefix,
>                                                              CharSequence 
> suffix)
> 
> Here three parameters are indented in the same way: if method name, 
> modifiers, return type or type parameters ever change, this would require the 
> reindentation of second and third lines (and IDEs do this automatically). Is 
> such a code style acceptable for Java? If yes, then indenting opening and 
> closing delimiters of the text block should also be acceptable, in my opinion.
> 
> With best regards,
> Tagir Valeev.
> 
> On Mon, Aug 5, 2019 at 7:38 PM Jim Laskey <james.las...@oracle.com 
> <mailto:james.las...@oracle.com>> wrote:
> The enclosed PDF is the content of the proposed "Programmer's Guide To Text 
> Blocks".  Document source is located at
> 
> http://cr.openjdk.java.net/~jlaskey/Strings/TextBlocksGuide_v8.md 
> <http://cr.openjdk.java.net/~jlaskey/Strings/TextBlocksGuide_v8.md>
> 
> http://cr.openjdk.java.net/~jlaskey/Strings/TextBlocksGuide_v8.html 
> <http://cr.openjdk.java.net/~jlaskey/Strings/TextBlocksGuide_v8.html>
> 
> Please review and comment back to this mailing list.
> 
> Cheers,
> 
> -- Jim
> 

Reply via email to