void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { final PsiElement parent = element.getParent(); final PsiElement grandParent = parent.getParent(); if (!(grandParent instanceof PsiMethod method)) { return; } final PsiDocComment comment = method.getDocComment(); final PsiElementFactory factory = JavaPsiFacade.getElementFactory(project); if (comment != null) { final PsiDocTag docTag = factory.createDocTagFromText("@throws " + element.getText()); comment.add(docTag); } else { final PsiDocComment docComment = factory.createDocCommentFromText("/** */"); final PsiComment resultComment = (PsiComment)method.addBefore(docComment, method.getModifierList()); final DocumentationProvider documentationProvider = LanguageDocumentation.INSTANCE.forLanguage(method.getLanguage()); final CodeDocumentationProvider codeDocumentationProvider; if (documentationProvider instanceof CodeDocumentationProvider) { codeDocumentationProvider = (CodeDocumentationProvider)documentationProvider; } else if (documentationProvider instanceof CompositeDocumentationProvider compositeDocumentationProvider) { codeDocumentationProvider = compositeDocumentationProvider.getFirstCodeDocumentationProvider(); if (codeDocumentationProvider == null) { return; } } else { return; } final String commentStub = codeDocumentationProvider.generateDocumentationContentStub(resultComment); final PsiDocComment newComment = factory.createDocCommentFromText("/**\n" + commentStub + "*/"); resultComment.replace(newComment); } element.delete(); }