diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2015-11-22 23:32:15 +0100 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2015-11-22 23:32:15 +0100 |
commit | ba2cde332acedebb0905fb8c42bc516b07400917 (patch) | |
tree | 8e53136b1ff2b29970ad8ce6d63d0cf53f873c82 /src/delombok/lombok | |
parent | e05feead3fdd912fbc9f034f922d4d28df2104e7 (diff) | |
download | lombok-ba2cde332acedebb0905fb8c42bc516b07400917.tar.gz lombok-ba2cde332acedebb0905fb8c42bc516b07400917.tar.bz2 lombok-ba2cde332acedebb0905fb8c42bc516b07400917.zip |
[Fixes #972] 1-arg lambdas with explicit typing on the argument did not pretty print correctly.
Diffstat (limited to 'src/delombok/lombok')
-rw-r--r-- | src/delombok/lombok/delombok/PrettyPrinter.java | 5 |
1 files changed, 3 insertions, 2 deletions
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<JCVariableDecl> params = readObject(tree, "params", List.<JCVariableDecl>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) { |