Program: 55129
Project: 55129
Buggy source:
public AbstractBucket(){
  asyncView=new AsyncBucket(){
    @Override public CompletableFuture<Boolean> tryConsume(    long tokensToConsume){
      checkTokensToConsume(tokensToConsume);
      return tryConsumeAsyncImpl(tokensToConsume);
    }
    @Override public CompletableFuture<ConsumptionProbe> tryConsumeAndReturnRemaining(    long tokensToConsume){
      checkTokensToConsume(tokensToConsume);
      return tryConsumeAndReturnRemainingTokensAsyncImpl(tokensToConsume);
    }
    @Override public CompletableFuture<Long> tryConsumeAsMuchAsPossible(){
      return tryConsumeAsMuchAsPossibleAsyncImpl(Long.MAX_VALUE);
    }
    @Override public CompletableFuture<Long> tryConsumeAsMuchAsPossible(    long limit){
      checkTokensToConsume(limit);
      return tryConsumeAsMuchAsPossibleAsyncImpl(limit);
    }
    @Override public CompletableFuture<Boolean> consume(    long tokensToConsume,    long maxWaitTimeNanos,    ScheduledExecutorService scheduler) throws InterruptedException {
      checkTokensToConsume(tokensToConsume);
      checkMaxWaitTime(maxWaitTimeNanos);
      CompletableFuture<Boolean> resultFuture=new CompletableFuture<>();
      CompletableFuture<Long> reservationFuture=reserveAndCalculateTimeToSleepAsyncImpl(tokensToConsume,maxWaitTimeNanos);
      reservationFuture.whenComplete((nanosToSleep,exception) -> {
        if (exception != null) {
          resultFuture.completeExceptionally(exception);
          return;
        }
        if (nanosToSleep == Long.MAX_VALUE) {
          resultFuture.complete(false);
        }
        if (nanosToSleep == 0L) {
          resultFuture.complete(true);
        }
        try {
          Runnable delayedComplection=() -> resultFuture.complete(true);
          scheduler.schedule(delayedComplection,nanosToSleep,TimeUnit.NANOSECONDS);
        }
 catch (        Throwable t) {
          resultFuture.completeExceptionally(t);
        }
      }
);
      return resultFuture;
    }
    @Override public CompletableFuture<Void> consume(    long tokensToConsume,    ScheduledExecutorService scheduler) throws InterruptedException {
      return consume(tokensToConsume,UNSPECIFIED_WAITING_LIMIT,scheduler).thenApply(bool -> null);
    }
    @Override public CompletableFuture<Void> addTokens(    long tokensToAdd){
      checkTokensToAdd(tokensToAdd);
      return addTokensAsyncImpl(tokensToAdd);
    }
  }
;
}

Fixed version (ground truth):
public AbstractBucket(){
  asyncView=new AsyncBucket(){
    @Override public CompletableFuture<Boolean> tryConsume(    long tokensToConsume){
      checkTokensToConsume(tokensToConsume);
      return tryConsumeAsyncImpl(tokensToConsume);
    }
    @Override public CompletableFuture<ConsumptionProbe> tryConsumeAndReturnRemaining(    long tokensToConsume){
      checkTokensToConsume(tokensToConsume);
      return tryConsumeAndReturnRemainingTokensAsyncImpl(tokensToConsume);
    }
    @Override public CompletableFuture<Long> tryConsumeAsMuchAsPossible(){
      return tryConsumeAsMuchAsPossibleAsyncImpl(Long.MAX_VALUE);
    }
    @Override public CompletableFuture<Long> tryConsumeAsMuchAsPossible(    long limit){
      checkTokensToConsume(limit);
      return tryConsumeAsMuchAsPossibleAsyncImpl(limit);
    }
    @Override public CompletableFuture<Boolean> consume(    long tokensToConsume,    long maxWaitTimeNanos,    ScheduledExecutorService scheduler) throws InterruptedException {
      return consumeImpl(tokensToConsume,maxWaitTimeNanos,true,scheduler);
    }
    @Override public CompletableFuture<Void> consume(    long tokensToConsume,    ScheduledExecutorService scheduler) throws InterruptedException {
      return consumeImpl(tokensToConsume,UNSPECIFIED_WAITING_LIMIT,false,scheduler).thenApply(bool -> null);
    }
    @Override public CompletableFuture<Void> addTokens(    long tokensToAdd){
      checkTokensToAdd(tokensToAdd);
      return addTokensAsyncImpl(tokensToAdd);
    }
    private CompletableFuture<Boolean> consumeImpl(    long tokensToConsume,    long maxWaitTimeNanos,    boolean limitedWaiting,    ScheduledExecutorService scheduler){
      if (limitedWaiting) {
        checkMaxWaitTime(maxWaitTimeNanos);
      }
      checkTokensToConsume(tokensToConsume);
      CompletableFuture<Boolean> resultFuture=new CompletableFuture<>();
      CompletableFuture<Long> reservationFuture=reserveAndCalculateTimeToSleepAsyncImpl(tokensToConsume,maxWaitTimeNanos);
      reservationFuture.whenComplete((nanosToSleep,exception) -> {
        if (exception != null) {
          resultFuture.completeExceptionally(exception);
          return;
        }
        if (nanosToSleep == Long.MAX_VALUE) {
          resultFuture.complete(false);
          return;
        }
        if (nanosToSleep == 0L) {
          resultFuture.complete(true);
          return;
        }
        try {
          Runnable delayedCompletion=() -> resultFuture.complete(true);
          scheduler.schedule(delayedCompletion,nanosToSleep,TimeUnit.NANOSECONDS);
        }
 catch (        Throwable t) {
          resultFuture.completeExceptionally(t);
        }
      }
);
      return resultFuture;
    }
  }
;
}