void (@NotNull GrCodeReferenceElement reference) { GroovyResolveResult resolveResult = reference.advancedResolve(); PsiElement referencedElement = resolveResult.getElement(); if (referencedElement instanceof GrTypeDefinition referencedClass) { if (PsiTreeUtil.isAncestor(myClass, referencedElement, true) || isPartOf(myClass, referencedClass.getContainingClass())) { visitClassMemberReferenceElement(reference, (GrMember)referencedElement, resolveResult); } } }