improved the way lambdas are printed to conform better to style standards (no parens for 1 arg).

This commit is contained in:
Reinier Zwitserloot committed 2015-02-08 22:37:34 +01:00
1 parent 65de4693eb
commit 4b1c2d1583
1 file changed
+4 -1
@@ -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);