PsiElementVisitor (@NotNull ProblemsHolder holder, boolean isOnTheFly) { return new JavaElementVisitor() { @Override public void visitJavaFile(@NotNull PsiJavaFile file) { if (PsiPackage.PACKAGE_INFO_FILE.equals(file.getName())) { checkComment(PsiTreeUtil.getChildOfType(file, PsiDocComment.class), file, holder, isOnTheFly); } } @Override public void visitModule(@NotNull PsiJavaModule module) { checkComment(module.getDocComment(), module, holder, isOnTheFly); } @Override public void visitClass(@NotNull PsiClass aClass) { checkComment(aClass.getDocComment(), aClass, holder, isOnTheFly); } @Override public void visitField(@NotNull PsiField field) { checkComment(field.getDocComment(), field, holder, isOnTheFly); } @Override public void visitMethod(@NotNull PsiMethod method) { checkComment(method.getDocComment(), method, holder, isOnTheFly); } }; }