boolean (@NotNull PsiElement place, @Nullable PsiClass contextClass) { if (contextClass != null) { PsiAnnotation annotation = PsiTreeUtil.getContextOfType(place, PsiAnnotation.class, true); if (annotation != null && PsiTreeUtil.isAncestor(contextClass.getModifierList(), annotation, false)) { return true; } } return false; }