aboutsummaryrefslogtreecommitdiff
path: root/src/delombok
diff options
context:
space:
mode:
authorRawi01 <Rawi01@users.noreply.github.com>2020-08-31 09:38:14 +0200
committerRawi01 <Rawi01@users.noreply.github.com>2020-08-31 09:38:14 +0200
commit23b80658bcf3ca0007a86d04ce6cc5f6c8db5ad4 (patch)
tree5e159ce51df5436a7ab5aeb18c0edb0605a1c2f1 /src/delombok
parent2b4b5c983540af4a4c08cfb7a3d4057df0b84c39 (diff)
parent9148294f78a8e646ee131ca182a9b692bc028fdb (diff)
downloadlombok-23b80658bcf3ca0007a86d04ce6cc5f6c8db5ad4.tar.gz
lombok-23b80658bcf3ca0007a86d04ce6cc5f6c8db5ad4.tar.bz2
lombok-23b80658bcf3ca0007a86d04ce6cc5f6c8db5ad4.zip
Merge branch 'master' into eclipse-javadoc
Conflicts: src/core/lombok/javac/handlers/JavacHandlerUtil.java test/core/src/lombok/RunTestsViaEcj.java
Diffstat (limited to 'src/delombok')
-rw-r--r--src/delombok/lombok/delombok/PrettyPrinter.java26
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(" */");
}