From 025a76aa66517c45a033407838750fdb43b3a870 Mon Sep 17 00:00:00 2001 From: Rawi01 Date: Mon, 22 Nov 2021 21:43:12 +0100 Subject: [fixes #3040] Support array initializer in onX --- src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java | 10 ++++++---- src/core/lombok/javac/handlers/JavacHandlerUtil.java | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src/core') diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java index f8cde6c8..50349059 100644 --- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java +++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java @@ -447,16 +447,18 @@ public class EclipseHandlerUtil { // arrays if (in instanceof ArrayInitializer) { - Expression[] exprs = ((ArrayInitializer) in).expressions; - Expression[] copy = new Expression[exprs.length]; - for (int i = 0; i < exprs.length; i++) copy[i] = copyAnnotationMemberValue(exprs[i]); ArrayInitializer out = new ArrayInitializer(); out.sourceStart = s; out.sourceEnd = e; out.bits = in.bits; out.implicitConversion = in.implicitConversion; out.statementEnd = e; - out.expressions = copy; + Expression[] exprs = ((ArrayInitializer) in).expressions; + if (exprs != null) { + Expression[] copy = new Expression[exprs.length]; + for (int i = 0; i < exprs.length; i++) copy[i] = copyAnnotationMemberValue(exprs[i]); + out.expressions = copy; + } return out; } diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java index a41264e8..132bbff8 100644 --- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java +++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java @@ -1820,6 +1820,7 @@ public class JavacHandlerUtil { private static void clearTypes(JCTree tree) { tree.accept(new TreeScanner() { @Override public void scan(JCTree tree) { + if (tree == null) return; tree.type = null; super.scan(tree); } -- cgit