Evaluator[] (PsiStatement[] statements) { List<Evaluator> evaluators = new ArrayList<>(); for (PsiStatement psiStatement : statements) { psiStatement.accept(this); if (myResult != null) { // for example declaration w/o initializer produces empty evaluator now evaluators.add(DisableGC.create(myResult)); } myResult = null; } return evaluators.toArray(new Evaluator[0]); }