boolean (PsiModifierList modifierList, PsiAnnotation annotation) { PsiElement parent = annotation.getParent(); if (parent instanceof PsiJavaCodeReferenceElement || parent instanceof PsiTypeElement) { return true; } PsiClass annotationClass = annotation.resolveAnnotationType(); if (annotationClass != null) { Set<PsiAnnotation.TargetType> targets = getAnnotationTargets(annotationClass); if (targets != null && targets.contains(PsiAnnotation.TargetType.TYPE_USE) && (targets.size() == 1 || NullableNotNullManager.isNullabilityAnnotation(annotation) || !ContainerUtil.exists(getTargetsForLocation(modifierList), target -> target != PsiAnnotation.TargetType.TYPE_USE && targets.contains(target)))) { return true; } } return false; }