void (@NotNull PsiJavaCodeReferenceElement reference) { super.visitReferenceElement(reference); if (reference.isQualified()) { return; } final PsiElement target = reference.resolve(); if (!(target instanceof PsiClass aClass)) { return; } if (!onDemand) { final String qualifiedName = aClass.getQualifiedName(); if (name.equals(qualifiedName)) { references.add(reference); } return; } final PsiClass containingClass = aClass.getContainingClass(); if (containingClass == null) { return; } final String qualifiedName = containingClass.getQualifiedName(); if (name.equals(qualifiedName)) { references.add(reference); } }