diff options
author | Rostislav Krasny <45571812+rosti-il@users.noreply.github.com> | 2020-08-18 04:03:23 +0300 |
---|---|---|
committer | Rostislav Krasny <45571812+rosti-il@users.noreply.github.com> | 2020-08-18 04:09:25 +0300 |
commit | 79c3d383fd7d46ec1c6c5cf83d8b05f2238529a2 (patch) | |
tree | 83dec678a33158c003dc53b2a2643156b1a70de3 /src/delombok/lombok | |
parent | 7dfbe4323c15cbd88983380b27a250d2a381d148 (diff) | |
download | lombok-79c3d383fd7d46ec1c6c5cf83d8b05f2238529a2.tar.gz lombok-79c3d383fd7d46ec1c6c5cf83d8b05f2238529a2.tar.bz2 lombok-79c3d383fd7d46ec1c6c5cf83d8b05f2238529a2.zip |
Fix tests under Windows, fix test.javac11 and test.javac14, fix issue #1745
The change of the TestConfiguration.java is based on the fact that
Git for Windows is configured with 'core.autocrlf=true' by default.
Diffstat (limited to 'src/delombok/lombok')
-rw-r--r-- | src/delombok/lombok/delombok/PrettyPrinter.java | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/src/delombok/lombok/delombok/PrettyPrinter.java b/src/delombok/lombok/delombok/PrettyPrinter.java index 208b215f..54fa4ebf 100644 --- a/src/delombok/lombok/delombok/PrettyPrinter.java +++ b/src/delombok/lombok/delombok/PrettyPrinter.java @@ -188,12 +188,6 @@ public class PrettyPrinter extends JCTree.Visitor { return getEndPosition(tree, compilationUnit); } - private static int lineEndPos(String s, int start) { - int pos = s.indexOf('\n', start); - if (pos < 0) pos = s.length(); - return pos; - } - private boolean needsAlign, needsNewLine, onNewLine = true, needsSpace, aligned; public static final class UncheckedIOException extends RuntimeException { @@ -434,23 +428,25 @@ public class PrettyPrinter extends JCTree.Visitor { private void printDocComment(JCTree tree) { String dc = getJavadocFor(tree); if (dc == null) return; + aPrintln("/**"); - int pos = 0; - int endpos = lineEndPos(dc, pos); boolean atStart = true; - while (pos < dc.length()) { - String line = dc.substring(pos, endpos); - if (line.trim().isEmpty() && atStart) { + + for (String line : dc.split("\\r?\\n")) { + if (atStart && line.trim().isEmpty()) { atStart = false; continue; } + atStart = false; aPrint(" *"); - if (pos < dc.length() && dc.charAt(pos) > ' ') print(" "); - println(dc.substring(pos, endpos)); - pos = endpos + 1; - endpos = lineEndPos(dc, pos); + if (!line.isEmpty() && !Character.isWhitespace(line.charAt(0))) { + print(" "); + } + + println(line); } + aPrintln(" */"); } |