private static boolean findAutoCloseableVariables(PsiStatement statement, Set<? super PsiVariable> variables) {
    if (findAutoClosableVariableWithoutTry(statement, variables)) return true;
    if (statement instanceof PsiTryStatement tryStatement) {
      if (tryStatement.getResourceList() != null || tryStatement.getFinallyBlock() != null) return true;
      PsiCodeBlock[] catchBlocks = tryStatement.getCatchBlocks();
      if (catchBlocks.length != 1) return true;
      PsiStatement[] catchStatements = catchBlocks[0].getStatements();
      if (catchStatements.length != 0) return true;
      PsiCodeBlock tryBlock = tryStatement.getTryBlock();
      if (tryBlock == null) return true;
      PsiStatement[] tryStatements = tryBlock.getStatements();
      for (PsiStatement tryStmt : tryStatements) {
        if (!findAutoClosableVariableWithoutTry(tryStmt, variables)) {
          return false;
        }
      }
      return true;
    }
    return false;
  }
private static boolean findAutoCloseableVariables(PsiStatement statement, Set<? super PsiVariable> variables)