void () { final PsiElementFactory factory = getFactory(); final PsiMethod method = factory.createMethodFromText( """ /** * Javadoc */ void m();""", null); final PsiDocComment docComment = method.getDocComment(); assertNotNull(docComment); final PsiDocTag tag2 = factory.createParamTag("p2", ""); docComment.add(tag2); assertEquals( """ /** * Javadoc * @param p2 */""", docComment.getText()); }