@Nullable
  private ProblemDescriptor[] checkMember(
      final PsiDocCommentOwner docCommentOwner,
      final InspectionManager manager,
      final boolean isOnTheFly) {
    final ArrayList<ProblemDescriptor> problems = new ArrayList<ProblemDescriptor>();
    final PsiDocComment docComment = docCommentOwner.getDocComment();
    if (docComment == null) return null;

    final Set<PsiJavaCodeReferenceElement> references = new HashSet<PsiJavaCodeReferenceElement>();
    docComment.accept(getVisitor(references, docCommentOwner, problems, manager, isOnTheFly));
    for (PsiJavaCodeReferenceElement reference : references) {
      final List<PsiClass> classesToImport = new ImportClassFix(reference).getClassesToImport();
      final PsiElement referenceNameElement = reference.getReferenceNameElement();
      problems.add(
          manager.createProblemDescriptor(
              referenceNameElement != null ? referenceNameElement : reference,
              cannotResolveSymbolMessage("<code>" + reference.getText() + "</code>"),
              !isOnTheFly || classesToImport.isEmpty() ? null : new AddImportFix(classesToImport),
              ProblemHighlightType.LIKE_UNKNOWN_SYMBOL,
              isOnTheFly));
    }

    return problems.isEmpty() ? null : problems.toArray(new ProblemDescriptor[problems.size()]);
  }
 private void replaceDocComment(
     @Nullable String newCommentText, @NotNull final PsiDocCommentOwner psiDocCommentOwner) {
   final PsiDocComment oldComment = psiDocCommentOwner.getDocComment();
   if (newCommentText != null) newCommentText = stripSpaces(newCommentText);
   if (newCommentText == null
       || oldComment == null
       || newCommentText.equals(oldComment.getText())) {
     return;
   }
   try {
     PsiComment newComment =
         JavaPsiFacade.getInstance(myProject)
             .getElementFactory()
             .createCommentFromText(newCommentText, null);
     final ASTNode oldNode = oldComment.getNode();
     final ASTNode newNode = newComment.getNode();
     assert oldNode != null && newNode != null;
     final ASTNode parent = oldNode.getTreeParent();
     parent.replaceChild(
         oldNode,
         newNode); // important to replace with tree operation to avoid resolve and repository
     // update
   } catch (IncorrectOperationException e) {
     LOG.error(e);
   }
 }
 private static PsiDocTag getTextJavaDoc(@NotNull final PsiDocCommentOwner element) {
   final PsiDocComment docComment = element.getDocComment();
   if (docComment != null) {
     return docComment.findTagByName("testng.test");
   }
   return null;
 }
  @Override
  public PsiDocCommentOwner getOwner() {
    final PsiElement parent = getParent();
    if (parent instanceof PsiDocCommentOwner) {
      final PsiDocCommentOwner owner = (PsiDocCommentOwner) parent;
      if (owner.getDocComment() == this) {
        return owner;
      }
    }

    return null;
  }
 @Override
 public void invoke(
     @NotNull final Project project, final Editor editor, @NotNull final PsiElement element)
     throws IncorrectOperationException {
   PsiDocCommentOwner container = getContainer(element);
   assert container != null;
   if (!CodeInsightUtilBase.preparePsiElementForWrite(container)) return;
   if (use15Suppressions(container)) {
     final PsiModifierList modifierList = container.getModifierList();
     if (modifierList != null) {
       addSuppressAnnotation(project, editor, container, container, getID(container));
     }
   } else {
     PsiDocComment docComment = container.getDocComment();
     PsiManager manager = PsiManager.getInstance(project);
     if (docComment == null) {
       String commentText =
           "/** @" + SuppressionUtil.SUPPRESS_INSPECTIONS_TAG_NAME + " " + getID(container) + "*/";
       docComment =
           JavaPsiFacade.getInstance(manager.getProject())
               .getElementFactory()
               .createDocCommentFromText(commentText);
       PsiElement firstChild = container.getFirstChild();
       container.addBefore(docComment, firstChild);
     } else {
       PsiDocTag noInspectionTag =
           docComment.findTagByName(SuppressionUtil.SUPPRESS_INSPECTIONS_TAG_NAME);
       if (noInspectionTag != null) {
         String tagText = noInspectionTag.getText() + ", " + getID(container);
         noInspectionTag.replace(
             JavaPsiFacade.getInstance(manager.getProject())
                 .getElementFactory()
                 .createDocTagFromText(tagText));
       } else {
         String tagText =
             "@" + SuppressionUtil.SUPPRESS_INSPECTIONS_TAG_NAME + " " + getID(container);
         docComment.add(
             JavaPsiFacade.getInstance(manager.getProject())
                 .getElementFactory()
                 .createDocTagFromText(tagText));
       }
     }
   }
   DaemonCodeAnalyzer.getInstance(project).restart();
 }
 public static boolean isDeprecatedByDocTag(@NotNull PsiDocCommentOwner owner) {
   PsiDocComment docComment = owner.getDocComment();
   return docComment != null && docComment.findTagByName("deprecated") != null;
 }