PsiAnnotation (@Nullable PsiModifierListOwner owner) { if (owner == null) return null; PsiAnnotation annotation = getAnnotation(owner); if (annotation != null) return annotation; if (owner instanceof PsiMember member && !owner.hasModifier(JvmModifier.STATIC)) { PsiAnnotation result = getPreviewFeatureAnnotation(member.getContainingClass()); if (result != null) return result; } PsiPackage psiPackage = JavaResolveUtil.getContainingPackage(owner); if (psiPackage == null) return null; PsiAnnotation packageAnnotation = getAnnotation(psiPackage); if (packageAnnotation != null) return packageAnnotation; PsiJavaModule module = JavaModuleGraphUtil.findDescriptorByElement(owner); if (module == null) return null; return getAnnotation(module); }