@Nullable public static HighlightInfo checkAnnotationDeclaration( final PsiElement parent, final PsiReferenceList list) { if (PsiUtil.isAnnotationMethod(parent)) { PsiAnnotationMethod method = (PsiAnnotationMethod) parent; if (list == method.getThrowsList()) { String description = JavaErrorMessages.message("annotation.members.may.not.have.throws.list"); return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR) .range(list) .descriptionAndTooltip(description) .create(); } } else if (parent instanceof PsiClass && ((PsiClass) parent).isAnnotationType()) { if (PsiKeyword.EXTENDS.equals(list.getFirstChild().getText())) { String description = JavaErrorMessages.message("annotation.may.not.have.extends.list"); return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR) .range(list) .descriptionAndTooltip(description) .create(); } } return null; }