boolean (PsiElement qualifier, PsiClass containingClass) { if (qualifier instanceof PsiReferenceExpression reference && reference.resolve() instanceof PsiClass && reference.getQualifier() == null && PsiTreeUtil.isContextAncestor(containingClass, qualifier, false)) { return true; } return qualifier instanceof PsiThisExpression thisExpression && thisExpression.getQualifier() == null; }