diff options
author | Roel Spilker <r.spilker@gmail.com> | 2016-07-19 13:40:32 +0200 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2016-07-19 13:40:32 +0200 |
commit | fa2ff14e65bea5d3042ffc01c811b00fa6efbd58 (patch) | |
tree | 83f4ed4c288db0d9957d2d4abb9308b43072d648 /src/delombok/lombok | |
parent | c0d563d039ca066543efc34d8a037d1a19c48a96 (diff) | |
download | lombok-fa2ff14e65bea5d3042ffc01c811b00fa6efbd58.tar.gz lombok-fa2ff14e65bea5d3042ffc01c811b00fa6efbd58.tar.bz2 lombok-fa2ff14e65bea5d3042ffc01c811b00fa6efbd58.zip |
Fix for issue #1076
Diffstat (limited to 'src/delombok/lombok')
-rw-r--r-- | src/delombok/lombok/delombok/PrettyPrinter.java | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/delombok/lombok/delombok/PrettyPrinter.java b/src/delombok/lombok/delombok/PrettyPrinter.java index 73d6ee90..d1b47c0d 100644 --- a/src/delombok/lombok/delombok/PrettyPrinter.java +++ b/src/delombok/lombok/delombok/PrettyPrinter.java @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2016 The Project Lombok Authors. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ package lombok.delombok; import static com.sun.tools.javac.code.Flags.*; @@ -1054,6 +1075,7 @@ public class PrettyPrinter extends JCTree.Visitor { @Override public void visitForLoop(JCForLoop tree) { aPrint("for ("); if (tree.init.nonEmpty()) { + // ForInit is either a list of StatementExpressionList or a LocalVariableDeclaration if (tree.init.head instanceof JCVariableDecl) { boolean first = true; int dims = 0; @@ -1075,7 +1097,12 @@ public class PrettyPrinter extends JCTree.Visitor { first = false; } } else { - print(tree.init, ", "); + boolean first = true; + for (JCStatement exprStatement : tree.init) { + if (!first) print(", "); + first = false; + print(((JCExpressionStatement) exprStatement).expr); + } } } print("; "); |