PsiElementVisitor (@NotNull final ProblemsHolder holder, final boolean isOnTheFly) { return UastHintedVisitorAdapter.create(holder.getFile().getLanguage(), new AbstractUastNonRecursiveVisitor() { @Override public boolean visitClass(@NotNull UClass node) { addDescriptors(checkClass(node, holder.getManager(), isOnTheFly)); return true; } @Override public boolean visitMethod(@NotNull UMethod node) { addDescriptors(checkMethod(node, holder.getManager(), isOnTheFly)); return true; } @Override public boolean visitField(@NotNull UField node) { addDescriptors(checkField(node, holder.getManager(), isOnTheFly)); return true; } @Override public boolean visitFile(@NotNull UFile node) { addDescriptors(checkFile(node.getPsi(), holder.getManager(), isOnTheFly)); return true; } private void addDescriptors(final ProblemDescriptor[] descriptors) { if (descriptors != null) { for (ProblemDescriptor descriptor : descriptors) { holder.registerProblem(descriptor); } } } }, myUElementsTypesHint); }