aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2015-11-22 23:32:15 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2015-11-22 23:32:15 +0100
commitba2cde332acedebb0905fb8c42bc516b07400917 (patch)
tree8e53136b1ff2b29970ad8ce6d63d0cf53f873c82 /src
parente05feead3fdd912fbc9f034f922d4d28df2104e7 (diff)
downloadlombok-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')
-rw-r--r--src/delombok/lombok/delombok/PrettyPrinter.java5
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) {