diff --git a/error-prone-utils/src/main/java/tech/picnic/errorprone/utils/SourceCode.java b/error-prone-utils/src/main/java/tech/picnic/errorprone/utils/SourceCode.java index b9dc4e2958a..301a65dfbb2 100644 --- a/error-prone-utils/src/main/java/tech/picnic/errorprone/utils/SourceCode.java +++ b/error-prone-utils/src/main/java/tech/picnic/errorprone/utils/SourceCode.java @@ -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. */ @@ -89,8 +92,7 @@ public static Optional 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);