private static PsiDeconstructionPattern[] findDeconstructionUsages(final PsiMethod method, final ArrayList<? super UsageInfo> result) {
    if (!(JavaPsiRecordUtil.isCompactConstructor(method) ||
          JavaPsiRecordUtil.isExplicitCanonicalConstructor(method) ||
          method instanceof LightRecordCanonicalConstructor)) {
      return PsiDeconstructionPattern.EMPTY_ARRAY;
    }
    PsiClass aClass = method.getContainingClass();
    if (aClass == null) {
      return PsiDeconstructionPattern.EMPTY_ARRAY;
    }
    PsiParameter[] parameters = method.getParameterList().getParameters();
    List<PsiDeconstructionPattern> deconstructions = new ArrayList<>();
    GlobalSearchScope projectScope = GlobalSearchScope.projectScope(method.getProject());
    for (PsiReference reference : ReferencesSearch.search(aClass, projectScope)) {
      PsiElement element = reference.getElement();
      PsiElement parent = element.getParent();
      if (!(parent instanceof PsiTypeElement)) {
        continue;
      }
      PsiElement grandParent = parent.getParent();
      if (grandParent instanceof PsiDeconstructionPattern) {
        if (isSuitableDeconstruction((PsiDeconstructionPattern)grandParent, parameters)) {
          result.add(new DeconstructionUsageInfo((PsiDeconstructionPattern)grandParent));
          deconstructions.add((PsiDeconstructionPattern)grandParent);
        }
      }
    }
    return deconstructions.toArray(PsiDeconstructionPattern.EMPTY_ARRAY);
  }
private static PsiDeconstructionPattern[] findDeconstructionUsages(final PsiMethod method, final ArrayList<? super UsageInfo> result)