aboutsummaryrefslogtreecommitdiff
path: root/src/delombok
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2015-02-08 22:37:34 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2015-02-08 22:37:34 +0100
commit4b1c2d1583d172949a574c2342b1dc43380aa378 (patch)
tree1b788ff50e9ab86fd39a5f4fdcb5a6121bcb8360 /src/delombok
parent65de4693eb19a60e472b6e04aec0b9e083a648f4 (diff)
downloadlombok-4b1c2d1583d172949a574c2342b1dc43380aa378.tar.gz
lombok-4b1c2d1583d172949a574c2342b1dc43380aa378.tar.bz2
lombok-4b1c2d1583d172949a574c2342b1dc43380aa378.zip
improved the way lambdas are printed to conform better to style standards (no parens for 1 arg).
Diffstat (limited to 'src/delombok')
-rw-r--r--src/delombok/lombok/delombok/PrettyCommentsPrinter.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/delombok/lombok/delombok/PrettyCommentsPrinter.java b/src/delombok/lombok/delombok/PrettyCommentsPrinter.java
index 72a8ff59..e9115dd0 100644
--- a/src/delombok/lombok/delombok/PrettyCommentsPrinter.java
+++ b/src/delombok/lombok/delombok/PrettyCommentsPrinter.java
@@ -1629,6 +1629,8 @@ public class PrettyCommentsPrinter extends JCTree.Visitor {
@SuppressWarnings("unchecked")
List<JCVariableDecl> params = (List<JCVariableDecl>) readTreeList(tree, "params");
boolean explicit = true;
+ int paramLength = params.size();
+ if (paramLength != 1) print("(");
try {
explicit = readObject(tree, "paramKind").toString().equals("EXPLICIT");
} catch (Exception e) {}
@@ -1642,7 +1644,8 @@ public class PrettyCommentsPrinter extends JCTree.Visitor {
sep = ", ";
}
}
- print(") -> ");
+ if (paramLength != 1) print(")");
+ print(" -> ");
printExpr(readTree(tree, "body"));
} catch (IOException e) {
throw new UncheckedIOException(e);