void (@NotNull PsiJavaCodeReferenceElement reference) { super.visitReferenceElement(reference); final PsiElement qualifier = reference.getQualifier(); if (!(qualifier instanceof PsiJavaCodeReferenceElement qualifierReference)) { return; } final PsiElement qualifierTarget = qualifierReference.resolve(); if (!(qualifierTarget instanceof PsiClass qualifierClass)) { return; } final PsiElement target = reference.resolve(); if (!(target instanceof PsiClass aClass)) { return; } final PsiClass containingClass = aClass.getContainingClass(); if (containingClass == null) { return; } if (!qualifierClass.isInheritor(containingClass, true)) { return; } final PsiElement identifier = reference.getReferenceNameElement(); if (identifier == null) { return; } registerError(identifier, containingClass, qualifierClass); }