PsiElementVisitor (@NotNull LocalInspectionTool tool, @NotNull ProblemsHolder holder, boolean isOnTheFly, @NotNull LocalInspectionToolSession session) { PsiElementVisitor visitor = tool.buildVisitor(holder, isOnTheFly, session); //noinspection ConstantConditions if (visitor == null) { LOG.error("Tool " + tool + " (" + tool.getClass() + ") must not return null from the buildVisitor() method"); } else if (visitor instanceof PsiRecursiveVisitor) { LOG.error("The visitor returned from LocalInspectionTool.buildVisitor() must not be recursive: " + tool); } return visitor; }