PsiElementVisitor (@NotNull ProblemsHolder holder, boolean isOnTheFly, @NotNull LocalInspectionToolSession session) { BaseInspectionVisitor visitor = buildVisitor(); visitor.initialize(this, holder, isOnTheFly); return new GroovyPsiElementVisitor(visitor) { @Override public void visitElement(@NotNull PsiElement element) { if (GrInspectionUIUtil.checkInspectionEnabledByFileType(BaseInspection.this, element, explicitlyEnabledFileTypes)) { super.visitElement(element); } } }; }