@Override
  public void visitTryStatement(@NotNull PsiTryStatement statement) {
    final PsiTryStatement other = (PsiTryStatement)myMatchingVisitor.getElement();

    if (!myMatchingVisitor.setResult(myMatchingVisitor.matchSons(statement.getTryBlock(), other.getTryBlock()))) return;

    final PsiResourceList resourceList1 = statement.getResourceList();
    final PsiCatchSection[] catches1 = statement.getCatchSections();
    final PsiCodeBlock finally1 = statement.getFinallyBlock();

    final PsiResourceList resourceList2 = other.getResourceList();
    final PsiCatchSection[] catches2 = other.getCatchSections();
    final PsiCodeBlock finally2 = other.getFinallyBlock();

    final MatchContext context = myMatchingVisitor.getMatchContext();
    if (myMatchingVisitor.setResult(context.getOptions().isLooseMatching() ||
                                    ((catches1.length != 0 || catches2.length == 0) &&
                                     (finally1 != null || finally2 == null) &&
                                     (resourceList1 != null || resourceList2 == null)))) {
      final List<PsiElement> unmatchedElements = new SmartList<>();
      if (resourceList1 != null) {
        final List<PsiResourceListElement> resources1 = PsiTreeUtil.getChildrenOfTypeAsList(resourceList1, PsiResourceListElement.class);
        final List<PsiResourceListElement> resources2 = PsiTreeUtil.getChildrenOfTypeAsList(resourceList2, PsiResourceListElement.class);
        if (!myMatchingVisitor.setResult(myMatchingVisitor.matchInAnyOrder(resources1.toArray(PsiElement.EMPTY_ARRAY),
                                                                           resources2.toArray(PsiElement.EMPTY_ARRAY)))) {
          return;
        }
      }
      else if (resourceList2 != null){
        unmatchedElements.add(resourceList2);
      }

      ContainerUtil.addAll(unmatchedElements, catches2);
      context.pushMatchedElementsListener(elements -> unmatchedElements.removeAll(elements));
      try {
        if (!myMatchingVisitor.setResult(myMatchingVisitor.matchInAnyOrder(catches1, catches2))) {
          return;
        }
      } finally {
        context.popMatchedElementsListener();
      }

      if (finally1 != null) {
        myMatchingVisitor.setResult(myMatchingVisitor.matchSons(finally1, finally2));
      } else if (finally2 != null) {
        unmatchedElements.add(finally2);
      }

      if (myMatchingVisitor.getResult()) {
        other.putUserData(GlobalMatchingVisitor.UNMATCHED_ELEMENTS_KEY, unmatchedElements);
      }
    }
  }
@Override
  public void visitTryStatement(@NotNull PsiTryStatement statement)