PsiDocComment () { PsiFieldStub stub = getGreenStub(); if (stub != null && !stub.hasDocComment()) return null; CompositeElement treeElement = getNode(); if (getTypeElement() != null) { PsiElement element = treeElement.findChildByRoleAsPsiElement(ChildRole.DOC_COMMENT); return element instanceof PsiDocComment ? (PsiDocComment)element : null; } else { ASTNode prevField = treeElement.getTreePrev(); while (prevField != null && prevField.getElementType() != JavaElementType.FIELD){ prevField = prevField.getTreePrev(); } if (prevField == null) return null; return ((PsiField)SourceTreeToPsiMap.treeElementToPsi(prevField)).getDocComment(); } }