From 148680cb495464838299988828117afb7e4452a9 Mon Sep 17 00:00:00 2001 From: Rawi01 Date: Sun, 19 Feb 2023 11:30:09 +0100 Subject: [jdk20] Reorder JavacAST child nodes for JCEnhancedForLoop --- src/core/lombok/javac/JavacAST.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/core/lombok/javac') 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 { private JavacNode buildEnhancedForLoop(JCEnhancedForLoop loop) { if (setAndGetAsHandled(loop)) return null; - + List childNodes = new ArrayList(); + // 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)); } -- cgit