@SuppressWarnings("unchecked") public Promise<Result,Progress> reject(Exception ex){
  List<FailCallback> failCallbacks;
  List<AlwaysCallback> alwaysCallbacks;
synchronized (this) {
    validateInPendingState();
    mState=STATE_REJECTED;
    printStateChanged("REJECTED");
    mException=ex;
    failCallbacks=mCallbacks.cloneFailCallbacks();
    alwaysCallbacks=mCallbacks.cloneAlwaysCallbacks();
    clearCallbacks();
  }
  if (failCallbacks.size() > 0 || alwaysCallbacks.size() > 0) {
    triggerAllFails(failCallbacks);
    triggerAllAlways(alwaysCallbacks);
  }
  return this;
}

@ SuppressWarnings ( "unchecked" ) public Promise < Result , Progress > reject ( Exception ex ) { List < FailCallback > failCallbacks ; List < AlwaysCallback > alwaysCallbacks ; synchronized ( this ) { validateInPendingState ( ) ; mState = STATE_REJECTED ; printStateChanged ( "REJECTED" ) ; mException = ex ; failCallbacks = mCallbacks . cloneFailCallbacks ( ) ; alwaysCallbacks = mCallbacks . cloneAlwaysCallbacks ( ) ; clearCallbacks ( ) ; } if ( failCallbacks . size ( ) > 0 || alwaysCallbacks . size ( ) > 0 ) { triggerAllFails ( failCallbacks ) ; triggerAllAlways ( alwaysCallbacks ) ; } return this ; }
rejects the promise , triggers any fail / always callbacks
