class TaskRunCancel {

  public static void main(String[] args) {<FILL_FUNCTION_BODY>}
}

    try (TektonClient tektonClient = new DefaultTektonClient()) {

      String namespace = "default";
      TaskRun taskRun = tektonClient.v1().taskRuns().inNamespace(namespace).list().getItems().get(0);

      List<Condition> taskRunConditions = new ArrayList<>();
      Condition taskRunCancelCondition = new Condition();
      taskRunCancelCondition.setType("Succeeded");
      taskRunCancelCondition.setStatus("False");
      taskRunCancelCondition.setReason("TaskRunCancelled");
      taskRunCancelCondition.setMessage("The TaskRun was cancelled successfully.");
      taskRunConditions.add(taskRunCancelCondition);

      /*
       * The implementation needs to replace old conditions with the single status condition to be added.
       * Without this, you will receive back a "Not all Steps in the Task have finished executing" message
       */
      taskRun.getStatus().setConditions(taskRunConditions);

      tektonClient.v1().taskRuns().inNamespace(namespace).updateStatus(taskRun);
    }
  
<no_super_class>