String (boolean annotated) { PsiJavaCodeReferenceElement ref = getReference(); if (!annotated) return PsiNameHelper.getPresentableText(ref); PsiAnnotation[] annotations; PsiElement qualifier = ref.getQualifier(); String qualifierInfo = ""; if (qualifier != null) { PsiAnnotation[] qualifierAnnotations = getAnnotations(false); if (qualifierAnnotations.length > 0 && qualifier instanceof PsiJavaCodeReferenceElement && ((PsiJavaCodeReferenceElement)qualifier).resolve() instanceof PsiClass) { // Display qualifier if it's annotated qualifierInfo = PsiNameHelper.getPresentableText(qualifier.getText(), qualifierAnnotations, ((PsiJavaCodeReferenceElement)qualifier).getTypeParameters()) + "."; } // like java.lang.@Anno String annotations = notNull(PsiTreeUtil.getChildrenOfType(ref, PsiAnnotation.class), PsiAnnotation.EMPTY_ARRAY); } else { annotations = getAnnotations(false); } return qualifierInfo + PsiNameHelper.getPresentableText(ref.getReferenceName(), annotations, ref.getTypeParameters()); }