@Override public void visitReferenceElement(@NotNull PsiJavaCodeReferenceElement reference) {
        super.visitReferenceElement(reference);
        if (!reference.isQualified() &&
            reference.resolve() instanceof PsiTypeParameter typeParameter &&
            PsiTreeUtil.isAncestor(typeParameter.getOwner(), element, false) &&
            filter.value(typeParameter)) {
          used.add(typeParameter);
        }
      }
@Override public void visitReferenceElement(@NotNull PsiJavaCodeReferenceElement reference)