String (PsiType type) { if (!needsAnnotations) { return ""; } final PsiAnnotation[] annotations = type.getAnnotations(); if (annotations.length <= 0) { return ""; } StringBuilder result = new StringBuilder(); for (PsiAnnotation annotation : annotations) { final PsiJavaCodeReferenceElement nameReferenceElement = annotation.getNameReferenceElement(); if (nameReferenceElement != null) { final PsiElement referenceNameElement = nameReferenceElement.getReferenceNameElement(); if (referenceNameElement != null) { result.append('@').append(referenceNameElement.getText()) .append(annotation.getParameterList().getText()) .append(' '); } } } return result.toString(); }