boolean (ASTNode element) { PsiJavaCodeReferenceElement ref = (PsiJavaCodeReferenceElement)element.getPsi(); PsiElement qualifier = ref.getQualifier(); if (qualifier instanceof PsiJavaCodeReferenceElement) { if (((PsiJavaCodeReferenceElement)qualifier).resolve() instanceof PsiPackage) { return false; } if (PsiTreeUtil.getChildOfType(qualifier, PsiAnnotation.class) != null) { return true; } } PsiModifierList modifierList = PsiImplUtil.findNeighbourModifierList(ref); if (modifierList != null) { for (PsiAnnotation annotation : modifierList.getAnnotations()) { if (AnnotationTargetUtil.findAnnotationTarget(annotation, PsiAnnotation.TargetType.TYPE_USE) != null) { return true; } } } return false; }