private boolean isIncluded(IJavaAnnotation annotation, boolean showTemporaryProblems) {

    // XXX: see https://bugs.eclipse.org/bugs/show_bug.cgi?id=138601
    if (annotation instanceof ProblemAnnotation
        && JavaMarkerAnnotation.TASK_ANNOTATION_TYPE.equals(annotation.getType())) return false;

    if (!annotation.isProblem()) return true;

    if (annotation.isMarkedDeleted() && !annotation.hasOverlay()) return true;

    if (annotation.hasOverlay() && !annotation.isMarkedDeleted()) return true;

    if (annotation.hasOverlay())
      return (!isIncluded(annotation.getOverlay(), showTemporaryProblems));

    return showTemporaryProblems && JavaCorrectionProcessor.hasCorrections((Annotation) annotation);
  }