PsiElementVisitor (@NotNull ProblemsHolder holder, boolean isOnTheFly, @NotNull LocalInspectionToolSession session) { return new PsiElementVisitor() { @Override public void visitElement(@NotNull PsiElement element) { assertTrue("File has to be already annotated", annotated.get()); inspected.set(true); } }; }