PsiModifierListOwner ( PsiReferenceExpression expression) { final PsiExpression qualifierExpression = expression.getQualifierExpression(); if (qualifierExpression instanceof PsiReferenceExpression referenceExpression) { final PsiElement element = referenceExpression.resolve(); if (element instanceof PsiModifierListOwner && !(element instanceof PsiClass)) { return (PsiModifierListOwner)element; } } return null; }