package com.facebook.bolts; /* loaded from: classes2.dex */ public class TaskCompletionSource { private final Task task = new Task<>(); public final Task getTask() { return this.task; } public final boolean trySetCancelled() { return this.task.trySetCancelled(); } public final boolean trySetResult(TResult tresult) { return this.task.trySetResult(tresult); } public final boolean trySetError(Exception exc) { return this.task.trySetError(exc); } public final void setCancelled() { if (!trySetCancelled()) { throw new IllegalStateException("Cannot cancel a completed task.".toString()); } } public final void setResult(TResult tresult) { if (!trySetResult(tresult)) { throw new IllegalStateException("Cannot set the result of a completed task.".toString()); } } public final void setError(Exception exc) { if (!trySetError(exc)) { throw new IllegalStateException("Cannot set the error on a completed task.".toString()); } } }