private static boolean checkDeprecated(@Nullable PsiMetaData metaData, Pattern pattern) {
    if (metaData == null) return false;
    if (metaData instanceof XmlDeprecationOwnerDescriptor) {
      return ((XmlDeprecationOwnerDescriptor)metaData).isDeprecated();
    }
    
    PsiElement declaration = metaData.getDeclaration();
    if (!(declaration instanceof XmlTag tag)) return false;
    XmlComment comment = XmlUtil.findPreviousComment(declaration);
    if (comment != null && pattern.matcher(comment.getCommentText().trim()).matches()) return true;
    return checkTag(ArrayUtil.getFirstElement(tag.findSubTags("annotation", tag.getNamespace())), pattern);
  }
private static boolean checkDeprecated(@Nullable PsiMetaData metaData, Pattern pattern)