CommentInfo (@Nullable PsiElement psiElement) { if (psiElement instanceof PsiDocComment) { PsiDocComment docComment = (PsiDocComment)psiElement; PsiJavaDocumentedElement owner = docComment.getOwner(); if (owner != null) { return getCommentInfo(docComment, owner); } PsiElement parent = docComment.getParent(); if (parent instanceof PsiJavaFile) { return getCommentInfo(docComment, parent); } } else if (psiElement instanceof PsiJavaDocumentedElement) { PsiJavaDocumentedElement owner = (PsiJavaDocumentedElement)psiElement; PsiDocComment docComment = owner.getDocComment(); if (docComment != null) { return getCommentInfo(docComment, owner); } } return null; }