nus-yam/ex-repair huggingface dataset:
Program: 91598
Project: 91598
Buggy source:
/** 
 * Set an object field value using reflection.
 * @param fieldName the name of the field to be set
 * @param obj the object on which the value will be set
 * @param val the value to be set to the field
 * @param < T > the type of the object
 * @param < F > the type of the field value
 * @return the object that has the new value set on the field specified
 */
public static <T,F>T setField(String fieldName,T obj,F val){
  Class<?> cls=obj.getClass();
  try {
    Field f;
    try {
      f=cls.getDeclaredField(fieldName);
    }
 catch (    NoSuchFieldException e) {
      f=cls.getField(fieldName);
    }
    f.setAccessible(true);
    f.set(obj,val);
  }
 catch (  Exception e) {
    E.unexpected(e);
  }
  return obj;
}

Fixed version (ground truth):
/** 
 * Set an object field value using reflection.
 * @param fieldName the name of the field to be set
 * @param obj       the object on which the value will be set
 * @param val       the value to be set to the field
 * @param < T >       the type of the object
 * @param < F >       the type of the field value
 * @return the object that has the new value set on the field specified
 */
public static <T,F>T setField(String fieldName,T obj,F val){
  Class<?> cls=obj.getClass();
  try {
    Field f;
    try {
      f=cls.getDeclaredField(fieldName);
    }
 catch (    NoSuchFieldException e) {
      f=cls.getField(fieldName);
    }
    f.setAccessible(true);
    f.set(obj,val);
  }
 catch (  Exception e) {
    E.unexpected(e);
  }
  return obj;
}
Program: 91599
Project: 91599
Buggy source:
/** 
 * The type-safe version of   {@link #IDENTITY}
 * @since 0.2
 */
@SuppressWarnings("String_Node_Str") public static <T>F1<T,T> identity(){
  return IDENTITY;
}

Fixed version (ground truth):
/** 
 * The type-safe version of   {@link #IDENTITY}
 * @param < T > the element type
 * @return the identity function that always return the argument itself
 * @since 0.2
 */
@SuppressWarnings("String_Node_Str") public static <T>F1<T,T> identity(){
  return IDENTITY;
}
Program: 91600
Project: 91600
Buggy source:
public static <A,B>Tuple<A,B> Tuple(A a,B b){
  return new Tuple(a,b);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static <P1,P2>Tuple<P1,P2> Tuple(P1 a,P2 b){
  return new Tuple<P1,P2>(a,b);
}
Program: 91601
Project: 91601
Buggy source:
/** 
 * Returns a function that when applied, run   {@link Osgl.Option#runWith(Osgl.Function)}on this   {@code Option}
 */
public final F0<Void> runWith(final Function<? super T,?> consumer){
  return new F0<Void>(){
    @Override public Void apply() throws NotAppliedException, Break {
      Option.this.runWith(consumer);
      return null;
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Returns a function that when applied, run   {@link Osgl.Option#runWith(Osgl.Function)}on this   {@code Option}
 * @param consumer the function that consumes the element in this Option
 * @return a function that apply to {@code consumer} function if this Option is defined
 */
@SuppressWarnings("String_Node_Str") public final F0<Void> runWith(final Function<? super T,?> consumer){
  return new F0<Void>(){
    @Override public Void apply() throws NotAppliedException, Break {
      Option.this.runWith(consumer);
      return null;
    }
  }
;
}
Program: 91602
Project: 91602
Buggy source:
/** 
 * Alias of   {@link #gt(java.util.Comparator)}
 * @since 0.2
 */
public static <T>F2<T,T,Boolean> greaterThan(final Func2<? super T,? super T,Integer> c){
  return gt(c);
}

Fixed version (ground truth):
/** 
 * Alias of   {@link #gt(java.util.Comparator)}
 * @param c   a comparator function
 * @param < T > the element type
 * @return a function that use comparator function {@code c} to check if an object is greater than another
 * @since 0.2
 */
public static <T>F2<T,T,Boolean> greaterThan(final Func2<? super T,? super T,Integer> c){
  return gt(c);
}
Program: 91603
Project: 91603
Buggy source:
/** 
 * Construct a   {@link Comparator} with a function to extract the key of type U from given object of type T anda comparator to compare type U
 * @param keyExtractor the function to extract the key for comparison
 * @param keyComparator the {@link Comparator} that compares type U (the key type)
 * @param < T > the type of the object instance
 * @param < U > the type of the key extract from T
 * @return a comparator that compares type T objects
 */
public static <T,U>Comparator<T> comparing(final Function<? super T,? extends U> keyExtractor,final java.util.Comparator<? super U> keyComparator){
  E.NPE(keyExtractor,keyComparator);
  return new Comparator<T>(){
    @Override public int compare(    T o1,    T o2){
      return keyComparator.compare(keyExtractor.apply(o1),keyExtractor.apply(o2));
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Construct a   {@link Comparator} with a function to extract the key of type U from given object of type T anda comparator to compare type U
 * @param keyExtractor  the function to extract the key for comparison
 * @param keyComparator the {@link Comparator} that compares type U (the key type)
 * @param < T >           the type of the object instance
 * @param < U >           the type of the key extract from T
 * @return a comparator that compares type T objects
 */
public static <T,U>Comparator<T> comparing(final Function<? super T,? extends U> keyExtractor,final java.util.Comparator<? super U> keyComparator){
  E.NPE(keyExtractor,keyComparator);
  return new Comparator<T>(){
    @Override public int compare(    T o1,    T o2){
      return keyComparator.compare(keyExtractor.apply(o1),keyExtractor.apply(o2));
    }
  }
;
}
Program: 91604
Project: 91604
Buggy source:
public static <K,T>IndexedVisitor<K,T> indexGuardedVisitor(final Function<? super K,Boolean> guard,final Visitor<? super T> visitor){
  return new IndexedVisitor<K,T>(){
    @Override public void visit(    K id,    T t) throws Break {
      if (guard.apply(id)) {
        visitor.apply(t);
      }
    }
  }
;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static <K,T>IndexedVisitor<K,T> indexGuardedVisitor(final Function<? super K,Boolean> guard,final Visitor<? super T> visitor){
  return new IndexedVisitor<K,T>(){
    @Override public void visit(    K id,    T t) throws Break {
      if (guard.apply(id)) {
        visitor.apply(t);
      }
    }
  }
;
}
Program: 91605
Project: 91605
Buggy source:
/** 
 * The type-safe version of   {@link #NE}
 * @since 0.2
 */
@SuppressWarnings("String_Node_Str") public static <P1,P2>F2<P1,P2,Boolean> ne(){
  return NE;
}

Fixed version (ground truth):
/** 
 * The type-safe version of   {@link #NE}
 * @param < P1 > type of the first argument
 * @param < P2 > type of the second argument
 * @return the type-safe version of {@link #NE}
 * @since 0.2
 */
@SuppressWarnings("String_Node_Str") public static <P1,P2>F2<P1,P2,Boolean> ne(){
  return NE;
}
Program: 91606
Project: 91606
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public static <T>Predicate<T> generalPredicate(final Function<? super T,?> f1){
  if (f1 instanceof Predicate) {
    return (Predicate<T>)f1;
  }
  return new Predicate<T>(){
    @Override public boolean test(    T t){
      return bool(f1.apply(t));
    }
  }
;
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public static <T>Predicate<T> generalPredicate(final Function<? super T,?> f){
  if (f instanceof Predicate) {
    return (Predicate<T>)f;
  }
  return new Predicate<T>(){
    @Override public boolean test(    T t){
      return bool(f.apply(t));
    }
  }
;
}
Program: 91607
Project: 91607
Buggy source:
/** 
 * Convert a   {@code Function&lt;? super T, Void&gt;} function into a {@link Visitor}
 * @since 0.2
 */
@SuppressWarnings("String_Node_Str") public static <T>Visitor<T> visitor(final Function<? super T,?> f){
  if (f instanceof Visitor) {
    return (Visitor<T>)f;
  }
  return new Visitor<T>(){
    @Override public void visit(    T t) throws Break {
      f.apply(t);
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Convert a   {@code Function&lt;? super T, Void&gt;} function into a {@link Visitor}
 * @param f   the function to be cast
 * @param < T > the argument type
 * @return a {@link Visitor} type function that is equal with the function {@code f}
 * @since 0.2
 */
@SuppressWarnings("String_Node_Str") public static <T>Visitor<T> visitor(final Function<? super T,?> f){
  if (f instanceof Visitor) {
    return (Visitor<T>)f;
  }
  return new Visitor<T>(){
    @Override public void visit(    T t) throws Break {
      f.apply(t);
    }
  }
;
}
Program: 91608
Project: 91608
Buggy source:
/** 
 * A type-safe version of   {@link #FALSE}
 * @since 0.2
 */
@SuppressWarnings("String_Node_Str") public static <T>Predicate<T> no(){
  return FALSE;
}

Fixed version (ground truth):
/** 
 * A type-safe version of   {@link #FALSE}
 * @param < T > the argument type
 * @return a function that always return {@code false}
 * @since 0.2
 */
@SuppressWarnings("String_Node_Str") public static <T>Predicate<T> no(){
  return FALSE;
}
Program: 91609
Project: 91609
Buggy source:
/** 
 * The place sub class to implement the transform logic
 */
public abstract TO transform(FROM from);

Fixed version (ground truth):
/** 
 * The place sub class to implement the transform logic
 * @param from the element to be transformed
 * @return the transformed object
 */
public abstract TO transform(FROM from);
Program: 91610
Project: 91610
Buggy source:
/** 
 * Returns a composed   {@link Osgl.Predicate} function that for any given parameter, the test result is <code>true</code>only when any one of the specified predicates returns <code>true</code> when applied to the parameter
 * @param predicates an array of predicates that can be applied to a parameter and returns boolean value
 * @param < T >        the type of the parameter the predicates applied to
 * @return a composed function
 * @since 0.2
 */
public static <T>Predicate<T> or(final Function<? super T,Boolean>... predicates){
  return null;
}

Fixed version (ground truth):
/** 
 * Returns a composed   {@link Osgl.Predicate} function that for any given parameter, the test result is <code>true</code>when any one of the specified predicates returns <code>true</code> on the parameter
 * @param predicates an array of predicates that can be applied to a parameter and returns boolean value
 * @param < T >        the type of the parameter the predicates applied to
 * @return a composed function
 * @since 0.2
 */
public static <T>Predicate<T> or(final Function<? super T,Boolean>... predicates){
  return or(C.listOf(predicates));
}
Program: 91611
Project: 91611
Buggy source:
/** 
 * Alias of   {@link #or(Osgl.Function[])}
 * @since 0.2
 */
public static <T>Predicate<T> any(final Function<? super T,Boolean>... predicates){
  return or(predicates);
}

Fixed version (ground truth):
/** 
 * Alias of   {@link #or(Osgl.Function[])}
 * @param predicates an array of predicate functions
 * @param < T >        the argument type
 * @return the function that returns {@code true} if any one of the predicate functionreturns  {@code true}
 * @since 0.2
 */
public static <T>Predicate<T> any(final Function<? super T,Boolean>... predicates){
  return or(predicates);
}
Program: 91612
Project: 91612
Buggy source:
/** 
 * Execute callback asynchronously after delay specified
 * @param callback the callback function to be executed
 * @param milliseconds the delay
 * @param < T > return type
 * @return the result of the callback
 */
public static <T>Future<T> async(final Osgl.F0<T> callback,final int milliseconds){
  return _exec.submit(new Callable<T>(){
    @Override public T call() throws Exception {
      Thread.sleep(milliseconds);
      return callback.apply();
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Execute callback asynchronously after delay specified
 * @param callback     the callback function to be executed
 * @param milliseconds the delay
 * @param < T >          return type
 * @return the result of the callback
 */
public static <T>Future<T> async(final Osgl.F0<T> callback,final int milliseconds){
  return _exec.submit(new Callable<T>(){
    @Override public T call() throws Exception {
      Thread.sleep(milliseconds);
      return callback.apply();
    }
  }
);
}
Program: 91613
Project: 91613
Buggy source:
/** 
 * Returns a predicate function that check if the argument is contained in the collection specified
 * @param c the collection to be checked on against the argument when applying the prediate
 * @param < T > the generic type of the element of the collection
 * @return a predicate function
 */
public static <T>$.Predicate<T> containsIn(final Collection<? super T> c){
  return new $.Predicate<T>(){
    @Override public boolean test(    T t) throws NotAppliedException, $.Break {
      return c.contains(t);
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Returns a predicate function that check if the argument is contained in the collection specified
 * @param collection the collection to be checked on against the argument when applying the prediate
 * @param < T > the generic type of the element of the collection
 * @return a predicate function
 * @see {@link Collection#contains(Object)}
 */
public static <T>$.Predicate<T> containsIn(final Collection<? super T> collection){
  return new $.Predicate<T>(){
    @Override public boolean test(    T t) throws NotAppliedException, $.Break {
      return collection.contains(t);
    }
  }
;
}
Program: 91614
Project: 91614
Buggy source:
public static <T>$.Predicate<Collection<? super T>> removeAllFrom(final Iterable<? extends T> c){
  return new $.Predicate<Collection<? super T>>(){
    @Override public boolean test(    Collection<? super T> c1) throws NotAppliedException, $.Break {
      if (c instanceof Collection) {
        return c1.removeAll((Collection<?>)c);
      }
      HashSet<T> s=new HashSet<T>();
      for (      T t : c) {
        s.add(t);
      }
      return c1.removeAll(s);
    }
  }
;
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public static <T>$.Predicate<Iterable<T>> removeAllFrom(final Collection<? super T> collection){
  return new $.Predicate<Iterable<T>>(){
    @Override public boolean test(    Iterable<T> iterable){
      if (iterable instanceof Collection) {
        return collection.removeAll((Collection)iterable);
      }
      boolean modified=false;
      for (      T t : iterable) {
        boolean b=collection.remove(t);
        modified=modified || b;
      }
      return modified;
    }
  }
;
}
Program: 91615
Project: 91615
Buggy source:
public static $.F1<?,Boolean> removeFrom(final Collection<?> c){
  return new $.F1<Object,Boolean>(){
    @Override public Boolean apply(    Object t) throws NotAppliedException, $.Break {
      return c.remove(t);
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Returns a function that remove the argument from a collection specified. <p>The function returns   {@code true} if argument removed successfully or{@code false} otherwise</p>
 * @param collection the collection from which the argument to be removedwhen applying the function returned
 * @return the function that remove element from the collection
 * @see Collection#remove(Object)
 */
@SuppressWarnings("String_Node_Str") public static $.Predicate<?> removeFrom(final Collection<?> collection){
  return new $.Predicate<Object>(){
    @Override public boolean test(    Object t) throws NotAppliedException, $.Break {
      return collection.remove(t);
    }
  }
;
}
Program: 91616
Project: 91616
Buggy source:
public static <T>$.F1<T,Sequence<? super T>> prependTo(final Sequence<? super T> c){
  return new $.F1<T,Sequence<? super T>>(){
    @Override public Sequence<? super T> apply(    T t) throws NotAppliedException, $.Break {
      c.prepend(t);
      return c;
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Returns a function that prepend the argument to a   {@link Sequence} specified
 * @param sequence the sequence to which the argument shall be prepend whene applying the function
 * @param < T > the generic type of the argument/sequence element
 * @return the function that do the prepend operation
 */
@SuppressWarnings("String_Node_Str") public static <T>$.F1<T,Sequence<? super T>> prependTo(final Sequence<? super T> sequence){
  return new $.F1<T,Sequence<? super T>>(){
    @Override public Sequence<? super T> apply(    T t) throws NotAppliedException, $.Break {
      sequence.prepend(t);
      return sequence;
    }
  }
;
}
Program: 91617
Project: 91617
Buggy source:
public static <T>$.Predicate<Iterable<? extends T>> addAllTo(final List<? super T> l,final int index){
  if (0 > index || l.size() < index) {
    throw new IndexOutOfBoundsException();
  }
  return new $.Predicate<Iterable<? extends T>>(){
    @Override public boolean test(    Iterable<? extends T> itr) throws NotAppliedException, $.Break {
      if (itr instanceof Collection) {
        return l.addAll(index,((Collection<? extends T>)itr));
      }
      boolean modified=false;
      for (      T t : itr) {
        l.add(index,t);
        modified=true;
      }
      return modified;
    }
  }
;
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public static <T>$.Predicate<Iterable<? extends T>> addAllTo(final List<? super T> list,final int index){
  if (0 > index || list.size() < index) {
    throw new IndexOutOfBoundsException();
  }
  return new $.Predicate<Iterable<? extends T>>(){
    @Override public boolean test(    Iterable<? extends T> itr) throws NotAppliedException, $.Break {
      if (itr instanceof Collection) {
        return list.addAll(index,((Collection<? extends T>)itr));
      }
      boolean modified=false;
      for (      T t : itr) {
        list.add(index,t);
        modified=true;
      }
      return modified;
    }
  }
;
}
Program: 91618
Project: 91618
Buggy source:
/** 
 * Returns a function that add the argument into the specified list at specified position. the function returns   {@code true} if added successfully or {@code false} otherwise
 * @param c a list into which the argument to be added
 * @param index specify the position where the argument can be added
 * @param < C > the generic type of the list
 * @param < T > the generic type of the list element
 * @return the function that do the add operation
 */
@SuppressWarnings("String_Node_Str") public static <C extends List<? super T>,T>$.F1<T,C> addTo(final C c,final int index){
  return new $.F1<T,C>(){
    @Override public C apply(    T t) throws NotAppliedException, $.Break {
      c.add(index,t);
      return c;
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Returns a function that add the argument into the specified list at specified position. the function returns   {@code true} if added successfully or {@code false} otherwise
 * @param list a list into which the argument to be added
 * @param index specify the position where the argument can be added
 * @param < L > the generic type of the list
 * @param < T > the generic type of the list element
 * @return the function that do the add operation
 * @see {@link java.util.List#add(int,Object)}
 */
@SuppressWarnings("String_Node_Str") public static <L extends List<? super T>,T>$.F1<T,L> addTo(final L list,final int index){
  return new $.F1<T,L>(){
    @Override public L apply(    T t) throws NotAppliedException, $.Break {
      list.add(index,t);
      return list;
    }
  }
;
}
Program: 91619
Project: 91619
Buggy source:
@Override public boolean test(Collection<? super T> c1) throws NotAppliedException, $.Break {
  if (c instanceof Collection) {
    return c1.retainAll((Collection)c);
  }
  HashSet<T> s=new HashSet<T>();
  for (  T t : c) {
    s.add(t);
  }
  return c1.retainAll(s);
}

Fixed version (ground truth):
@Override public boolean test(Iterable<T> iterable){
  if (iterable instanceof Collection) {
    return collection.retainAll((Collection)iterable);
  }
  List<T> list=C.list(iterable);
  return collection.retainAll(list);
}
Program: 91620
Project: 91620
Buggy source:
public static <T>$.Predicate<? extends Collection<? super T>> retainAllIn(final Iterable<? extends T> c){
  return new $.Predicate<Collection<? super T>>(){
    @Override public boolean test(    Collection<? super T> c1) throws NotAppliedException, $.Break {
      if (c instanceof Collection) {
        return c1.retainAll((Collection)c);
      }
      HashSet<T> s=new HashSet<T>();
      for (      T t : c) {
        s.add(t);
      }
      return c1.retainAll(s);
    }
  }
;
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public static <T>$.Predicate<Iterable<T>> retainAllIn(final Collection<? super T> collection){
  return new $.Predicate<Iterable<T>>(){
    @Override public boolean test(    Iterable<T> iterable){
      if (iterable instanceof Collection) {
        return collection.retainAll((Collection)iterable);
      }
      List<T> list=C.list(iterable);
      return collection.retainAll(list);
    }
  }
;
}
Program: 91621
Project: 91621
Buggy source:
public static <T>$.F1<T,Sequence<? super T>> appendTo(final Sequence<? super T> c){
  return new $.F1<T,Sequence<? super T>>(){
    @Override public Sequence<? super T> apply(    T t) throws NotAppliedException, $.Break {
      c.append(t);
      return c;
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Returns a function that append the argument to a   {@link Sequence} specified<p><b>Note</b> the function returns the sequence with the argument been removed</p>
 * @param sequence the sequence to which the argument shall be append when applying the function
 * @param < T > the generic type of the argument/sequence element
 * @return the function that do the append operation
 */
@SuppressWarnings("String_Node_Str") public static <T>$.F1<T,Sequence<? super T>> appendTo(final Sequence<? super T> sequence){
  return new $.F1<T,Sequence<? super T>>(){
    @Override public Sequence<? super T> apply(    T t) throws NotAppliedException, $.Break {
      sequence.append(t);
      return sequence;
    }
  }
;
}
Program: 91622
Project: 91622
Buggy source:
@Test(expected=NotAppliedException.class) public void byDefaultInverseShallThrowOutNotAppliedException(){
  toLowerCase.inverse();
}

Fixed version (ground truth):
@Test(expected=NotAppliedException.class) public void byDefaultInverseShallThrowOutNotAppliedException(){
  toLowerCase.invert();
}
Program: 91623
Project: 91623
Buggy source:
public static UnsupportedException tbd(String info){
  return tbd();
}

Fixed version (ground truth):
public static UnsupportedException tbd(String feature){
  throw new UnsupportedException("String_Node_Str",feature);
}
Program: 91624
Project: 91624
Buggy source:
private EmptyList(){
  super((T[])new Object[]{});
}

Fixed version (ground truth):
private EmptyList(){
  super((T[])new Object[0]);
}
Program: 91625
Project: 91625
Buggy source:
@Test public void testRevertBeginPointer(){
  final String s="String_Node_Str";
  char[] buf=Unsafe.bufOf(s);
  FastStr fs=FastStr.unsafeOf(s);
  assertSame(buf,Unsafe.bufOf(fs));
  fs=fs.afterFirst("String_Node_Str").afterFirst('/');
  ceq(fs,"String_Node_Str");
  assertSame(buf,Unsafe.bufOf(fs));
  FastStr fs0=fs.prepend('/');
  ceq(fs0,"String_Node_Str");
  assertSame(buf,Unsafe.bufOf(fs0));
  fs0=fs.prepend("String_Node_Str");
  assertSame(buf,Unsafe.bufOf(fs0));
  ceq(fs0,"String_Node_Str");
}

Fixed version (ground truth):
@Test public void testRevertBeginPointer(){
  final String s="String_Node_Str";
  char[] buf=Unsafe.bufOf(s);
  FastStr fs=FastStr.unsafeOf(s);
  fs=fs.afterFirst("String_Node_Str").afterFirst('/');
  ceq(fs,"String_Node_Str");
  FastStr fs0=fs.prepend('/');
  ceq(fs0,"String_Node_Str");
  fs0=fs.prepend("String_Node_Str");
  ceq(fs0,"String_Node_Str");
}
Program: 91626
Project: 91626
Buggy source:
public static void main(String[] args){
  None<String> none=none();
  System.out.println(none);
  F1<String,Integer> hc=_.F.hc();
  System.out.println(hc.apply("String_Node_Str"));
  F1<Integer,String> toString=_.F.asString();
  System.out.println(toString.apply(33));
  F0<String> f0=_.F0;
  System.out.println(f0.apply());
}

Fixed version (ground truth):
public static void main(String[] args){
  None<String> none=none();
  System.out.println(none);
  F1<String,Integer> hc=_.F.hc();
  System.out.println(hc.apply("String_Node_Str"));
  F1<Integer,String> toString=_.F.asString();
  System.out.println(toString.apply(33));
  F0<String> f0=_.F0;
  System.out.println(f0.apply());
  ListBuilder<String> lb=ListBuilder.create();
  List<String> l=lb.toList();
  System.out.println(l.size());
}
Program: 91627
Project: 91627
Buggy source:
@Override public T get(int index){
  return data.get(size() - index);
}

Fixed version (ground truth):
@Override public T get(int index){
  return data.get(size() - index - 1);
}
Program: 91628
Project: 91628
Buggy source:
@Override public Character next(){
  if (cursor >= len) {
    throw new NoSuchElementException();
  }
  return s.charAt(++cursor);
}

Fixed version (ground truth):
@Override public Character next(){
  if (cursor >= len) {
    throw new NoSuchElementException();
  }
  return s.charAt(cursor++);
}
Program: 91629
Project: 91629
Buggy source:
@Override public C.List<T> dropWhile(_.Function<? super T,Boolean> predicate){
  boolean immutable=isImmutable();
  int sz=size();
  if (immutable) {
    if (0 == sz) {
      return Nil.list();
    }
    ListBuilder<T> lb=new ListBuilder<T>(sz);
    for (    T t : this) {
      if (predicate.apply(t)) {
        lb.add(t);
      }
 else {
        break;
      }
    }
    return lb.toList();
  }
 else {
    if (0 == sz) {
      return C.newList();
    }
    C.List<T> l=C.newSizedList(sz);
    for (    T t : this) {
      if (predicate.apply(t)) {
        l.add(t);
      }
 else {
        break;
      }
    }
    return l;
  }
}

Fixed version (ground truth):
@Override public C.List<T> dropWhile(_.Function<? super T,Boolean> predicate){
  boolean immutable=isImmutable();
  int sz=size();
  if (immutable) {
    if (0 == sz) {
      return Nil.list();
    }
    ListBuilder<T> lb=new ListBuilder<T>(sz);
    boolean found=false;
    for (    T t : this) {
      if (!found && predicate.apply(t)) {
        continue;
      }
 else {
        found=true;
        lb.add(t);
      }
    }
    return lb.toList();
  }
 else {
    if (0 == sz) {
      return C.newList();
    }
    C.List<T> l=C.newSizedList(sz);
    boolean found=false;
    for (    T t : this) {
      if (!found && predicate.apply(t)) {
        continue;
      }
 else {
        found=true;
        l.add(t);
      }
    }
    return l;
  }
}
Program: 91630
Project: 91630
Buggy source:
@Test public void testCurry2(){
  eq(rand1 / rand2,divide.curry(rand1,rand2).apply().doubleValue());
}

Fixed version (ground truth):
@Test public void testCurry2(){
  eq(RAND_1 / RAND_2,divide.curry(RAND_1,RAND_2).apply().doubleValue());
}
Program: 91631
Project: 91631
Buggy source:
@Test public void testChainedStyleAndThen(){
  eq(-1 * (rand1 / rand2),divide.andThen(negative).apply(rand1,rand2).doubleValue());
}

Fixed version (ground truth):
@Test public void testChainedStyleAndThen(){
  eq(-1 * (RAND_1 / RAND_2),divide.andThen(NEGATIVE).apply(RAND_1,RAND_2).doubleValue());
}
Program: 91632
Project: 91632
Buggy source:
@Test public void liftedFunctionShallNotBeDefinedInCaseNotApplied(){
  yes(divide.lift().apply(rand1,0).notDefined());
}

Fixed version (ground truth):
@Test public void liftedFunctionShallNotBeDefinedInCaseNotApplied(){
  yes(divide.lift().apply(RAND_1,0).notDefined());
}
Program: 91633
Project: 91633
Buggy source:
@Test public void elseShallNotBeCalledNormally(){
  eq(rand1 / rand2,divide.applyOrElse(rand1,rand2,inCaseFailed).doubleValue());
  eq(rand1 / rand2,divide.orElse(inCaseFailed).apply(rand1,rand2).doubleValue());
}

Fixed version (ground truth):
@Test public void elseShallNotBeCalledNormally(){
  eq(RAND_1 / RAND_2,divide.applyOrElse(RAND_1,RAND_2,inCaseFailed).doubleValue());
  eq(RAND_1 / RAND_2,divide.orElse(inCaseFailed).apply(RAND_1,RAND_2).doubleValue());
}
Program: 91634
Project: 91634
Buggy source:
@Test public void liftedFunctionShallBeDefinedInNormalCase(){
  yes(divide.lift().apply(rand1,rand2).isDefined());
}

Fixed version (ground truth):
@Test public void liftedFunctionShallBeDefinedInNormalCase(){
  yes(divide.lift().apply(RAND_1,RAND_2).isDefined());
}
Program: 91635
Project: 91635
Buggy source:
@Test public void testCurry(){
  eq(rand1 / rand2,divide.curry(rand2).apply(rand1).doubleValue());
}

Fixed version (ground truth):
@Test public void testCurry(){
  eq(RAND_1 / RAND_2,divide.curry(RAND_2).apply(RAND_1).doubleValue());
}
Program: 91636
Project: 91636
Buggy source:
@Test public void elseShallBeCalledInCaseNotApplied(){
  eq(ERROR_VAL,divide.applyOrElse(rand1,0,inCaseFailed).doubleValue());
  eq(ERROR_VAL,divide.orElse(inCaseFailed).apply(rand1,0).doubleValue());
}

Fixed version (ground truth):
@Test public void elseShallBeCalledInCaseNotApplied(){
  eq(ERROR_VAL,divide.applyOrElse(RAND_1,0,inCaseFailed).doubleValue());
  eq(ERROR_VAL,divide.orElse(inCaseFailed).apply(RAND_1,0).doubleValue());
}
Program: 91637
Project: 91637
Buggy source:
@Test public void lastFunctionWinForListStyleAndThen(){
  eq(rand1 * rand2,divide.andThen(multiply).apply(rand1,rand2).doubleValue());
}

Fixed version (ground truth):
@Test public void lastFunctionWinForListStyleAndThen(){
  eq(RAND_1 * RAND_2,divide.andThen(multiply).apply(RAND_1,RAND_2).doubleValue());
}
Program: 91638
Project: 91638
Buggy source:
@Override public V remove(Object key){
  return remove(key);
}

Fixed version (ground truth):
@Override public V remove(Object key){
  return _m.remove(key);
}
Program: 91639
Project: 91639
Buggy source:
@Override public C.List<Character> prepend(Character character){
  StringBuilder sb=new StringBuilder(character).append(s);
  return of(sb);
}

Fixed version (ground truth):
public Str prepend(String s){
  if ("String_Node_Str".equals(s)) {
    return this;
  }
  if (EMPTY_STR.equals(this)) {
    return of(s);
  }
  return of(s.concat(this.s));
}
Program: 91640
Project: 91640
Buggy source:
public Str append(String s){
  if ("String_Node_Str".equals(s)) {
    return this;
  }
  if (EMPTY_STR.equals(this)) {
    return of(s);
  }
  return of(s.concat(s));
}

Fixed version (ground truth):
public Str append(String s){
  if ("String_Node_Str".equals(s)) {
    return this;
  }
  if (EMPTY_STR.equals(this)) {
    return of(s);
  }
  return of(this.s.concat(s));
}
Program: 91641
Project: 91641
Buggy source:
private void reverseTCP(){
  try {
    String lhost=LHOST.substring(4);
    String lport=LPORT.substring(4).trim();
    Socket msgsock=new Socket(lhost,Integer.parseInt(lport));
    DataInputStream in=new DataInputStream(msgsock.getInputStream());
    OutputStream out=new DataOutputStream(msgsock.getOutputStream());
    new LoadStage().start(in,out,this,new String[]{});
    msgsock.close();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
private void reverseTCP(){
  try {
    String lhost=LHOST.substring(4).trim();
    String lport=LPORT.substring(4).trim();
    Socket msgsock=new Socket(lhost,Integer.parseInt(lport));
    DataInputStream in=new DataInputStream(msgsock.getInputStream());
    OutputStream out=new DataOutputStream(msgsock.getOutputStream());
    new LoadStage().start(in,out,this,new String[]{});
    msgsock.close();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 91642
Project: 91642
Buggy source:
/** 
 * Ensures that the given dimension is equals to the expected value. If not, throws an exception.
 * @param argument  the name of the argument being tested.
 * @param dimension the dimension of the argument value.
 * @param expected  the expected dimension.
 */
private static void ensureDimensionMatches(final String argument,final int dimension,final int expected) throws MismatchedDimensionException {
  if (dimension != expected) {
    throw new MismatchedDimensionException(Errors.format(Errors.Keys.MismatchedDimension_3,argument,dimension,expected));
  }
}

Fixed version (ground truth):
/** 
 * Ensures that the given dimension is equals to the expected value. If not, throws an exception.
 * @param argument  the name of the argument being tested.
 * @param expected  the expected number of dimension.
 * @param dimension the actual dimension of the argument value.
 */
private static void ensureDimensionMatches(final String argument,final int expected,final int dimension) throws MismatchedDimensionException {
  if (dimension != expected) {
    throw new MismatchedDimensionException(Errors.format(Errors.Keys.MismatchedDimension_3,argument,expected,dimension));
  }
}
Program: 91644
Project: 91644
Buggy source:
/** 
 * Returns the grid geometry for this image.
 */
@Override public GridGeometry getGridGeometry() throws DataStoreContentException {
  if (referencing != null) {
    GridGeometry gridGeometry=referencing.gridGeometry;
    if (gridGeometry == null)     try {
      gridGeometry=referencing.build(extent());
    }
 catch (    FactoryException e) {
      throw new DataStoreContentException(reader.resources().getString(Resources.Keys.CanNotComputeGridGeometry_1,filename(),e));
    }
    return gridGeometry;
  }
 else {
    return new GridGeometry(extent(),null);
  }
}

Fixed version (ground truth):
/** 
 * Returns the grid geometry for this image.
 */
@Override public GridGeometry getGridGeometry() throws DataStoreContentException {
  if (referencing != null) {
    GridGeometry gridGeometry=referencing.gridGeometry;
    if (gridGeometry == null)     try {
      gridGeometry=referencing.build(extent());
    }
 catch (    FactoryException e) {
      throw new DataStoreContentException(reader.resources().getString(Resources.Keys.CanNotComputeGridGeometry_1,filename()),e);
    }
    return gridGeometry;
  }
 else {
    return new GridGeometry(extent(),null);
  }
}
Program: 91646
Project: 91646
Buggy source:
/** 
 * Appends a value in a   {@code SELECT} statement.The  {@code "="} string will be inserted before the value.
 * @param value  the value to append, or {@code null}.
 * @return this builder, for method call chaining.
 */
public final SQLBuilder appendCondition(final Object value){
  if (value == null) {
    buffer.append("String_Node_Str");
    return this;
  }
  buffer.append('=');
  return appendValue(value);
}

Fixed version (ground truth):
/** 
 * Appends a value in a   {@code SELECT} statement.The  {@code "="} string will be inserted before the value.
 * @param value  the value to append, or {@code null}.
 * @return this builder, for method call chaining.
 * @throws FactoryException if an error occurred while using the geodetic database.
 */
public final SQLBuilder appendCondition(final Object value) throws FactoryException {
  if (value == null) {
    buffer.append("String_Node_Str");
    return this;
  }
  buffer.append('=');
  return appendValue(value);
}
Program: 91647
Project: 91647
Buggy source:
/** 
 * Appends a value in an   {@code INSERT} statement.
 * @param value  the value to append, or {@code null}.
 * @return this builder, for method call chaining.
 */
public final SQLBuilder appendValue(final Object value){
  if (value == null) {
    buffer.append("String_Node_Str");
  }
 else   if (value instanceof Boolean) {
    buffer.append((Boolean)value ? "String_Node_Str" : "String_Node_Str");
  }
 else   if (value instanceof Number) {
    buffer.append(value);
  }
 else {
    buffer.append('\'').append(doubleQuotes(value)).append('\'');
  }
  return this;
}

Fixed version (ground truth):
/** 
 * Appends a value in an   {@code INSERT} statement.
 * @param value  the value to append, or {@code null}.
 * @return this builder, for method call chaining.
 * @throws FactoryException if an error occurred while using the geodetic database.
 */
public final SQLBuilder appendValue(Object value) throws FactoryException {
  if (value == null) {
    buffer.append("String_Node_Str");
  }
 else   if (value instanceof Boolean) {
    buffer.append((Boolean)value ? "String_Node_Str" : "String_Node_Str");
  }
 else   if (value instanceof Number) {
    buffer.append(value);
  }
 else {
    if (value instanceof IdentifiedObject) {
      value=ReferencingServices.getInstance().getPreferredIdentifier((IdentifiedObject)value);
    }
    buffer.append('\'').append(doubleQuotes(value)).append('\'');
  }
  return this;
}
Program: 91648
Project: 91648
Buggy source:
/** 
 * Returns a potentially deep copy of the given metadata object.
 * @param metadata   the metadata object to copy.
 * @param copier     contains a map of metadata objects already copied.
 * @return a copy of the given metadata object, or {@code metadata} itself if there isno known implementation class or that implementation has no setter method.
 * @throws Exception if an error occurred while creating the copy. This include anychecked checked exception that the no-argument constructor may throw.
 */
final Object copy(final Object metadata,final MetadataCopier copier) throws Exception {
  if (setters == null) {
    return metadata;
  }
  Object copy=copier.copies.get(metadata);
  if (copy == null) {
    copy=implementation.newInstance();
    copier.copies.put(metadata,copy);
    final Object[] arguments=new Object[1];
    for (int i=0; i < allCount; i++) {
      final Method setter=setters[i];
      if (setter != null && !setter.isAnnotationPresent(Deprecated.class)) {
        Object value=get(getters[i],metadata);
        if (value != null) {
          value=copier.copyAny(elementTypes[i],value);
          if (value != null) {
            arguments[0]=value;
            set(setter,copy,arguments);
          }
        }
      }
    }
  }
  return copy;
}

Fixed version (ground truth):
/** 
 * Returns a potentially deep copy of the given metadata object.
 * @param metadata   the metadata object to copy.
 * @param copier     contains a map of metadata objects already copied.
 * @return a copy of the given metadata object, or {@code metadata} itself if there isno known implementation class or that implementation has no setter method.
 * @throws Exception if an error occurred while creating the copy. This include anychecked checked exception that the no-argument constructor may throw.
 */
final Object copy(final Object metadata,final MetadataCopier copier) throws Exception {
  if (setters == null) {
    return metadata;
  }
  Object copy=copier.copies.get(metadata);
  if (copy == null) {
    copy=implementation.getConstructor().newInstance();
    copier.copies.put(metadata,copy);
    final Object[] arguments=new Object[1];
    for (int i=0; i < allCount; i++) {
      final Method setter=setters[i];
      if (setter != null && !setter.isAnnotationPresent(Deprecated.class)) {
        Object value=get(getters[i],metadata);
        if (value != null) {
          value=copier.copyAny(elementTypes[i],value);
          if (value != null) {
            arguments[0]=value;
            set(setter,copy,arguments);
          }
        }
      }
    }
  }
  return copy;
}
Program: 91649
Project: 91649
Buggy source:
/** 
 * Sets the unique identifier for this metadata record.
 * @param newValue  the new identifier, or {@code null} if none.
 * @since 0.5
 */
public void setMetadataIdentifier(final Identifier newValue){
  checkWritePermission();
  metadataIdentifier=newValue;
}

Fixed version (ground truth):
/** 
 * Sets the unique identifier for this metadata record.
 * @param newValue  the new identifier, or {@code null} if none.
 * @since 0.5
 */
public void setMetadataIdentifier(final Identifier newValue){
  checkWritePermission();
  identifiers=nonNullCollection(identifiers,Identifier.class);
  NonMarshalledAuthority.setMarshallable(identifiers,newValue);
}
Program: 91651
Project: 91651
Buggy source:
/** 
 * Returns a unique identifier for this metadata record. <div class="note"><b>Note:</b> OGC 07-045 (Catalog Service Specification — ISO metadata application profile) recommends usage of a UUID (Universal Unique Identifier) as specified by <a href="http://www.ietf.org">IETF</a> to ensure identifier’s uniqueness.</div>
 * @return unique identifier for this metadata record, or {@code null}.
 * @since 0.5
 */
@Override @XmlElement(name="String_Node_Str") @XmlJavaTypeAdapter(MD_Identifier.Since2014.class) public Identifier getMetadataIdentifier(){
  return metadataIdentifier;
}

Fixed version (ground truth):
/** 
 * Returns a unique identifier for this metadata record. <div class="note"><b>Note:</b> OGC 07-045 (Catalog Service Specification — ISO metadata application profile) recommends usage of a UUID (Universal Unique Identifier) as specified by <a href="http://www.ietf.org">IETF</a> to ensure identifier’s uniqueness.</div>
 * @return unique identifier for this metadata record, or {@code null}.
 * @since 0.5
 */
@Override @XmlElement(name="String_Node_Str") @XmlJavaTypeAdapter(MD_Identifier.Since2014.class) public Identifier getMetadataIdentifier(){
  return NonMarshalledAuthority.getMarshallable(identifiers);
}
Program: 91652
Project: 91652
Buggy source:
/** 
 * Sets the unique identifier for this metadata file.
 * @param newValue  the new identifier, or {@code null} if none.
 * @deprecated As of ISO 19115:2014, replaced by {@link #setMetadataIdentifier(Identifier)}
 */
@Deprecated public void setFileIdentifier(final String newValue){
  DefaultIdentifier identifier=DefaultIdentifier.castOrCopy(metadataIdentifier);
  if (identifier == null) {
    if (newValue == null)     return;
    identifier=new DefaultIdentifier();
  }
  identifier.setCode(newValue);
  if (newValue == null && (identifier instanceof AbstractMetadata) && ((AbstractMetadata)identifier).isEmpty()) {
    identifier=null;
  }
  setMetadataIdentifier(identifier);
}

Fixed version (ground truth):
/** 
 * Sets the unique identifier for this metadata file.
 * @param newValue  the new identifier, or {@code null} if none.
 * @deprecated As of ISO 19115:2014, replaced by {@link #setMetadataIdentifier(Identifier)}
 */
@Deprecated public void setFileIdentifier(final String newValue){
  DefaultIdentifier identifier=DefaultIdentifier.castOrCopy(NonMarshalledAuthority.getMarshallable(identifiers));
  if (identifier == null) {
    if (newValue == null)     return;
    identifier=new DefaultIdentifier();
  }
  identifier.setCode(newValue);
  if (newValue == null && (identifier instanceof AbstractMetadata) && ((AbstractMetadata)identifier).isEmpty()) {
    identifier=null;
  }
  setMetadataIdentifier(identifier);
}
Program: 91654
Project: 91654
Buggy source:
/** 
 * Searches for the given metadata in the database. If such metadata is found, then its identifier (primary key) is returned. Otherwise this method returns   {@code null}.
 * @param table     the table where to search.
 * @param columns   the table columns as given by {@link #getExistingColumns(String)}, or   {@code null}.
 * @param metadata  a map view of the metadata to search for.
 * @param stmt      the statement to use for executing the query.
 * @param helper    an helper class for creating the SQL query.
 * @return the identifier of the given metadata, or {@code null} if none.
 * @throws SQLException if an error occurred while searching in the database.
 */
final String search(final String table,Set<String> columns,final Map<String,Object> metadata,final Statement stmt,final SQLBuilder helper) throws SQLException {
}

Fixed version (ground truth):
/** 
 * Searches for the given metadata in the database. If such metadata is found, then its identifier (primary key) is returned. Otherwise this method returns   {@code null}.
 * @param table     the table where to search.
 * @param columns   the table columns as given by {@link #getExistingColumns(String)}, or   {@code null}.
 * @param metadata  a map view of the metadata to search for.
 * @param stmt      the statement to use for executing the query.
 * @param helper    an helper class for creating the SQL query.
 * @return the identifier of the given metadata, or {@code null} if none.
 * @throws SQLException if an error occurred while searching in the database.
 */
final String search(final String table,Set<String> columns,final Map<String,Object> metadata,final Statement stmt,final SQLBuilder helper) throws SQLException, FactoryException {
}
Program: 91657
Project: 91657
Buggy source:
/** 
 * EPSG scripts version 8.9 seems to have 2 errors where the   {@code OBJECT_TABLE_NAME} column contains{@code "AxisName"} instead of {@code "Coordinate Axis Name"}.
 */
@Override @Workaround(library="String_Node_Str",version="String_Node_Str") protected void editText(final StringBuilder sql,int lower,final int upper){
  if (upper - lower == 10 && CharSequences.regionMatches(sql,++lower,"String_Node_Str")) {
    sql.replace(lower,upper - 1,"String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * EPSG scripts version 8.9 seems to have 2 errors where the   {@code OBJECT_TABLE_NAME} column contains{@code "AxisName"} instead of {@code "Coordinate Axis Name"}. Furthermore the version number noted in the history table is a copy-and-paste error.
 */
@Override @Workaround(library="String_Node_Str",version="String_Node_Str") protected void editText(final StringBuilder sql,int lower,int upper){
  final String table;
  final String before;
  final String oldValue;
  final String newValue;
switch (upper - lower) {
default :
    return;
case 10:
{
    table="String_Node_Str";
    before=null;
    oldValue="String_Node_Str";
    newValue="String_Node_Str";
    break;
  }
case 38:
{
  table="String_Node_Str";
  before="String_Node_Str";
  oldValue="String_Node_Str";
  newValue="String_Node_Str";
  break;
}
}
if (CharSequences.regionMatches(sql,++lower,oldValue) && CharSequences.regionMatches(sql,0,"String_Node_Str" + table + "String_Node_Str")) {
assertEquals("String_Node_Str",oldValue.length(),--upper - lower);
if (before != null) {
final int i=sql.indexOf(before);
if (i < 0 || i >= lower) return;
}
sql.replace(lower,upper,newValue);
}
}
Program: 91659
Project: 91659
Buggy source:
/** 
 * Writes the event as per the XML 1.0 without indentation or whitespace.
 */
@Override final void write(final Appendable out) throws IOException {
  name(out.append('<'));
  final int n=attributes.size();
  for (int i=0; i < n; i++) {
    if (i != 0)     out.append(' ');
    Attr.castOrWrap(attributes.get(i)).write(out);
  }
  out.append('>');
}

Fixed version (ground truth):
/** 
 * Writes the event as per the XML 1.0 without indentation or whitespace.
 */
@Override final void write(final Appendable out) throws IOException {
  name(out.append('<'));
  final int n=attributes.size();
  for (int i=0; i < n; i++) {
    Attr.castOrWrap(attributes.get(i)).write(out);
  }
  out.append('>');
}
Program: 91660
Project: 91660
Buggy source:
/** 
 * Returns the next element. Use   {@link #nextEvent()} instead.
 */
@Override public Object next(){
  return convert((XMLEvent)in.next(),true);
}

Fixed version (ground truth):
/** 
 * Returns the next element. Use   {@link #nextEvent()} instead.
 */
@Override public Object next(){
}
Program: 91661
Project: 91661
Buggy source:
/** 
 * Forwards the call and keep trace of the XML elements opened up to this point.
 */
@Override public XMLEvent nextTag() throws XMLStreamException {
  return convert(in.nextTag(),true);
}

Fixed version (ground truth):
/** 
 * Forwards the call and keep trace of the XML elements opened up to this point.
 */
@Override public XMLEvent nextTag() throws XMLStreamException {
}
Program: 91662
Project: 91662
Buggy source:
/** 
 * Forwards the call and keep trace of the XML elements opened up to this point.
 */
@Override public XMLEvent nextEvent() throws XMLStreamException {
  return convert(in.nextEvent(),true);
}

Fixed version (ground truth):
/** 
 * Forwards the call and keep trace of the XML elements opened up to this point.
 */
@Override public XMLEvent nextEvent() throws XMLStreamException {
}
Program: 91663
Project: 91663
Buggy source:
/** 
 * Checks if there are more events.
 */
@Override public boolean hasNext(){
  return in.hasNext();
}

Fixed version (ground truth):
/** 
 * Checks if there are more events.
 */
@Override public boolean hasNext(){
  return (nextEvent != null) || in.hasNext();
}
Program: 91664
Project: 91664
Buggy source:
/** 
 * Check the next XMLEvent without reading it from the stream.
 */
@Override public XMLEvent peek() throws XMLStreamException {
  return convert(in.peek(),false);
}

Fixed version (ground truth):
/** 
 * Checks the next   {@code XMLEvent} without removing it from the stream.
 */
@Override public XMLEvent peek() throws XMLStreamException {
  if (nextEvent == null) {
    final XMLEvent event=in.peek();
    if (event != null) {
      nextEvent=convert(event);
    }
  }
  return nextEvent;
}