From ba2cde332acedebb0905fb8c42bc516b07400917 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Sun, 22 Nov 2015 23:32:15 +0100 Subject: [Fixes #972] 1-arg lambdas with explicit typing on the argument did not pretty print correctly. --- src/delombok/lombok/delombok/PrettyPrinter.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/delombok/lombok') diff --git a/src/delombok/lombok/delombok/PrettyPrinter.java b/src/delombok/lombok/delombok/PrettyPrinter.java index d3b65cb8..38af8b16 100644 --- a/src/delombok/lombok/delombok/PrettyPrinter.java +++ b/src/delombok/lombok/delombok/PrettyPrinter.java @@ -1438,10 +1438,11 @@ public class PrettyPrinter extends JCTree.Visitor { List params = readObject(tree, "params", List.nil()); boolean explicit = true; int paramLength = params.size(); - if (paramLength != 1) print("("); try { explicit = readObject(tree, "paramKind", new Object()).toString().equals("EXPLICIT"); } catch (Exception e) {} + boolean useParens = paramLength != 1 || explicit; + if (useParens) print("("); if (explicit) { boolean first = true; for (JCVariableDecl vd : params) { @@ -1457,7 +1458,7 @@ public class PrettyPrinter extends JCTree.Visitor { sep = ", "; } } - if (paramLength != 1) print(")"); + if (useParens) print(")"); print(" -> "); JCTree body = readObject(tree, "body", (JCTree) null); if (body instanceof JCBlock) { -- cgit