void (@NotNull final PsiElement element) { PsiElementVisitor projectIterator = myProjectIterator; if (projectIterator == null) { myProjectIterator = projectIterator = new UastVisitorAdapter(new MyJavaElementVisitor(), true) { @Override public void visitElement(@NotNull PsiElement element) { super.visitElement(element); if (element instanceof PsiJavaModule) { visitJavaModule((PsiJavaModule)element); } } private void visitJavaModule(PsiJavaModule module) { RefElement refElement = myRefManager.getReference(module); if (refElement != null) { myRefManager.buildReferences(refElement); } } }; } element.accept(projectIterator); }