From 586af27800309b600cf5d505a469bab66375b30d Mon Sep 17 00:00:00 2001 From: Rawi01 Date: Thu, 9 Jul 2020 17:49:47 +0200 Subject: Replace JavacAst list with single object iteration to save some memory --- src/core/lombok/javac/JavacTransformer.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/core/lombok/javac/JavacTransformer.java b/src/core/lombok/javac/JavacTransformer.java index 625fb283..b3e7f63b 100644 --- a/src/core/lombok/javac/JavacTransformer.java +++ b/src/core/lombok/javac/JavacTransformer.java @@ -21,7 +21,6 @@ */ package lombok.javac; -import java.util.ArrayList; import java.util.SortedSet; import javax.annotation.processing.Messager; @@ -68,20 +67,14 @@ public class JavacTransformer { } } - java.util.List asts = new ArrayList(); - for (JCCompilationUnit unit : compilationUnits) { if (!Boolean.TRUE.equals(LombokConfiguration.read(ConfigurationKeys.LOMBOK_DISABLE, JavacAST.getAbsoluteFileLocation(unit)))) { - asts.add(new JavacAST(messager, context, unit, cleanup)); + JavacAST ast = new JavacAST(messager, context, unit, cleanup); + ast.traverse(new AnnotationVisitor(priority)); + handlers.callASTVisitors(ast, priority); + if (ast.isChanged()) LombokOptions.markChanged(context, (JCCompilationUnit) ast.top().get()); } } - - for (JavacAST ast : asts) { - ast.traverse(new AnnotationVisitor(priority)); - handlers.callASTVisitors(ast, priority); - } - - for (JavacAST ast : asts) if (ast.isChanged()) LombokOptions.markChanged(context, (JCCompilationUnit) ast.top().get()); } private class AnnotationVisitor extends JavacASTAdapter { -- cgit