aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2015-10-31 16:05:33 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2015-11-16 22:18:29 +0100
commitdc5e1b9b35e853e6b503efac367999e02569108e (patch)
treeeed32aac8267d074338da92cd05261fe1e7cc31a
parent3f0a13501f19b966d3cbc0476a833783e6c6117a (diff)
downloadlombok-dc5e1b9b35e853e6b503efac367999e02569108e.tar.gz
lombok-dc5e1b9b35e853e6b503efac367999e02569108e.tar.bz2
lombok-dc5e1b9b35e853e6b503efac367999e02569108e.zip
bugfix for comments near start of nodes (it would throw off alignment in pretty printer).
-rw-r--r--src/delombok/lombok/delombok/PrettyPrinter.java2
-rw-r--r--test/transform/resource/before/ValLambda.java4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/delombok/lombok/delombok/PrettyPrinter.java b/src/delombok/lombok/delombok/PrettyPrinter.java
index 0b248c52..52cb1e42 100644
--- a/src/delombok/lombok/delombok/PrettyPrinter.java
+++ b/src/delombok/lombok/delombok/PrettyPrinter.java
@@ -372,6 +372,8 @@ public class PrettyPrinter extends JCTree.Visitor {
break;
}
+ if (onNewLine && !aligned && comment.start != StartConnection.START_OF_LINE) needsAlign = true;
+
print(comment.content);
switch (comment.end) {
diff --git a/test/transform/resource/before/ValLambda.java b/test/transform/resource/before/ValLambda.java
index ed843ed7..51c4fba1 100644
--- a/test/transform/resource/before/ValLambda.java
+++ b/test/transform/resource/before/ValLambda.java
@@ -14,7 +14,7 @@ class ValLambda {
}
// public void castLubLambda() {
-// Runnable foo = (Runnable)((System.currentTimeMillis() > 0) ? ()-> {} : System.out::println);
-// lombok.val foo = (Runnable)((System.currentTimeMillis() > 0) ? ()-> {} : System.out::println);
+// Runnable foo = (Runnable) ((System.currentTimeMillis() > 0) ? () -> {} : System.out::println);
+// lombok.val foo = (Runnable) ((System.currentTimeMillis() > 0) ? () -> {} : System.out::println);
// }
}