nus-yam/ex-repair huggingface dataset:
Program: 60097
Project: 60097
Buggy source:
/** 
 * Returns true iff the configuration defined by this object is <i>compatible with</i> the configuration defined by   {@code that}.  Intuitively, this checks for structural properties and ignores non-structural properties.  Specifically, this method checks whether the configurations have compatible support for: <ul> <li>parallel edges <li>self-loops </ul> <p>It does not compare expected values for numbers of edges or nodes, and it is not equivalent to   {@code Object.equals}.
 */
public boolean compatibleWith(GraphConfig that){
  checkNotNull(that,"String_Node_Str");
  return this.multigraph == that.multigraph && this.selfLoopsAllowed == that.selfLoopsAllowed;
}

Fixed version (ground truth):
/** 
 * Returns true iff the configuration defined by this object is <i>compatible with</i> the configuration defined by   {@code that}.  Intuitively, this checks for structural properties and ignores non-structural properties.  Specifically, this method checks whether the configurations have compatible support for: <ul> <li>parallel edges <li>self-loops </ul> By "compatible with", we mean that this instance must be at least as permissive as the input config (  {@code that}).  Thus, for example, if the input permits parallel edges, this instance must also permit parallel edges in order for the configurations to be compatible. <p>It does not compare expected values for numbers of edges or nodes, and it is not equivalent to   {@code Object.equals}.
 */
public boolean compatibleWith(GraphConfig that){
  checkNotNull(that,"String_Node_Str");
  if (that.multigraph && !this.multigraph) {
    return false;
  }
  if (that.selfLoopsAllowed && !this.selfLoopsAllowed) {
    return false;
  }
  return true;
}
Program: 60098
Project: 60098
Buggy source:
public void testNull(){
  try {
    map.putInstance((TypeToken)null,new Integer(1));
    fail();
  }
 catch (  NullPointerException expected) {
  }
  map.putInstance(Integer.class,null);
  assertNull(map.get((Object)Integer.class));
  assertNull(map.getInstance(Integer.class));
  map.putInstance(Long.class,null);
  assertNull(map.get((Object)Long.class));
  assertNull(map.getInstance(Long.class));
}

Fixed version (ground truth):
public void testNull(){
  try {
    map.putInstance((TypeToken)null,new Integer(1));
    fail();
  }
 catch (  NullPointerException expected) {
  }
  map.putInstance(Integer.class,null);
  assertTrue(map.containsKey(TypeToken.of(Integer.class)));
  assertTrue(map.entrySet().contains(immutableEntry(TypeToken.of(Integer.class),null)));
  assertNull(map.get(TypeToken.of(Integer.class)));
  assertNull(map.getInstance(Integer.class));
  map.putInstance(Long.class,null);
  assertTrue(map.containsKey(TypeToken.of(Long.class)));
  assertTrue(map.entrySet().contains(immutableEntry(TypeToken.of(Long.class),null)));
  assertNull(map.get(TypeToken.of(Long.class)));
  assertNull(map.getInstance(Long.class));
}
Program: 60099
Project: 60099
Buggy source:
/** 
 * Returns a   {@code ClassPath} representing all classes and resources loadable from {@code classloader} and its parent class loaders.<p>Currently only  {@link URLClassLoader} and only {@code file://} urls are supported.
 * @throws IOException if the attempt to read class path resources (jar files or directories)failed.
 */
public static ClassPath from(ClassLoader classloader) throws IOException {
  DefaultScanner scanner=new DefaultScanner();
  scanner.scan(classloader);
  return new ClassPath(scanner.getResources());
}

Fixed version (ground truth):
/** 
 * Returns a   {@code ClassPath} representing all classes and resources loadable from {@code classloader} and its parent class loaders.<p><b>Warning:</b> Currently only  {@link URLClassLoader} and only {@code file://} urls aresupported.
 * @throws IOException if the attempt to read class path resources (jar files or directories)failed.
 */
public static ClassPath from(ClassLoader classloader) throws IOException {
  DefaultScanner scanner=new DefaultScanner();
  scanner.scan(classloader);
  return new ClassPath(scanner.getResources());
}
Program: 60100
Project: 60100
Buggy source:
/** 
 * Create a suite whose maps are descending views of other maps.
 */
private TestSuite createDescendingSuite(final FeatureSpecificTestSuiteBuilder<?,? extends OneSizeTestContainerGenerator<Map<K,V>,Entry<K,V>>> parentBuilder){
  final TestMapGenerator<K,V> delegate=(TestMapGenerator<K,V>)parentBuilder.getSubjectGenerator().getInnerGenerator();
  List<Feature<?>> features=new ArrayList<Feature<?>>();
  features.add(NoRecurse.DESCENDING);
  features.addAll(parentBuilder.getFeatures());
  return NavigableMapTestSuiteBuilder.using(new ForwardingTestMapGenerator<K,V>(delegate){
    @Override public Map<K,V> create(    Object... entries){
      NavigableMap<K,V> map=(NavigableMap<K,V>)delegate.create(entries);
      return map.descendingMap();
    }
    @Override public Iterable<Entry<K,V>> order(    List<Entry<K,V>> insertionOrder){
      insertionOrder=castOrCopyToList(delegate.order(insertionOrder));
      reverse(insertionOrder);
      return insertionOrder;
    }
  }
).named(parentBuilder.getName() + "String_Node_Str").withFeatures(features).suppressing(parentBuilder.getSuppressedTests()).createTestSuite();
}

Fixed version (ground truth):
/** 
 * Create a suite whose maps are descending views of other maps.
 */
private TestSuite createDescendingSuite(final FeatureSpecificTestSuiteBuilder<?,? extends OneSizeTestContainerGenerator<Map<K,V>,Entry<K,V>>> parentBuilder){
  final TestSortedMapGenerator<K,V> delegate=(TestSortedMapGenerator<K,V>)parentBuilder.getSubjectGenerator().getInnerGenerator();
  List<Feature<?>> features=new ArrayList<Feature<?>>();
  features.add(NoRecurse.DESCENDING);
  features.addAll(parentBuilder.getFeatures());
  return NavigableMapTestSuiteBuilder.using(new DescendingTestMapGenerator<K,V>(delegate)).named(parentBuilder.getName() + "String_Node_Str").withFeatures(features).suppressing(parentBuilder.getSuppressedTests()).createTestSuite();
}
Program: 60101
Project: 60101
Buggy source:
@Override public Map<K,V> create(Object... elements){
  return delegate.create(elements);
}

Fixed version (ground truth):
@Override public NavigableMap<K,V> create(Object... entries){
  NavigableMap<K,V> map=(NavigableMap<K,V>)delegate.create(entries);
  return map.descendingMap();
}
Program: 60102
Project: 60102
Buggy source:
@Override public Iterable<Entry<K,V>> order(List<Entry<K,V>> insertionOrder){
  return delegate.order(insertionOrder);
}

Fixed version (ground truth):
@Override public Iterable<Entry<K,V>> order(List<Entry<K,V>> insertionOrder){
  insertionOrder=castOrCopyToList(delegate.order(insertionOrder));
  reverse(insertionOrder);
  return insertionOrder;
}
Program: 60103
Project: 60103
Buggy source:
@GwtIncompatible("String_Node_Str") public void testCheckedSubtract(){
  for (  long a : ALL_INTEGER_CANDIDATES) {
    for (    long b : ALL_INTEGER_CANDIDATES) {
      BigInteger expectedResult=valueOf(a).subtract(valueOf(b));
      boolean expectedSuccess=fitsInLong(expectedResult);
      try {
        assertEquals(a - b,LongMath.checkedSubtract(a,b));
        assertTrue(expectedSuccess);
      }
 catch (      ArithmeticException e) {
        assertFalse(expectedSuccess);
      }
    }
  }
}

Fixed version (ground truth):
@GwtIncompatible("String_Node_Str") public void testCheckedSubtract(){
  for (  long a : ALL_LONG_CANDIDATES) {
    for (    long b : ALL_LONG_CANDIDATES) {
      BigInteger expectedResult=valueOf(a).subtract(valueOf(b));
      boolean expectedSuccess=fitsInLong(expectedResult);
      try {
        assertEquals(a - b,LongMath.checkedSubtract(a,b));
        assertTrue(expectedSuccess);
      }
 catch (      ArithmeticException e) {
        assertFalse(expectedSuccess);
      }
    }
  }
}
Program: 60104
Project: 60104
Buggy source:
@GwtIncompatible("String_Node_Str") public void testCheckedPow(){
  for (  long b : ALL_INTEGER_CANDIDATES) {
    for (    int exp : EXPONENTS) {
      BigInteger expectedResult=valueOf(b).pow(exp);
      boolean expectedSuccess=fitsInLong(expectedResult);
      try {
        assertEquals(expectedResult.longValue(),LongMath.checkedPow(b,exp));
        assertTrue(expectedSuccess);
      }
 catch (      ArithmeticException e) {
        assertFalse(expectedSuccess);
      }
    }
  }
}

Fixed version (ground truth):
@GwtIncompatible("String_Node_Str") public void testCheckedPow(){
  for (  long b : ALL_LONG_CANDIDATES) {
    for (    int exp : EXPONENTS) {
      BigInteger expectedResult=valueOf(b).pow(exp);
      boolean expectedSuccess=fitsInLong(expectedResult);
      try {
        assertEquals(expectedResult.longValue(),LongMath.checkedPow(b,exp));
        assertTrue(expectedSuccess);
      }
 catch (      ArithmeticException e) {
        assertFalse(expectedSuccess);
      }
    }
  }
}
Program: 60105
Project: 60105
Buggy source:
@GwtIncompatible("String_Node_Str") public void testCheckedMultiply(){
  for (  long a : ALL_INTEGER_CANDIDATES) {
    for (    long b : ALL_INTEGER_CANDIDATES) {
      BigInteger expectedResult=valueOf(a).multiply(valueOf(b));
      boolean expectedSuccess=fitsInLong(expectedResult);
      try {
        assertEquals(a * b,LongMath.checkedMultiply(a,b));
        assertTrue(expectedSuccess);
      }
 catch (      ArithmeticException e) {
        assertFalse(expectedSuccess);
      }
    }
  }
}

Fixed version (ground truth):
@GwtIncompatible("String_Node_Str") public void testCheckedMultiply(){
  for (  long a : ALL_LONG_CANDIDATES) {
    for (    long b : ALL_LONG_CANDIDATES) {
      BigInteger expectedResult=valueOf(a).multiply(valueOf(b));
      boolean expectedSuccess=fitsInLong(expectedResult);
      try {
        assertEquals(a * b,LongMath.checkedMultiply(a,b));
        assertTrue(expectedSuccess);
      }
 catch (      ArithmeticException e) {
        assertFalse(expectedSuccess);
      }
    }
  }
}
Program: 60106
Project: 60106
Buggy source:
@GwtIncompatible("String_Node_Str") public void testCheckedAdd(){
  for (  long a : ALL_INTEGER_CANDIDATES) {
    for (    long b : ALL_INTEGER_CANDIDATES) {
      BigInteger expectedResult=valueOf(a).add(valueOf(b));
      boolean expectedSuccess=fitsInLong(expectedResult);
      try {
        assertEquals(a + b,LongMath.checkedAdd(a,b));
        assertTrue(expectedSuccess);
      }
 catch (      ArithmeticException e) {
        assertFalse(expectedSuccess);
      }
    }
  }
}

Fixed version (ground truth):
@GwtIncompatible("String_Node_Str") public void testCheckedAdd(){
  for (  long a : ALL_LONG_CANDIDATES) {
    for (    long b : ALL_LONG_CANDIDATES) {
      BigInteger expectedResult=valueOf(a).add(valueOf(b));
      boolean expectedSuccess=fitsInLong(expectedResult);
      try {
        assertEquals(a + b,LongMath.checkedAdd(a,b));
        assertTrue(expectedSuccess);
      }
 catch (      ArithmeticException e) {
        assertFalse(expectedSuccess);
      }
    }
  }
}
Program: 60107
Project: 60107
Buggy source:
/** 
 * Returns the   {@code b} to the {@code k}th power, provided it does not overflow.
 * @throws ArithmeticException if {@code b} to the {@code k}th power overflows in signed  {@code long} arithmetic
 */
@GwtIncompatible("String_Node_Str") public static long checkedPow(long b,int k){
  checkNonNegative("String_Node_Str",k);
  if (b >= -2 & b <= 2) {
switch ((int)b) {
case 0:
      return (k == 0) ? 1 : 0;
case 1:
    return 1;
case (-1):
  return ((k & 1) == 0) ? 1 : -1;
case 2:
checkNoOverflow(k < Long.SIZE - 1);
return 1L << k;
case (-2):
checkNoOverflow(k < Long.SIZE);
return ((k & 1) == 0) ? (1L << k) : (-1L << k);
default :
throw new AssertionError();
}
}
long accum=1;
while (true) {
switch (k) {
case 0:
return accum;
case 1:
return checkedMultiply(accum,b);
default :
if ((k & 1) != 0) {
accum=checkedMultiply(accum,b);
}
k>>=1;
if (k > 0) {
checkNoOverflow(b <= FLOOR_SQRT_MAX_LONG);
b*=b;
}
}
}
}

Fixed version (ground truth):
/** 
 * Returns the   {@code b} to the {@code k}th power, provided it does not overflow.
 * @throws ArithmeticException if {@code b} to the {@code k}th power overflows in signed  {@code long} arithmetic
 */
@GwtIncompatible("String_Node_Str") public static long checkedPow(long b,int k){
  checkNonNegative("String_Node_Str",k);
  if (b >= -2 & b <= 2) {
switch ((int)b) {
case 0:
      return (k == 0) ? 1 : 0;
case 1:
    return 1;
case (-1):
  return ((k & 1) == 0) ? 1 : -1;
case 2:
checkNoOverflow(k < Long.SIZE - 1);
return 1L << k;
case (-2):
checkNoOverflow(k < Long.SIZE);
return ((k & 1) == 0) ? (1L << k) : (-1L << k);
default :
throw new AssertionError();
}
}
long accum=1;
while (true) {
switch (k) {
case 0:
return accum;
case 1:
return checkedMultiply(accum,b);
default :
if ((k & 1) != 0) {
accum=checkedMultiply(accum,b);
}
k>>=1;
if (k > 0) {
checkNoOverflow(-FLOOR_SQRT_MAX_LONG <= b && b <= FLOOR_SQRT_MAX_LONG);
b*=b;
}
}
}
}
Program: 60108
Project: 60108
Buggy source:
@Override public Iterator<Entry<V,K>> iterator(){
  return new Itr<Entry<V,K>>(){
    @Override Entry<V,K> output(    BiEntry<K,V> entry){
      return new InverseEntry(entry);
    }
class InverseEntry extends AbstractMapEntry<V,K> {
      BiEntry<K,V> delegate;
      InverseEntry(      BiEntry<K,V> entry){
        this.delegate=entry;
      }
      @Override public V getKey(){
        return delegate.value;
      }
      @Override public K getValue(){
        return delegate.key;
      }
      @Override public K setValue(      K key){
        K oldKey=delegate.key;
        int keyHash=smearedHash(key);
        if (keyHash == delegate.keyHash && Objects.equal(key,oldKey)) {
          return key;
        }
        checkArgument(seekByKey(key,keyHash) == null,"String_Node_Str",key);
        delete(delegate);
        BiEntry<K,V> newEntry=new BiEntry<K,V>(key,keyHash,delegate.value,delegate.valueHash);
        insert(newEntry);
        expectedModCount=modCount;
        return oldKey;
      }
    }
  }
;
}

Fixed version (ground truth):
@Override public Iterator<Entry<V,K>> iterator(){
  return new Itr<Entry<V,K>>(){
    @Override Entry<V,K> output(    BiEntry<K,V> entry){
      return new InverseEntry(entry);
    }
class InverseEntry extends AbstractMapEntry<V,K> {
      BiEntry<K,V> delegate;
      InverseEntry(      BiEntry<K,V> entry){
        this.delegate=entry;
      }
      @Override public V getKey(){
        return delegate.value;
      }
      @Override public K getValue(){
        return delegate.key;
      }
      @Override public K setValue(      K key){
        K oldKey=delegate.key;
        int keyHash=smearedHash(key);
        if (keyHash == delegate.keyHash && Objects.equal(key,oldKey)) {
          return key;
        }
        checkArgument(seekByKey(key,keyHash) == null,"String_Node_Str",key);
        delete(delegate);
        BiEntry<K,V> newEntry=new BiEntry<K,V>(key,keyHash,delegate.value,delegate.valueHash);
        delegate=newEntry;
        insert(newEntry);
        expectedModCount=modCount;
        return oldKey;
      }
    }
  }
;
}
Program: 60109
Project: 60109
Buggy source:
@Override public Set<Entry<V,K>> entrySet(){
  return new Maps.EntrySet<V,K>(){
    @Override Map<V,K> map(){
      return Inverse.this;
    }
    @Override public Iterator<Entry<V,K>> iterator(){
      return new Itr<Entry<V,K>>(){
        @Override Entry<V,K> output(        BiEntry<K,V> entry){
          return new InverseEntry(entry);
        }
class InverseEntry extends AbstractMapEntry<V,K> {
          BiEntry<K,V> delegate;
          InverseEntry(          BiEntry<K,V> entry){
            this.delegate=entry;
          }
          @Override public V getKey(){
            return delegate.value;
          }
          @Override public K getValue(){
            return delegate.key;
          }
          @Override public K setValue(          K key){
            K oldKey=delegate.key;
            int keyHash=smearedHash(key);
            if (keyHash == delegate.keyHash && Objects.equal(key,oldKey)) {
              return key;
            }
            checkArgument(seekByKey(key,keyHash) == null,"String_Node_Str",key);
            delete(delegate);
            BiEntry<K,V> newEntry=new BiEntry<K,V>(key,keyHash,delegate.value,delegate.valueHash);
            insert(newEntry);
            expectedModCount=modCount;
            return oldKey;
          }
        }
      }
;
    }
  }
;
}

Fixed version (ground truth):
@Override public Set<Entry<V,K>> entrySet(){
  return new Maps.EntrySet<V,K>(){
    @Override Map<V,K> map(){
      return Inverse.this;
    }
    @Override public Iterator<Entry<V,K>> iterator(){
      return new Itr<Entry<V,K>>(){
        @Override Entry<V,K> output(        BiEntry<K,V> entry){
          return new InverseEntry(entry);
        }
class InverseEntry extends AbstractMapEntry<V,K> {
          BiEntry<K,V> delegate;
          InverseEntry(          BiEntry<K,V> entry){
            this.delegate=entry;
          }
          @Override public V getKey(){
            return delegate.value;
          }
          @Override public K getValue(){
            return delegate.key;
          }
          @Override public K setValue(          K key){
            K oldKey=delegate.key;
            int keyHash=smearedHash(key);
            if (keyHash == delegate.keyHash && Objects.equal(key,oldKey)) {
              return key;
            }
            checkArgument(seekByKey(key,keyHash) == null,"String_Node_Str",key);
            delete(delegate);
            BiEntry<K,V> newEntry=new BiEntry<K,V>(key,keyHash,delegate.value,delegate.valueHash);
            delegate=newEntry;
            insert(newEntry);
            expectedModCount=modCount;
            return oldKey;
          }
        }
      }
;
    }
  }
;
}
Program: 60110
Project: 60110
Buggy source:
@Override public K setValue(K key){
  K oldKey=delegate.key;
  int keyHash=smearedHash(key);
  if (keyHash == delegate.keyHash && Objects.equal(key,oldKey)) {
    return key;
  }
  checkArgument(seekByKey(key,keyHash) == null,"String_Node_Str",key);
  delete(delegate);
  BiEntry<K,V> newEntry=new BiEntry<K,V>(key,keyHash,delegate.value,delegate.valueHash);
  insert(newEntry);
  expectedModCount=modCount;
  return oldKey;
}

Fixed version (ground truth):
@Override public K setValue(K key){
  K oldKey=delegate.key;
  int keyHash=smearedHash(key);
  if (keyHash == delegate.keyHash && Objects.equal(key,oldKey)) {
    return key;
  }
  checkArgument(seekByKey(key,keyHash) == null,"String_Node_Str",key);
  delete(delegate);
  BiEntry<K,V> newEntry=new BiEntry<K,V>(key,keyHash,delegate.value,delegate.valueHash);
  delegate=newEntry;
  insert(newEntry);
  expectedModCount=modCount;
  return oldKey;
}
Program: 60111
Project: 60111
Buggy source:
/** 
 * Checks if the executor has been shut down and increments the running task count.
 * @throws RejectedExecutionException if the executor has been previouslyshutdown
 */
private void startTask(){
  lock.lock();
  try {
    if (isShutdown()) {
      throw new RejectedExecutionException("String_Node_Str");
    }
    runningTasks++;
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
/** 
 * Checks if the executor has been shut down and increments the running task count.
 * @throws RejectedExecutionException if the executor has been previouslyshutdown
 */
private void startTask(){
synchronized (lock) {
    if (shutdown) {
      throw new RejectedExecutionException("String_Node_Str");
    }
    runningTasks++;
  }
}
Program: 60112
Project: 60112
Buggy source:
/** 
 * Decrements the running task count.
 */
private void endTask(){
  lock.lock();
  try {
    runningTasks--;
    if (isTerminated()) {
      termination.signalAll();
    }
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
/** 
 * Decrements the running task count.
 */
private void endTask(){
synchronized (lock) {
    int numRunning=--runningTasks;
    if (numRunning == 0) {
      lock.notifyAll();
    }
  }
}
Program: 60113
Project: 60113
Buggy source:
@Benchmark int addThenExecute_multiThreaded(final int reps) throws InterruptedException {
  Runnable addTask=new Runnable(){
    @Override public void run(){
      for (int i=0; i < numListeners; i++) {
        list.add(listener,directExecutor());
      }
    }
  }
;
  int returnValue=0;
  for (int i=0; i < reps; i++) {
    list=impl.newExecutionList();
    listenerLatch=new CountDownLatch(numListeners * NUM_THREADS);
    for (int j=0; j < NUM_THREADS; j++) {
      executorService.submit(addTask);
    }
    executorService.submit(executeTask);
    returnValue=(int)listenerLatch.getCount();
    listenerLatch.await();
  }
  return returnValue;
}

Fixed version (ground truth):
@Benchmark int addThenExecute_multiThreaded(final int reps) throws InterruptedException {
  Runnable addTask=new Runnable(){
    @Override public void run(){
      for (int i=0; i < numListeners; i++) {
        list.add(listener,directExecutor());
      }
    }
  }
;
  int returnValue=0;
  for (int i=0; i < reps; i++) {
    list=impl.newExecutionList();
    listenerLatch=new CountDownLatch(numListeners * NUM_THREADS);
    for (int j=0; j < NUM_THREADS; j++) {
      executorService.submit(addTask);
    }
    executorService.submit(executeTask);
    returnValue+=(int)listenerLatch.getCount();
    listenerLatch.await();
  }
  return returnValue;
}
Program: 60114
Project: 60114
Buggy source:
@Override public Object getImpl(){
  return list;
}

Fixed version (ground truth):
@Override public Object getImpl(){
  return future;
}
Program: 60115
Project: 60115
Buggy source:
@BeforeExperiment void setUp() throws Exception {
  executorService=new ThreadPoolExecutor(NUM_THREADS,NUM_THREADS,Long.MAX_VALUE,TimeUnit.SECONDS,new ArrayBlockingQueue<Runnable>(1000));
  final AtomicInteger integer=new AtomicInteger();
  for (int i=0; i < NUM_THREADS * 10; i++) {
    executorService.submit(new Runnable(){
      @Override public void run(){
        integer.getAndIncrement();
      }
    }
);
  }
}

Fixed version (ground truth):
@BeforeExperiment void setUp() throws Exception {
  executorService=new ThreadPoolExecutor(NUM_THREADS,NUM_THREADS,Long.MAX_VALUE,TimeUnit.SECONDS,new ArrayBlockingQueue<Runnable>(1000));
  executorService.prestartAllCoreThreads();
  final AtomicInteger integer=new AtomicInteger();
  for (int i=0; i < NUM_THREADS * 10; i++) {
    executorService.submit(new Runnable(){
      @Override public void run(){
        integer.getAndIncrement();
      }
    }
);
  }
}
Program: 60116
Project: 60116
Buggy source:
@Benchmark int executeThenAdd_multiThreaded(final int reps) throws InterruptedException {
  Runnable addTask=new Runnable(){
    @Override public void run(){
      for (int i=0; i < numListeners; i++) {
        list.add(listener,directExecutor());
      }
    }
  }
;
  int returnValue=0;
  for (int i=0; i < reps; i++) {
    list=impl.newExecutionList();
    listenerLatch=new CountDownLatch(numListeners * NUM_THREADS);
    executorService.submit(executeTask);
    for (int j=0; j < NUM_THREADS; j++) {
      executorService.submit(addTask);
    }
    returnValue=(int)listenerLatch.getCount();
    listenerLatch.await();
  }
  return returnValue;
}

Fixed version (ground truth):
@Benchmark int executeThenAdd_multiThreaded(final int reps) throws InterruptedException {
  Runnable addTask=new Runnable(){
    @Override public void run(){
      for (int i=0; i < numListeners; i++) {
        list.add(listener,directExecutor());
      }
    }
  }
;
  int returnValue=0;
  for (int i=0; i < reps; i++) {
    list=impl.newExecutionList();
    listenerLatch=new CountDownLatch(numListeners * NUM_THREADS);
    executorService.submit(executeTask);
    for (int j=0; j < NUM_THREADS; j++) {
      executorService.submit(addTask);
    }
    returnValue+=(int)listenerLatch.getCount();
    listenerLatch.await();
  }
  return returnValue;
}
Program: 60117
Project: 60117
Buggy source:
private Range(Cut<C> lowerBound,Cut<C> upperBound){
  if (lowerBound.compareTo(upperBound) > 0 || lowerBound == Cut.<C>aboveAll() || upperBound == Cut.<C>belowAll()) {
    throw new IllegalArgumentException("String_Node_Str" + toString(lowerBound,upperBound));
  }
  this.lowerBound=checkNotNull(lowerBound);
  this.upperBound=checkNotNull(upperBound);
}

Fixed version (ground truth):
private Range(Cut<C> lowerBound,Cut<C> upperBound){
  this.lowerBound=checkNotNull(lowerBound);
  this.upperBound=checkNotNull(upperBound);
  if (lowerBound.compareTo(upperBound) > 0 || lowerBound == Cut.<C>aboveAll() || upperBound == Cut.<C>belowAll()) {
    throw new IllegalArgumentException("String_Node_Str" + toString(lowerBound,upperBound));
  }
}
Program: 60119
Project: 60119
Buggy source:
private static @Nullable Object generateDummyArg(Parameter param,FreshValueGenerator generator) throws ParameterNotInstantiableException {
  if (param.isAnnotationPresent(Nullable.class)) {
    return null;
  }
  Object arg=generator.generate(param.getType());
  if (arg == null) {
    throw new ParameterNotInstantiableException(param);
  }
  return arg;
}

Fixed version (ground truth):
private static @Nullable Object generateDummyArg(Parameter param,FreshValueGenerator generator) throws ParameterNotInstantiableException {
  if (param.isAnnotationPresent(Nullable.class)) {
    return null;
  }
  Object arg=generator.generateFresh(param.getType());
  if (arg == null) {
    throw new ParameterNotInstantiableException(param);
  }
  return arg;
}
Program: 60120
Project: 60120
Buggy source:
private static Object[] getParameterValues(Method method){
  FreshValueGenerator paramValues=new FreshValueGenerator();
  final List<Object> passedArgs=Lists.newArrayList();
  for (  Class<?> paramType : method.getParameterTypes()) {
    passedArgs.add(paramValues.generate(paramType));
  }
  return passedArgs.toArray();
}

Fixed version (ground truth):
private static Object[] getParameterValues(Method method){
  FreshValueGenerator paramValues=new FreshValueGenerator();
  final List<Object> passedArgs=Lists.newArrayList();
  for (  Class<?> paramType : method.getParameterTypes()) {
    passedArgs.add(paramValues.generateFresh(paramType));
  }
  return passedArgs.toArray();
}
Program: 60121
Project: 60121
Buggy source:
private static <T>void testToString(Class<T> interfaceType,Function<? super T,? extends T> wrapperFunction){
  T proxy=new FreshValueGenerator().newProxy(interfaceType);
  assertEquals("String_Node_Str",proxy.toString(),wrapperFunction.apply(proxy).toString());
}

Fixed version (ground truth):
private static <T>void testToString(Class<T> interfaceType,Function<? super T,? extends T> wrapperFunction){
  T proxy=new FreshValueGenerator().newFreshProxy(interfaceType);
  assertEquals("String_Node_Str",proxy.toString(),wrapperFunction.apply(proxy).toString());
}
Program: 60122
Project: 60122
Buggy source:
InteractionTester(Class<T> interfaceType,Method method){
  this.interfaceType=interfaceType;
  this.method=method;
  this.passedArgs=getParameterValues(method);
  this.returnValue=new FreshValueGenerator().generate(method.getReturnType());
}

Fixed version (ground truth):
InteractionTester(Class<T> interfaceType,Method method){
  this.interfaceType=interfaceType;
  this.method=method;
  this.passedArgs=getParameterValues(method);
  this.returnValue=new FreshValueGenerator().generateFresh(method.getReturnType());
}
Program: 60123
Project: 60123
Buggy source:
private static <T>void testEquals(Class<T> interfaceType,Function<? super T,? extends T> wrapperFunction){
  FreshValueGenerator generator=new FreshValueGenerator();
  T instance=generator.newProxy(interfaceType);
  new EqualsTester().addEqualityGroup(wrapperFunction.apply(instance),wrapperFunction.apply(instance)).addEqualityGroup(wrapperFunction.apply(generator.newProxy(interfaceType))).testEquals();
}

Fixed version (ground truth):
private static <T>void testEquals(Class<T> interfaceType,Function<? super T,? extends T> wrapperFunction){
  FreshValueGenerator generator=new FreshValueGenerator();
  T instance=generator.newFreshProxy(interfaceType);
  new EqualsTester().addEqualityGroup(wrapperFunction.apply(instance),wrapperFunction.apply(instance)).addEqualityGroup(wrapperFunction.apply(generator.newFreshProxy(interfaceType))).testEquals();
}
Program: 60124
Project: 60124
Buggy source:
ReferenceEntry<K,V> getNextEvictable(){
  for (  ReferenceEntry<K,V> e : accessQueue) {
    int weight=e.getValueReference().getWeight();
    if (weight > 0) {
      return e;
    }
  }
  throw new AssertionError();
}

Fixed version (ground truth):
@GuardedBy("String_Node_Str") ReferenceEntry<K,V> getNextEvictable(){
  for (  ReferenceEntry<K,V> e : accessQueue) {
    int weight=e.getValueReference().getWeight();
    if (weight > 0) {
      return e;
    }
  }
  throw new AssertionError();
}
Program: 60125
Project: 60125
Buggy source:
/** 
 * Tests that the forwarding wrapper returned by   {@code wrapperFunction} properly forwardsmethod calls with parameters passed as is, return value returned as is, and exceptions propagated as is.
 */
public <T>void testForwarding(Class<T> interfaceType,Function<? super T,? extends T> wrapperFunction){
  checkNotNull(wrapperFunction);
  checkArgument(interfaceType.isInterface(),"String_Node_Str",interfaceType);
  Method[] methods=getMostConcreteMethods(interfaceType);
  AccessibleObject.setAccessible(methods,true);
  for (  Method method : methods) {
    if (method.getName().equals("String_Node_Str") && method.getParameterTypes().length == 1 && method.getParameterTypes()[0] == Object.class) {
      continue;
    }
    if (method.getName().equals("String_Node_Str") && method.getParameterTypes().length == 0) {
      continue;
    }
    if (method.getName().equals("String_Node_Str") && method.getParameterTypes().length == 0) {
      continue;
    }
    testSuccessfulForwarding(interfaceType,method,wrapperFunction);
    testExceptionPropagation(interfaceType,method,wrapperFunction);
  }
  if (testsEquals) {
    testEquals(interfaceType,wrapperFunction);
  }
  testToString(interfaceType,wrapperFunction);
}

Fixed version (ground truth):
/** 
 * Tests that the forwarding wrapper returned by   {@code wrapperFunction} properly forwardsmethod calls with parameters passed as is, return value returned as is, and exceptions propagated as is.
 */
public <T>void testForwarding(Class<T> interfaceType,Function<? super T,? extends T> wrapperFunction){
  checkNotNull(wrapperFunction);
  checkArgument(interfaceType.isInterface(),"String_Node_Str",interfaceType);
  Method[] methods=getMostConcreteMethods(interfaceType);
  AccessibleObject.setAccessible(methods,true);
  for (  Method method : methods) {
    if (!Modifier.isAbstract(method.getModifiers())) {
      continue;
    }
    if (method.getName().equals("String_Node_Str") && method.getParameterTypes().length == 1 && method.getParameterTypes()[0] == Object.class) {
      continue;
    }
    if (method.getName().equals("String_Node_Str") && method.getParameterTypes().length == 0) {
      continue;
    }
    if (method.getName().equals("String_Node_Str") && method.getParameterTypes().length == 0) {
      continue;
    }
    testSuccessfulForwarding(interfaceType,method,wrapperFunction);
    testExceptionPropagation(interfaceType,method,wrapperFunction);
  }
  if (testsEquals) {
    testEquals(interfaceType,wrapperFunction);
  }
  testToString(interfaceType,wrapperFunction);
}
Program: 60126
Project: 60126
Buggy source:
/** 
 * Returns   {@code n!}, that is, the product of the first   {@code n} positiveintegers,  {@code 1} if {@code n == 0}, or e n!}, or  {@link Double#POSITIVE_INFINITY} if {@code n! > Double.MAX_VALUE}. <p>The result is within 1 ulp of the true value.
 * @throws IllegalArgumentException if {@code n < 0}
 */
public static double factorial(int n){
  checkNonNegative("String_Node_Str",n);
  if (n > MAX_FACTORIAL) {
    return Double.POSITIVE_INFINITY;
  }
 else {
    double accum=1.0;
    for (int i=1 + (n & ~0xf); i <= n; i++) {
      accum*=i;
    }
    return accum * everySixteenthFactorial[n >> 4];
  }
}

Fixed version (ground truth):
/** 
 * Returns   {@code n!}, that is, the product of the first   {@code n} positiveintegers,  {@code 1} if {@code n == 0}, or   {@code n!}, or  {@link Double#POSITIVE_INFINITY} if {@code n! > Double.MAX_VALUE}. <p>The result is within 1 ulp of the true value.
 * @throws IllegalArgumentException if {@code n < 0}
 */
public static double factorial(int n){
  checkNonNegative("String_Node_Str",n);
  if (n > MAX_FACTORIAL) {
    return Double.POSITIVE_INFINITY;
  }
 else {
    double accum=1.0;
    for (int i=1 + (n & ~0xf); i <= n; i++) {
      accum*=i;
    }
    return accum * everySixteenthFactorial[n >> 4];
  }
}
Program: 60127
Project: 60127
Buggy source:
/** 
 * Returns   {@code n!}, that is, the product of the first   {@code n} positiveintegers,  {@code 1} if {@code n == 0}, or e n!}, or  {@link Double#POSITIVE_INFINITY} if {@code n! > Double.MAX_VALUE}. <p>The result is within 1 ulp of the true value.
 * @throws IllegalArgumentException if {@code n < 0}
 */
public static double factorial(int n){
  checkNonNegative("String_Node_Str",n);
  if (n > MAX_FACTORIAL) {
    return Double.POSITIVE_INFINITY;
  }
 else {
    double accum=1.0;
    for (int i=1 + (n & ~0xf); i <= n; i++) {
      accum*=i;
    }
    return accum * everySixteenthFactorial[n >> 4];
  }
}

Fixed version (ground truth):
/** 
 * Returns   {@code n!}, that is, the product of the first   {@code n} positiveintegers,  {@code 1} if {@code n == 0}, or   {@code n!}, or  {@link Double#POSITIVE_INFINITY} if {@code n! > Double.MAX_VALUE}. <p>The result is within 1 ulp of the true value.
 * @throws IllegalArgumentException if {@code n < 0}
 */
public static double factorial(int n){
  checkNonNegative("String_Node_Str",n);
  if (n > MAX_FACTORIAL) {
    return Double.POSITIVE_INFINITY;
  }
 else {
    double accum=1.0;
    for (int i=1 + (n & ~0xf); i <= n; i++) {
      accum*=i;
    }
    return accum * everySixteenthFactorial[n >> 4];
  }
}
Program: 60128
Project: 60128
Buggy source:
public void testDefaultExecutorIsShutdownWhenServiceFails() throws Exception {
  final CountDownLatch failureLatch=new CountDownLatch(1);
  AbstractScheduledService service=new AbstractScheduledService(){
    volatile ScheduledExecutorService executorService;
    @Override protected void runOneIteration() throws Exception {
    }
    @Override protected void startUp() throws Exception {
      throw new Exception("String_Node_Str");
    }
    @Override protected ScheduledExecutorService executor(){
      if (executorService == null) {
        executorService=super.executor();
        addListener(new Listener(){
          @Override public void failed(          State from,          Throwable failure){
            failureLatch.countDown();
          }
        }
,MoreExecutors.sameThreadExecutor());
      }
      return executorService;
    }
    @Override protected Scheduler scheduler(){
      return Scheduler.newFixedDelaySchedule(0,1,TimeUnit.MILLISECONDS);
    }
  }
;
  try {
    service.startAsync().awaitRunning();
    fail("String_Node_Str");
  }
 catch (  IllegalStateException expected) {
  }
  failureLatch.await();
  assertTrue(service.executor().isShutdown());
  assertTrue(service.executor().awaitTermination(100,TimeUnit.MILLISECONDS));
}

Fixed version (ground truth):
public void testDefaultExecutorIsShutdownWhenServiceFails() throws Exception {
  final AtomicReference<ScheduledExecutorService> executor=Atomics.newReference();
  AbstractScheduledService service=new AbstractScheduledService(){
    @Override protected void startUp() throws Exception {
      throw new Exception("String_Node_Str");
    }
    @Override protected void runOneIteration() throws Exception {
    }
    @Override protected ScheduledExecutorService executor(){
      executor.set(super.executor());
      return executor.get();
    }
    @Override protected Scheduler scheduler(){
      return Scheduler.newFixedDelaySchedule(0,1,TimeUnit.MILLISECONDS);
    }
  }
;
  try {
    service.startAsync().awaitRunning();
    fail("String_Node_Str");
  }
 catch (  IllegalStateException expected) {
  }
  assertTrue(executor.get().awaitTermination(100,TimeUnit.MILLISECONDS));
}
Program: 60129
Project: 60129
Buggy source:
public void testDefaultExecutorIsShutdownWhenServiceIsStopped() throws Exception {
  final CountDownLatch terminationLatch=new CountDownLatch(1);
  AbstractScheduledService service=new AbstractScheduledService(){
    volatile ScheduledExecutorService executorService;
    @Override protected void runOneIteration() throws Exception {
    }
    @Override protected ScheduledExecutorService executor(){
      if (executorService == null) {
        executorService=super.executor();
        addListener(new Listener(){
          @Override public void terminated(          State from){
            terminationLatch.countDown();
          }
        }
,MoreExecutors.sameThreadExecutor());
      }
      return executorService;
    }
    @Override protected Scheduler scheduler(){
      return Scheduler.newFixedDelaySchedule(0,1,TimeUnit.MILLISECONDS);
    }
  }
;
  service.startAsync();
  assertFalse(service.executor().isShutdown());
  service.awaitRunning();
  service.stopAsync();
  terminationLatch.await();
  assertTrue(service.executor().isShutdown());
  assertTrue(service.executor().awaitTermination(100,TimeUnit.MILLISECONDS));
}

Fixed version (ground truth):
public void testDefaultExecutorIsShutdownWhenServiceIsStopped() throws Exception {
  final AtomicReference<ScheduledExecutorService> executor=Atomics.newReference();
  AbstractScheduledService service=new AbstractScheduledService(){
    @Override protected void runOneIteration() throws Exception {
    }
    @Override protected ScheduledExecutorService executor(){
      executor.set(super.executor());
      return executor.get();
    }
    @Override protected Scheduler scheduler(){
      return Scheduler.newFixedDelaySchedule(0,1,TimeUnit.MILLISECONDS);
    }
  }
;
  service.startAsync();
  assertFalse(service.executor().isShutdown());
  service.awaitRunning();
  service.stopAsync();
  service.awaitTerminated();
  assertTrue(executor.get().awaitTermination(100,TimeUnit.MILLISECONDS));
}
Program: 60130
Project: 60130
Buggy source:
/** 
 * Copies bytes from this hash code into   {@code dest}.
 * @param dest the byte array into which the hash code will be written
 * @param offset the start offset in the data
 * @param maxLength the maximum number of bytes to write
 * @return the number of bytes written to {@code dest}
 * @throws IndexOutOfBoundsException if there is not enough room in {@code dest}
 */
public final int writeBytesTo(byte[] dest,int offset,int maxLength){
  maxLength=Ints.min(maxLength,bits() * 8);
  Preconditions.checkPositionIndexes(offset,offset + maxLength,dest.length);
  byte[] hash=asBytes();
  System.arraycopy(hash,0,dest,offset,maxLength);
  return maxLength;
}

Fixed version (ground truth):
/** 
 * Copies bytes from this hash code into   {@code dest}.
 * @param dest the byte array into which the hash code will be written
 * @param offset the start offset in the data
 * @param maxLength the maximum number of bytes to write
 * @return the number of bytes written to {@code dest}
 * @throws IndexOutOfBoundsException if there is not enough room in {@code dest}
 */
public final int writeBytesTo(byte[] dest,int offset,int maxLength){
  maxLength=Ints.min(maxLength,bits() / 8);
  Preconditions.checkPositionIndexes(offset,offset + maxLength,dest.length);
  byte[] hash=asBytes();
  System.arraycopy(hash,0,dest,offset,maxLength);
  return maxLength;
}
Program: 60131
Project: 60131
Buggy source:
private static <K,V>void assertSameEntries(List<ReferenceEntry<K,V>> expectedEntries,List<ReferenceEntry<K,V>> actualEntries){
  int size=expectedEntries.size();
  assertEquals(size,actualEntries.size());
  for (int i=0; i < size; i++) {
    ReferenceEntry<K,V> expectedEntry=expectedEntries.get(0);
    ReferenceEntry<K,V> actualEntry=actualEntries.get(0);
    assertSame(expectedEntry.getKey(),actualEntry.getKey());
    assertSame(expectedEntry.getValueReference().get(),actualEntry.getValueReference().get());
  }
}

Fixed version (ground truth):
private static <K,V>void assertSameEntries(List<ReferenceEntry<K,V>> expectedEntries,List<ReferenceEntry<K,V>> actualEntries){
  int size=expectedEntries.size();
  assertEquals(size,actualEntries.size());
  for (int i=0; i < size; i++) {
    ReferenceEntry<K,V> expectedEntry=expectedEntries.get(i);
    ReferenceEntry<K,V> actualEntry=actualEntries.get(i);
    assertSame(expectedEntry.getKey(),actualEntry.getKey());
    assertSame(expectedEntry.getValueReference().get(),actualEntry.getValueReference().get());
  }
}
Program: 60132
Project: 60132
Buggy source:
@Override public NavigableMap<K,Collection<V>> headMap(K toKey,boolean inclusive){
  return new NavigableAsMap(sortedMap().headMap(toKey,false));
}

Fixed version (ground truth):
@Override public NavigableMap<K,Collection<V>> headMap(K toKey,boolean inclusive){
  return new NavigableAsMap(sortedMap().headMap(toKey,inclusive));
}
Program: 60133
Project: 60133
Buggy source:
public <T>void testRejectTypeVariable_withOwnerType(){
  assertHasTypeVariable(new From<Integer>().new To<String>().type());
  assertHasTypeVariable(new From<T>().new To<String>().type());
  assertHasTypeVariable(new From<Integer>().new To<T>().type());
  assertHasTypeVariable(new From<Integer>(){
  }
.new To<String>().type());
  assertHasTypeVariable(new From<T>(){
  }
.new To<String>().type());
  assertNoTypeVariable(new From<Integer>().new To<String>(){
  }
.type());
  assertHasTypeVariable(new From<Integer>().new To<T>(){
  }
.type());
  assertNoTypeVariable(new From<Integer>(){
  }
.new To<String>(){
  }
.type());
  assertHasTypeVariable(new From<Integer>(){
  }
.new To<T>(){
  }
.type());
}

Fixed version (ground truth):
public <T>void testRejectTypeVariable_withOwnerType(){
  assertHasTypeVariable(new From<Integer>().new To<String>().type());
  assertHasTypeVariable(new From<T>().new To<String>().type());
  assertHasTypeVariable(new From<Integer>().new To<T>().type());
  assertHasTypeVariable(new From<Integer>(){
  }
.new To<String>().type());
  assertHasTypeVariable(new From<T>(){
  }
.new To<String>().type());
  assertNoTypeVariable(new From<Integer>().new To<String>(){
  }
.type());
  assertHasTypeVariable(new From<Integer>().new To<T>(){
  }
.type());
  assertHasTypeVariable(new From<T>().new To<String>(){
  }
.type());
  assertHasTypeVariable(new From<T>(){
  }
.new To<String>(){
  }
.type());
  assertNoTypeVariable(new From<Integer>(){
  }
.new To<String>(){
  }
.type());
  assertHasTypeVariable(new From<Integer>(){
  }
.new To<T>(){
  }
.type());
}
Program: 60134
Project: 60134
Buggy source:
/** 
 * Ensures that this type token doesn't contain type variables, which can cause unchecked type errors for callers like   {@link TypeToInstanceMap}.
 */
final TypeToken<T> rejectTypeVariables(){
  new TypeVisitor(){
    @Override void visitTypeVariable(    TypeVariable<?> type){
      throw new IllegalArgumentException(runtimeType + "String_Node_Str");
    }
    @Override void visitWildcardType(    WildcardType type){
      visit(type.getLowerBounds());
      visit(type.getUpperBounds());
    }
    @Override void visitParameterizedType(    ParameterizedType type){
      visit(type.getActualTypeArguments());
    }
    @Override void visitGenericArrayType(    GenericArrayType type){
      visit(type.getGenericComponentType());
    }
  }
.visit(runtimeType);
  return this;
}

Fixed version (ground truth):
/** 
 * Ensures that this type token doesn't contain type variables, which can cause unchecked type errors for callers like   {@link TypeToInstanceMap}.
 */
final TypeToken<T> rejectTypeVariables(){
  new TypeVisitor(){
    @Override void visitTypeVariable(    TypeVariable<?> type){
      throw new IllegalArgumentException(runtimeType + "String_Node_Str");
    }
    @Override void visitWildcardType(    WildcardType type){
      visit(type.getLowerBounds());
      visit(type.getUpperBounds());
    }
    @Override void visitParameterizedType(    ParameterizedType type){
      visit(type.getActualTypeArguments());
      visit(type.getOwnerType());
    }
    @Override void visitGenericArrayType(    GenericArrayType type){
      visit(type.getGenericComponentType());
    }
  }
.visit(runtimeType);
  return this;
}
Program: 60135
Project: 60135
Buggy source:
ListenableFuture<V> loadAsync(final K key,final int hash,final LoadingValueReference<K,V> loadingValueReference,CacheLoader<? super K,V> loader){
  final ListenableFuture<V> loadingFuture=loadingValueReference.loadFuture(key,loader);
  loadingFuture.addListener(new Runnable(){
    @Override public void run(){
      try {
        V newValue=getAndRecordStats(key,hash,loadingValueReference,loadingFuture);
        loadingValueReference.set(newValue);
      }
 catch (      Throwable t) {
        logger.log(Level.WARNING,"String_Node_Str",t);
        loadingValueReference.setException(t);
      }
    }
  }
,sameThreadExecutor);
  return loadingFuture;
}

Fixed version (ground truth):
ListenableFuture<V> loadAsync(final K key,final int hash,final LoadingValueReference<K,V> loadingValueReference,CacheLoader<? super K,V> loader){
  final ListenableFuture<V> loadingFuture=loadingValueReference.loadFuture(key,loader);
  loadingFuture.addListener(new Runnable(){
    @Override public void run(){
      try {
        V newValue=getAndRecordStats(key,hash,loadingValueReference,loadingFuture);
      }
 catch (      Throwable t) {
        logger.log(Level.WARNING,"String_Node_Str",t);
        loadingValueReference.setException(t);
      }
    }
  }
,sameThreadExecutor);
  return loadingFuture;
}
Program: 60136
Project: 60136
Buggy source:
public ListenableFuture<V> loadFuture(K key,CacheLoader<? super K,V> loader){
  stopwatch.start();
  V previousValue=oldValue.get();
  try {
    if (previousValue == null) {
      V newValue=loader.load(key);
      return set(newValue) ? futureValue : Futures.immediateFuture(newValue);
    }
 else {
      ListenableFuture<V> newValue=loader.reload(key,previousValue);
      return newValue != null ? newValue : Futures.<V>immediateFuture(null);
    }
  }
 catch (  Throwable t) {
    if (t instanceof InterruptedException) {
      Thread.currentThread().interrupt();
    }
    return setException(t) ? futureValue : fullyFailedFuture(t);
  }
}

Fixed version (ground truth):
public ListenableFuture<V> loadFuture(K key,CacheLoader<? super K,V> loader){
  stopwatch.start();
  V previousValue=oldValue.get();
  try {
    if (previousValue == null) {
      V newValue=loader.load(key);
      return set(newValue) ? futureValue : Futures.immediateFuture(newValue);
    }
    ListenableFuture<V> newValue=loader.reload(key,previousValue);
    if (newValue == null) {
      return Futures.immediateFuture(null);
    }
    return Futures.transform(newValue,new Function<V,V>(){
      @Override public V apply(      V newValue){
        LoadingValueReference.this.set(newValue);
        return newValue;
      }
    }
);
  }
 catch (  Throwable t) {
    if (t instanceof InterruptedException) {
      Thread.currentThread().interrupt();
    }
    return setException(t) ? futureValue : fullyFailedFuture(t);
  }
}
Program: 60137
Project: 60137
Buggy source:
@Override public void run(){
  try {
    V newValue=getAndRecordStats(key,hash,loadingValueReference,loadingFuture);
    loadingValueReference.set(newValue);
  }
 catch (  Throwable t) {
    logger.log(Level.WARNING,"String_Node_Str",t);
    loadingValueReference.setException(t);
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    V newValue=getAndRecordStats(key,hash,loadingValueReference,loadingFuture);
  }
 catch (  Throwable t) {
    logger.log(Level.WARNING,"String_Node_Str",t);
    loadingValueReference.setException(t);
  }
}
Program: 60138
Project: 60138
Buggy source:
/** 
 * @since 13.0
 */
@Override public final void addListener(Listener listener,Executor executor){
  checkNotNull(listener,"String_Node_Str");
  checkNotNull(executor,"String_Node_Str");
  lock.lock();
  try {
    if (snapshot.state != State.TERMINATED && snapshot.state != State.FAILED) {
      listeners.add(new ListenerExecutorPair(listener,executor));
    }
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
/** 
 * @since 13.0
 */
@Override public final void addListener(Listener listener,Executor executor){
  checkNotNull(listener,"String_Node_Str");
  checkNotNull(executor,"String_Node_Str");
  lock.lock();
  try {
    State currentState=state();
    if (currentState != State.TERMINATED && currentState != State.FAILED) {
      listeners.add(new ListenerExecutorPair(listener,executor));
    }
  }
  finally {
    lock.unlock();
  }
}