aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRawi01 <Rawi01@users.noreply.github.com>2023-02-19 11:30:09 +0100
committerRoel Spilker <r.spilker@gmail.com>2023-03-21 16:12:22 +0100
commit148680cb495464838299988828117afb7e4452a9 (patch)
tree86d5a68587fdf7d1cbbf56a2c4c4cd6b0c0bb288
parentd96bf4cc364def4f949c00020297c1c6472c1446 (diff)
downloadlombok-148680cb495464838299988828117afb7e4452a9.tar.gz
lombok-148680cb495464838299988828117afb7e4452a9.tar.bz2
lombok-148680cb495464838299988828117afb7e4452a9.zip
[jdk20] Reorder JavacAST child nodes for JCEnhancedForLoop
-rw-r--r--src/core/lombok/javac/JavacAST.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/core/lombok/javac/JavacAST.java b/src/core/lombok/javac/JavacAST.java
index 0e8d03d5..c09120c1 100644
--- a/src/core/lombok/javac/JavacAST.java
+++ b/src/core/lombok/javac/JavacAST.java
@@ -516,11 +516,12 @@ public class JavacAST extends AST<JavacAST, JavacNode, JCTree> {
private JavacNode buildEnhancedForLoop(JCEnhancedForLoop loop) {
if (setAndGetAsHandled(loop)) return null;
-
+
List<JavacNode> childNodes = new ArrayList<JavacNode>();
+ // The order of the child elements is important and must be kept
+ addIfNotNull(childNodes, buildTree(getVarOrRecordPattern(loop), Kind.STATEMENT));
addIfNotNull(childNodes, buildTree(loop.expr, Kind.STATEMENT));
addIfNotNull(childNodes, buildStatement(loop.body));
- addIfNotNull(childNodes, buildTree(getVarOrRecordPattern(loop), Kind.STATEMENT));
return putInMap(new JavacNode(this, loop, childNodes, Kind.STATEMENT));
}