@Override
  protected UsageInfo @NotNull [] findUsages() {
    GlobalSearchScope projectScope = GlobalSearchScope.projectScope(myProject);
    List<UsageInfo> result = new ArrayList<>();

    boolean hadTypeParameters = myClass.hasTypeParameters();
    for (final PsiReference reference : ReferencesSearch.search(myClass, projectScope, false)) {
      if (reference.getElement() instanceof PsiJavaCodeReferenceElement referenceElement) {
        PsiElement parent = referenceElement.getParent();
        if (parent instanceof PsiTypeElement && (parent.getParent() instanceof PsiInstanceOfExpression ||
                                                 parent.getParent() instanceof PsiClassObjectAccessExpression)) {
          continue;
        }
        if (parent instanceof PsiNewExpression newExpression && PsiDiamondType.hasDiamond(newExpression)) {
          continue;
        }
        if (parent instanceof PsiTypeElement || parent instanceof PsiNewExpression || parent instanceof PsiAnonymousClass ||
            parent instanceof PsiReferenceList) {
          if (!hadTypeParameters || referenceElement.getTypeParameters().length > 0) {
            result.add(new UsageInfo(referenceElement));
          }
        }
      }
    }
    return result.toArray(UsageInfo.EMPTY_ARRAY);
  }
@Override
  protected UsageInfo @NotNull [] findUsages()