void (@NotNull PsiElement element) { // read in all children in advance since due to element replacement involving its siblings invalidation PsiElement[] children = element.getChildren(); for (PsiElement child : children) { child.accept(this); } }