code: public static boolean hasNamedAnnotation(AnnotatedConstruct ac, String name) {
      for (AnnotationMirror annotation : ac.getAnnotationMirrors()) {
        if (getName(annotation.getAnnotationType().asElement()).equals(name)) {
          return true;
        }
      }
      return false;
    }
docs: Less strict version of the above where we don't care about the annotation's package.