Skip to content

Commit

Permalink
Insight
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan202 committed Mar 23, 2024
1 parent 61120c7 commit 51cd85c
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ public static String treeToString(Tree tree, VisitorState state) {
* Constructs a multi-line string by joining the given source code lines, if they all represent
* compile-time constants.
*
* @implNote Lines are always joined with {@value #TEXT_BLOCK_LINE_SEPARATOR}, independent of the
* platform on which this method is executed. This ensures consistent line separation in case
* some of the lines are multi-line text blocks.
* @param sourceLines The source code lines of interest.
* @return A non-empty optional iff all source code lines represent compile-time constants.
*/
Expand All @@ -89,8 +92,7 @@ public static Optional<String> joinConstantSourceCodeLines(

for (ExpressionTree sourceLine : sourceLines) {
if (!source.isEmpty()) {
// XXX: Review whether we can/should use `System.lineSeparator()` here.
source.append('\n');
source.append(TEXT_BLOCK_DELIMITER);
}

String value = ASTHelpers.constValue(sourceLine, String.class);
Expand Down

0 comments on commit 51cd85c

Please sign in to comment.