String (PsiReferenceExpression expression, String... classNames) { final PsiElement target = expression.resolve(); if (!(target instanceof PsiField field)) { return null; } final PsiClass containingClass = field.getContainingClass(); for (String className : classNames) { if (InheritanceUtil.isInheritor(containingClass, className)) { return className; } } return null; }