nus-yam/ex-repair huggingface dataset:
Program: 111855
Project: 111855
Buggy source:
public NamedFieldGetter(Class clazz,String... names){
  for (  String name : names) {
    final int index=fields.size();
    final String fieldName=uncamel(name);
    final Field field;
    try {
      field=clazz.getField(fieldName);
    }
 catch (    NoSuchFieldException e) {
      throw new RuntimeException(e);
    }
    columnNames.add(new ColumnMetaData(index,false,true,false,false,Primitive.is(field.getType()) ? DatabaseMetaData.columnNullable : DatabaseMetaData.columnNoNulls,true,-1,name,name,null,0,0,null,null,Types.VARCHAR,"String_Node_Str",true,false,false,null,field.getType()));
    fields.add(field);
  }
}

Fixed version (ground truth):
public NamedFieldGetter(Class clazz,String... names){
  for (  String name : names) {
    final int index=fields.size();
    final String fieldName=uncamel(name);
    final Field field;
    try {
      field=clazz.getField(fieldName);
    }
 catch (    NoSuchFieldException e) {
      throw new RuntimeException(e);
    }
    Pair<Integer,String> pair=lookupType(field.getType());
    columnNames.add(new ColumnMetaData(index,false,true,false,false,Primitive.is(field.getType()) ? DatabaseMetaData.columnNullable : DatabaseMetaData.columnNoNulls,true,-1,name,name,null,0,0,null,null,pair.left,pair.right,true,false,false,null,field.getType()));
    fields.add(field);
  }
}
Program: 111856
Project: 111856
Buggy source:
/** 
 * Tests driver's implementation of   {@link DatabaseMetaData#getColumns}. 
 */
@Test public void testMetaDataColumns() throws ClassNotFoundException, SQLException {
  Connection connection=getConnection("String_Node_Str","String_Node_Str");
  DatabaseMetaData metaData=connection.getMetaData();
  ResultSet resultSet=metaData.getColumns(null,null,null,null);
  assertTrue(resultSet.next());
  resultSet.close();
  connection.close();
}

Fixed version (ground truth):
/** 
 * Tests driver's implementation of   {@link DatabaseMetaData#getColumns}. 
 */
@Test public void testMetaDataColumns() throws ClassNotFoundException, SQLException {
  Connection connection=getConnection("String_Node_Str","String_Node_Str");
  DatabaseMetaData metaData=connection.getMetaData();
  ResultSet resultSet=metaData.getColumns(null,null,null,null);
  assertTrue(resultSet.next());
  String name=resultSet.getString(4);
  int type=resultSet.getInt(5);
  String typeName=resultSet.getString(6);
  int columnSize=resultSet.getInt(7);
  int decimalDigits=resultSet.getInt(9);
  int numPrecRadix=resultSet.getInt(10);
  int charOctetLength=resultSet.getInt(16);
  String isNullable=resultSet.getString(18);
  resultSet.close();
  connection.close();
}
Program: 111857
Project: 111857
Buggy source:
public Object freeze(ColumnLoader.ValueSet valueSet,int[] sources){
  final int chunksPerWord=64 / bitCount;
  final List<Comparable> valueList=permuteList(valueSet.values,sources);
  final int valueCount=valueList.size();
  final int wordCount=(valueCount + (chunksPerWord - 1)) / chunksPerWord;
  final int remainingChunkCount=valueCount % chunksPerWord;
  final long[] longs=new long[wordCount];
  final int n=valueCount / chunksPerWord;
  int i;
  int k=0;
  if (valueCount > 0 && valueList.get(0) instanceof Boolean) {
    @SuppressWarnings("String_Node_Str") final List<Boolean> booleans=(List)valueSet.values;
    for (i=0; i < n; i++) {
      long v=0;
      for (int j=0; j < chunksPerWord; j++) {
        v|=(booleans.get(k++) ? (1 << (bitCount * j)) : 0);
      }
      longs[i]=v;
    }
    if (remainingChunkCount > 0) {
      long v=0;
      for (int j=0; j < remainingChunkCount; j++) {
        v|=(booleans.get(k++) ? (1 << (bitCount * j)) : 0);
      }
      longs[i]=v;
    }
  }
 else {
    @SuppressWarnings("String_Node_Str") final List<Number> numbers=(List)valueSet.values;
    for (i=0; i < n; i++) {
      long v=0;
      for (int j=0; j < chunksPerWord; j++) {
        v|=(numbers.get(k++).longValue() << (bitCount * j));
      }
      longs[i]=v;
    }
    if (remainingChunkCount > 0) {
      long v=0;
      for (int j=0; j < remainingChunkCount; j++) {
        v|=(numbers.get(k++).longValue() << (bitCount * j));
      }
      longs[i]=v;
    }
  }
  return longs;
}

Fixed version (ground truth):
public Object freeze(ColumnLoader.ValueSet valueSet,int[] sources){
  final int chunksPerWord=64 / bitCount;
  final List<Comparable> valueList=permuteList(valueSet.values,sources);
  final int valueCount=valueList.size();
  final int wordCount=(valueCount + (chunksPerWord - 1)) / chunksPerWord;
  final int remainingChunkCount=valueCount % chunksPerWord;
  final long[] longs=new long[wordCount];
  final int n=valueCount / chunksPerWord;
  int i;
  int k=0;
  if (valueCount > 0 && valueList.get(0) instanceof Boolean) {
    @SuppressWarnings("String_Node_Str") final List<Boolean> booleans=(List)valueList;
    for (i=0; i < n; i++) {
      long v=0;
      for (int j=0; j < chunksPerWord; j++) {
        v|=(booleans.get(k++) ? (1 << (bitCount * j)) : 0);
      }
      longs[i]=v;
    }
    if (remainingChunkCount > 0) {
      long v=0;
      for (int j=0; j < remainingChunkCount; j++) {
        v|=(booleans.get(k++) ? (1 << (bitCount * j)) : 0);
      }
      longs[i]=v;
    }
  }
 else {
    @SuppressWarnings("String_Node_Str") final List<Number> numbers=(List)valueList;
    for (i=0; i < n; i++) {
      long v=0;
      for (int j=0; j < chunksPerWord; j++) {
        v|=(numbers.get(k++).longValue() << (bitCount * j));
      }
      longs[i]=v;
    }
    if (remainingChunkCount > 0) {
      long v=0;
      for (int j=0; j < remainingChunkCount; j++) {
        v|=(numbers.get(k++).longValue() << (bitCount * j));
      }
      longs[i]=v;
    }
  }
  return longs;
}
Program: 111858
Project: 111858
Buggy source:
/** 
 * Creates a column loader, and performs the load. 
 */
ColumnLoader(JavaTypeFactory typeFactory,Enumerable<T> sourceTable,RelDataType elementType){
  this.typeFactory=typeFactory;
  sourceTable.into(list);
  final int[] sorts={-1};
  if (Bug.TodoFixed) {
    load(elementType,sorts);
    this.sortField=sorts[0];
  }
 else {
    load(elementType,null);
    sortField=-1;
  }
}

Fixed version (ground truth):
/** 
 * Creates a column loader, and performs the load. 
 */
ColumnLoader(JavaTypeFactory typeFactory,Enumerable<T> sourceTable,RelDataType elementType){
  this.typeFactory=typeFactory;
  sourceTable.into(list);
  final int[] sorts={-1};
  load(elementType,sorts);
  this.sortField=sorts[0];
}
Program: 111859
Project: 111859
Buggy source:
@Override protected PreparedResult implement(RelDataType rowType,RelNode rootRel,SqlKind sqlKind){
  RelDataType resultType=rootRel.getRowType();
  boolean isDml=sqlKind.belongsTo(SqlKind.DML);
  EnumerableRelImplementor relImplementor=getRelImplementor(rootRel.getCluster().getRexBuilder());
  ClassDeclaration expr=relImplementor.implementRoot((EnumerableRel)rootRel);
  String s=Expressions.toString(expr.memberDeclarations,"String_Node_Str",false);
  if (DEBUG) {
    System.out.println();
    System.out.println(s);
  }
  Hook.JAVA_PLAN.run(s);
  final Executable executable;
  try {
    executable=(Executable)ClassBodyEvaluator.createFastClassBodyEvaluator(new Scanner(null,new StringReader(s)),expr.name,Utilities.class,new Class[]{Executable.class,Typed.class},getClass().getClassLoader());
  }
 catch (  Exception e) {
    throw Helper.INSTANCE.wrap("String_Node_Str" + s,e);
  }
  if (timingTracer != null) {
    timingTracer.traceTime("String_Node_Str");
  }
  if (timingTracer != null) {
    timingTracer.traceTime("String_Node_Str");
  }
  return new PreparedResultImpl(resultType,fieldOrigins,rootRel,mapTableModOp(isDml,sqlKind),isDml){
    public String getCode(){
      throw new UnsupportedOperationException();
    }
    @Override public Object execute(){
      return executable.execute(schema);
    }
    @Override public Type getElementType(){
      return ((Typed)executable).getElementType();
    }
  }
;
}

Fixed version (ground truth):
@Override protected PreparedResult implement(RelDataType rowType,RelNode rootRel,SqlKind sqlKind){
  RelDataType resultType=rootRel.getRowType();
  boolean isDml=sqlKind.belongsTo(SqlKind.DML);
  EnumerableRelImplementor relImplementor=getRelImplementor(rootRel.getCluster().getRexBuilder());
  ClassDeclaration expr=relImplementor.implementRoot((EnumerableRel)rootRel,prefer);
  String s=Expressions.toString(expr.memberDeclarations,"String_Node_Str",false);
  if (DEBUG) {
    System.out.println();
    System.out.println(s);
  }
  Hook.JAVA_PLAN.run(s);
  final Executable executable;
  try {
    executable=(Executable)ClassBodyEvaluator.createFastClassBodyEvaluator(new Scanner(null,new StringReader(s)),expr.name,Utilities.class,new Class[]{Executable.class,Typed.class},getClass().getClassLoader());
  }
 catch (  Exception e) {
    throw Helper.INSTANCE.wrap("String_Node_Str" + s,e);
  }
  if (timingTracer != null) {
    timingTracer.traceTime("String_Node_Str");
  }
  if (timingTracer != null) {
    timingTracer.traceTime("String_Node_Str");
  }
  return new PreparedResultImpl(resultType,fieldOrigins,rootRel,mapTableModOp(isDml,sqlKind),isDml){
    public String getCode(){
      throw new UnsupportedOperationException();
    }
    @Override public Object execute(){
      return executable.execute(schema);
    }
    @Override public Type getElementType(){
      return ((Typed)executable).getElementType();
    }
  }
;
}
Program: 111860
Project: 111860
Buggy source:
public OptiqPreparingStmt(CatalogReader catalogReader,RelDataTypeFactory typeFactory,Schema schema,Convention resultConvention,RelOptPlanner planner){
  super(catalogReader,resultConvention);
  this.schema=schema;
  this.planner=planner;
  this.rexBuilder=new RexBuilder(typeFactory);
}

Fixed version (ground truth):
public OptiqPreparingStmt(CatalogReader catalogReader,RelDataTypeFactory typeFactory,Schema schema,EnumerableRel.Prefer prefer,RelOptPlanner planner){
  super(catalogReader,EnumerableConvention.ARRAY);
  this.schema=schema;
  this.prefer=prefer;
  this.planner=planner;
  this.rexBuilder=new RexBuilder(typeFactory);
}
Program: 111861
Project: 111861
Buggy source:
public ClassDeclaration implementRoot(EnumerableRel rootRel){
  final EnumerableRel.Result implement=rootRel.implement(this,EnumerableRel.Prefer.ANY);
  List<MemberDeclaration> memberDeclarations=new ArrayList<MemberDeclaration>();
  declareSyntheticClasses(implement.expression,memberDeclarations);
  ParameterExpression root=Expressions.parameter(Modifier.FINAL,DataContext.class,"String_Node_Str");
  memberDeclarations.add(Expressions.methodDecl(Modifier.PUBLIC,Enumerable.class,BuiltinMethod.EXECUTABLE_EXECUTE.method.getName(),Expressions.list(root),implement.expression));
  memberDeclarations.add(Expressions.methodDecl(Modifier.PUBLIC,Type.class,BuiltinMethod.TYPED_GET_ELEMENT_TYPE.method.getName(),Collections.<ParameterExpression>emptyList(),Blocks.toFunctionBlock(Expressions.return_(null,Expressions.constant(implement.physType.getJavaRowType())))));
  return Expressions.classDecl(Modifier.PUBLIC,"String_Node_Str",null,Collections.<Type>singletonList(Executable.class),memberDeclarations);
}

Fixed version (ground truth):
public ClassDeclaration implementRoot(EnumerableRel rootRel,EnumerableRel.Prefer prefer){
  final EnumerableRel.Result implement=rootRel.implement(this,prefer);
  List<MemberDeclaration> memberDeclarations=new ArrayList<MemberDeclaration>();
  declareSyntheticClasses(implement.expression,memberDeclarations);
  ParameterExpression root=Expressions.parameter(Modifier.FINAL,DataContext.class,"String_Node_Str");
  memberDeclarations.add(Expressions.methodDecl(Modifier.PUBLIC,Enumerable.class,BuiltinMethod.EXECUTABLE_EXECUTE.method.getName(),Expressions.list(root),implement.expression));
  memberDeclarations.add(Expressions.methodDecl(Modifier.PUBLIC,Type.class,BuiltinMethod.TYPED_GET_ELEMENT_TYPE.method.getName(),Collections.<ParameterExpression>emptyList(),Blocks.toFunctionBlock(Expressions.return_(null,Expressions.constant(implement.physType.getJavaRowType())))));
  return Expressions.classDecl(Modifier.PUBLIC,"String_Node_Str",null,Collections.<Type>singletonList(Executable.class),memberDeclarations);
}
Program: 111862
Project: 111862
Buggy source:
/** 
 * Generates an accessor function for a given list of fields. <p>For example:</p> <pre>  {@code}new Function1<Employee, Object[]>  public Object[] apply(Employee v1) { return new Object[] {v1.<fieldN>, v1.<fieldM>}; } } }</pre>
 */
Expression generateAccessor(List<Integer> fields);

Fixed version (ground truth):
/** 
 * Generates an accessor function for a given list of fields. The resulting object is a   {@link List} (implementing {@link #hashCode()}and   {@link #equals(Object)} per that interface) and also implements{@link Comparable}. <p>For example:</p> <pre>  {@code}new Function1<Employee, Object[]>  public Object[] apply(Employee v1) { return FlatLists.of(v1.<fieldN>, v1.<fieldM>); } } }</pre>
 */
Expression generateAccessor(List<Integer> fields);
Program: 111863
Project: 111863
Buggy source:
/** 
 * Generates a selector with the default row format. 
 */
Expression generateSelector(ParameterExpression parameter,List<Integer> fields);

Fixed version (ground truth):
/** 
 * Generates a selector for the given fields from an expression. 
 */
Expression generateSelector(ParameterExpression parameter,List<Integer> fields,JavaRowFormat targetFormat);
Program: 111864
Project: 111864
Buggy source:
public PhysType project(final List<Integer> integers,JavaRowFormat format){
  RelDataType projectedRowType=typeFactory.createStructType(new AbstractList<Map.Entry<String,RelDataType>>(){
    public Map.Entry<String,RelDataType> get(    int index){
      return rowType.getFieldList().get(index);
    }
    public int size(){
      return integers.size();
    }
  }
);
  return of(typeFactory,projectedRowType,this.format.optimize(projectedRowType));
}

Fixed version (ground truth):
public PhysType project(final List<Integer> integers,JavaRowFormat format){
  RelDataType projectedRowType=typeFactory.createStructType(new AbstractList<Map.Entry<String,RelDataType>>(){
    public Map.Entry<String,RelDataType> get(    int index){
      return rowType.getFieldList().get(index);
    }
    public int size(){
      return integers.size();
    }
  }
);
  return of(typeFactory,projectedRowType,format.optimize(projectedRowType));
}
Program: 111865
Project: 111865
Buggy source:
/** 
 * Generates a selector for the given fields from an expression. 
 */
protected Expression generateSelector(ParameterExpression parameter,List<Integer> fields,JavaRowFormat targetFormat){
switch (fields.size()) {
case 0:
    targetFormat=JavaRowFormat.EMPTY_LIST;
  break;
case 1:
targetFormat=JavaRowFormat.SCALAR;
break;
}
final PhysType targetPhysType=project(fields,targetFormat);
switch (format) {
case SCALAR:
return Expressions.call(BuiltinMethod.IDENTITY_SELECTOR.method);
default :
return Expressions.lambda(Function1.class,targetPhysType.record(fieldReferences(parameter,fields)),parameter);
}
}

Fixed version (ground truth):
public Expression generateSelector(ParameterExpression parameter,List<Integer> fields,JavaRowFormat targetFormat){
switch (fields.size()) {
case 0:
    targetFormat=JavaRowFormat.LIST;
  break;
case 1:
targetFormat=JavaRowFormat.SCALAR;
break;
}
final PhysType targetPhysType=project(fields,targetFormat);
switch (format) {
case SCALAR:
return Expressions.call(BuiltinMethod.IDENTITY_SELECTOR.method);
default :
return Expressions.lambda(Function1.class,targetPhysType.record(fieldReferences(parameter,fields)),parameter);
}
}
Program: 111866
Project: 111866
Buggy source:
public int compareTo(List<T> o){
  return compare(list,o);
}

Fixed version (ground truth):
public int compareTo(List o){
  return compare(list,o);
}
Program: 111867
Project: 111867
Buggy source:
/** 
 * Creates a memory-, CPU- and cache-efficient immutable list from an existing list. The list is always copied.
 * @param t Array of members of list
 * @param < T > Element type
 * @return List containing the given members
 */
public static <T>List<T> of(List<T> t){
switch (t.size()) {
case 0:
    return COMPARABLE_EMPTY_LIST;
case 1:
  return Collections.singletonList(t.get(0));
case 2:
return new Flat2List<T>(t.get(0),t.get(1));
case 3:
return new Flat3List<T>(t.get(0),t.get(1),t.get(2));
default :
return new ComparableList(Arrays.asList(t.toArray()));
}
}

Fixed version (ground truth):
/** 
 * Creates a memory-, CPU- and cache-efficient immutable list from an existing list. The list is always copied.
 * @param t Array of members of list
 * @param < T > Element type
 * @return List containing the given members
 */
public static <T>List<T> of(List<T> t){
switch (t.size()) {
case 0:
    return COMPARABLE_EMPTY_LIST;
case 1:
  return Collections.singletonList(t.get(0));
case 2:
return new Flat2List<T>(t.get(0),t.get(1));
case 3:
return new Flat3List<T>(t.get(0),t.get(1),t.get(2));
default :
return new ComparableListImpl(Arrays.asList(t.toArray()));
}
}
Program: 111868
Project: 111868
Buggy source:
/** 
 * Creates a memory-, CPU- and cache-efficient immutable list, optionally copying the list.
 * @param copy Whether to always copy the list
 * @param t Array of members of list
 * @return List containing the given members
 */
private static <T>List<T> _flatList(T[] t,boolean copy){
switch (t.length) {
case 0:
    return COMPARABLE_EMPTY_LIST;
case 1:
  return Collections.singletonList(t[0]);
case 2:
return new Flat2List<T>(t[0],t[1]);
case 3:
return new Flat3List<T>(t[0],t[1],t[2]);
default :
if (copy) {
return new ComparableList(Arrays.asList(t.clone()));
}
 else {
return new ComparableList(Arrays.asList(t));
}
}
}

Fixed version (ground truth):
/** 
 * Creates a memory-, CPU- and cache-efficient immutable list, optionally copying the list.
 * @param copy Whether to always copy the list
 * @param t Array of members of list
 * @return List containing the given members
 */
private static <T>List<T> _flatList(T[] t,boolean copy){
switch (t.length) {
case 0:
    return COMPARABLE_EMPTY_LIST;
case 1:
  return Collections.singletonList(t[0]);
case 2:
return new Flat2List<T>(t[0],t[1]);
case 3:
return new Flat3List<T>(t[0],t[1],t[2]);
default :
if (copy) {
return new ComparableListImpl(Arrays.asList(t.clone()));
}
 else {
return new ComparableListImpl(Arrays.asList(t));
}
}
}
Program: 111869
Project: 111869
Buggy source:
public static int compareNullsLast(List v0,List v1){
  return v0 == v1 ? 0 : v0 == null ? 1 : v1 == null ? -1 : FlatLists.ComparableList.compare(v0,v1);
}

Fixed version (ground truth):
public static int compareNullsLast(List v0,List v1){
  return v0 == v1 ? 0 : v0 == null ? 1 : v1 == null ? -1 : FlatLists.ComparableListImpl.compare(v0,v1);
}
Program: 111870
Project: 111870
Buggy source:
public PreparedResult prepareQueryable(Queryable queryable,RelDataType resultType){
  queryString=null;
  Class runtimeContextClass=Object.class;
  init(runtimeContextClass);
  final RelOptQuery query=new RelOptQuery(planner);
  final RelTraitSet emptyTraitSet=RelTraitSet.createEmpty();
  final RelOptCluster cluster=query.createCluster(rexBuilder.getTypeFactory(),rexBuilder,emptyTraitSet);
  RelNode rootRel=new LixToRelTranslator(cluster,OptiqPreparingStmt.this).translate(queryable);
  if (timingTracer != null) {
    timingTracer.traceTime("String_Node_Str");
  }
  final RelDataType jdbcType=makeStruct(rexBuilder.getTypeFactory(),resultType);
  fieldOrigins=Collections.nCopies(jdbcType.getFieldCount(),null);
  rootRel=flattenTypes(rootRel,true);
  rootRel=trimUnusedFields(rootRel);
  rootRel=optimize(resultType,rootRel);
  if (timingTracer != null) {
    timingTracer.traceTime("String_Node_Str");
  }
  return implement(resultType,rootRel,SqlKind.SELECT);
}

Fixed version (ground truth):
public PreparedResult prepareQueryable(Queryable queryable,RelDataType resultType){
  queryString=null;
  Class runtimeContextClass=Object.class;
  init(runtimeContextClass);
  final RelOptQuery query=new RelOptQuery(planner);
  final RelTraitSet emptyTraitSet=planner.emptyTraitSet();
  final RelOptCluster cluster=query.createCluster(rexBuilder.getTypeFactory(),rexBuilder,emptyTraitSet);
  RelNode rootRel=new LixToRelTranslator(cluster,OptiqPreparingStmt.this).translate(queryable);
  if (timingTracer != null) {
    timingTracer.traceTime("String_Node_Str");
  }
  final RelDataType jdbcType=makeStruct(rexBuilder.getTypeFactory(),resultType);
  fieldOrigins=Collections.nCopies(jdbcType.getFieldCount(),null);
  rootRel=flattenTypes(rootRel,true);
  rootRel=trimUnusedFields(rootRel);
  rootRel=optimize(resultType,rootRel);
  if (timingTracer != null) {
    timingTracer.traceTime("String_Node_Str");
  }
  return implement(resultType,rootRel,SqlKind.SELECT);
}
Program: 111871
Project: 111871
Buggy source:
public boolean canConvert(RelOptPlanner planner,RelTrait fromTrait,RelTrait toTrait){
  ConversionData conversionData=getConversionData(planner);
  Convention fromConvention=(Convention)fromTrait;
  Convention toConvention=(Convention)toTrait;
  return conversionData.conversionGraph.getShortestPath(fromConvention,toConvention) != null;
}

Fixed version (ground truth):
public boolean canConvert(RelOptPlanner planner,Convention fromConvention,Convention toConvention){
  ConversionData conversionData=getConversionData(planner);
  return conversionData.conversionGraph.getShortestPath(fromConvention,toConvention) != null;
}
Program: 111872
Project: 111872
Buggy source:
public RelNode convert(RelOptPlanner planner,RelNode rel,RelTrait toTrait,boolean allowInfiniteCostConverters){
  final ConversionData conversionData=getConversionData(planner);
  final Graph<Convention> conversionGraph=conversionData.conversionGraph;
  final MultiMap<Graph.Arc,ConverterRule> mapArcToConverterRule=conversionData.mapArcToConverterRule;
  final Convention fromConvention=rel.getConvention();
  final Convention toConvention=(Convention)toTrait;
  Iterator<Graph.Arc<Convention>[]> conversionPaths=conversionGraph.getPaths(fromConvention,toConvention);
  loop:   while (conversionPaths.hasNext()) {
    Graph.Arc[] arcs=conversionPaths.next();
    assert(arcs[0].from == fromConvention);
    assert(arcs[arcs.length - 1].to == toConvention);
    RelNode converted=rel;
    for (    Graph.Arc arc : arcs) {
      if (planner.getCost(converted).isInfinite() && !allowInfiniteCostConverters) {
        continue loop;
      }
      converted=changeConvention(converted,arc,mapArcToConverterRule);
      if (converted == null) {
        throw Util.newInternal("String_Node_Str" + arc.from + "String_Node_Str"+ arc.to+ "String_Node_Str");
      }
    }
    return converted;
  }
  return null;
}

Fixed version (ground truth):
public RelNode convert(RelOptPlanner planner,RelNode rel,Convention toConvention,boolean allowInfiniteCostConverters){
  final ConversionData conversionData=getConversionData(planner);
  final Graph<Convention> conversionGraph=conversionData.conversionGraph;
  final MultiMap<Graph.Arc,ConverterRule> mapArcToConverterRule=conversionData.mapArcToConverterRule;
  final Convention fromConvention=rel.getConvention();
  Iterator<Graph.Arc<Convention>[]> conversionPaths=conversionGraph.getPaths(fromConvention,toConvention);
  loop:   while (conversionPaths.hasNext()) {
    Graph.Arc[] arcs=conversionPaths.next();
    assert(arcs[0].from == fromConvention);
    assert(arcs[arcs.length - 1].to == toConvention);
    RelNode converted=rel;
    for (    Graph.Arc arc : arcs) {
      if (planner.getCost(converted).isInfinite() && !allowInfiniteCostConverters) {
        continue loop;
      }
      converted=changeConvention(converted,arc,mapArcToConverterRule);
      if (converted == null) {
        throw Util.newInternal("String_Node_Str" + arc.from + "String_Node_Str"+ arc.to+ "String_Node_Str");
      }
    }
    return converted;
  }
  return null;
}
Program: 111873
Project: 111873
Buggy source:
/** 
 * Tests whether the given RelTrait can be converted to another RelTrait.
 * @param planner the planner requesting the conversion test
 * @param fromTrait the RelTrait to convert from
 * @param toTrait the RelTrait to convert to
 * @return true if fromTrait can be converted to toTrait
 */
public abstract boolean canConvert(RelOptPlanner planner,RelTrait fromTrait,RelTrait toTrait);

Fixed version (ground truth):
/** 
 * Tests whether the given RelTrait can be converted to another RelTrait.
 * @param planner the planner requesting the conversion test
 * @param fromTrait the RelTrait to convert from
 * @param toTrait the RelTrait to convert to
 * @return true if fromTrait can be converted to toTrait
 */
public abstract boolean canConvert(RelOptPlanner planner,T fromTrait,T toTrait);
Program: 111874
Project: 111874
Buggy source:
/** 
 * Converts the given RelNode to the given RelTrait.
 * @param planner the planner requesting the conversion
 * @param rel RelNode to convert
 * @param toTrait RelTrait to convert to
 * @param allowInfiniteCostConverters flag indicating whether infinite costconverters are allowed
 * @return a converted RelNode or null if conversion is not possible
 */
public abstract RelNode convert(RelOptPlanner planner,RelNode rel,RelTrait toTrait,boolean allowInfiniteCostConverters);

Fixed version (ground truth):
/** 
 * Converts the given RelNode to the given RelTrait.
 * @param planner the planner requesting the conversion
 * @param rel RelNode to convert
 * @param toTrait RelTrait to convert to
 * @param allowInfiniteCostConverters flag indicating whether infinite costconverters are allowed
 * @return a converted RelNode or null if conversion is not possible
 */
public abstract RelNode convert(RelOptPlanner planner,RelNode rel,T toTrait,boolean allowInfiniteCostConverters);
Program: 111875
Project: 111875
Buggy source:
public boolean canConvert(RelOptPlanner planner,RelTrait fromTrait,RelTrait toTrait){
  if (conversionMap.containsKey(fromTrait)) {
    for (    Pair<RelTrait,ConverterRule> traitAndRule : conversionMap.getMulti(fromTrait)) {
      if (traitAndRule.left == toTrait) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean canConvert(RelOptPlanner planner,AltTrait fromTrait,AltTrait toTrait){
  if (conversionMap.containsKey(fromTrait)) {
    for (    Pair<RelTrait,ConverterRule> traitAndRule : conversionMap.getMulti(fromTrait)) {
      if (traitAndRule.left == toTrait) {
        return true;
      }
    }
  }
  return false;
}
Program: 111876
Project: 111876
Buggy source:
private SyntheticRecordType(RelDataType relType,String name){
  this.relType=relType;
  this.name=name;
}

Fixed version (ground truth):
private SyntheticRecordType(RelDataType relType,String name){
}
Program: 111877
Project: 111877
Buggy source:
private static Expression implementNullSemantics(RexToLixTranslator translator,RexCall call,NullAs nullAs,NotNullImplementor implementor){
  final List<Expression> list=new ArrayList<Expression>();
switch (nullAs) {
case NULL:
    for (    Ord<RexNode> operand : Ord.zip(call.getOperands())) {
      if (translator.isNullable(operand.e)) {
        list.add(translator.translate(operand.e,NullAs.IS_NULL));
        translator=translator.setNullable(operand.e,false);
      }
    }
  return optimize(Expressions.condition(Expressions.foldOr(list),NULL_EXPR,Expressions.box(implementCall(translator,call,implementor,nullAs))));
case FALSE:
for (Ord<RexNode> operand : Ord.zip(call.getOperands())) {
  if (translator.isNullable(operand.e)) {
    list.add(translator.translate(operand.e,NullAs.IS_NOT_NULL));
    translator=translator.setNullable(operand.e,false);
  }
}
list.add(implementCall(translator,call,implementor,nullAs));
return Expressions.foldAnd(list);
case NOT_POSSIBLE:
translator=translator.setNullable(call,false);
default :
return implementCall(translator,call,implementor,nullAs);
}
}

Fixed version (ground truth):
private static Expression implementNullSemantics(RexToLixTranslator translator,RexCall call,NullAs nullAs,NotNullImplementor implementor){
  final List<Expression> list=new ArrayList<Expression>();
switch (nullAs) {
case NULL:
    for (    Ord<RexNode> operand : Ord.zip(call.getOperands())) {
      if (translator.isNullable(operand.e)) {
        list.add(translator.translate(operand.e,NullAs.IS_NULL));
        translator=translator.setNullable(operand.e,false);
      }
    }
  final Expression box=Expressions.box(implementCall(translator,call,implementor,nullAs));
return optimize(Expressions.condition(Expressions.foldOr(list),Types.castIfNecessary(box.getType(),NULL_EXPR),box));
case FALSE:
for (Ord<RexNode> operand : Ord.zip(call.getOperands())) {
if (translator.isNullable(operand.e)) {
  list.add(translator.translate(operand.e,NullAs.IS_NOT_NULL));
  translator=translator.setNullable(operand.e,false);
}
}
list.add(implementCall(translator,call,implementor,nullAs));
return Expressions.foldAnd(list);
case NOT_POSSIBLE:
translator=translator.setNullable(call,false);
default :
return implementCall(translator,call,implementor,nullAs);
}
}
Program: 111880
Project: 111880
Buggy source:
private static void expr(SqlBuilder buf,RexProgram program,RexNode rex){
  if (rex instanceof RexLocalRef) {
    final int index=((RexLocalRef)rex).getIndex();
    expr(buf,program,program.getExprList().get(index));
  }
 else   if (rex instanceof RexInputRef) {
    buf.identifier(program.getInputRowType().getFieldNames().get(((RexInputRef)rex).getIndex()));
  }
 else   if (rex instanceof RexLiteral) {
    RexLiteral rexLiteral=(RexLiteral)rex;
    buf.append(rexLiteral.getValue2().toString());
  }
 else   if (rex instanceof RexCall) {
    final RexCall call=(RexCall)rex;
switch (call.getOperator().getSyntax()) {
case Binary:
      expr(buf,program,call.getOperandList().get(0));
    buf.append(' ').append(call.getOperator().toString()).append(' ');
  expr(buf,program,call.getOperandList().get(1));
break;
default :
throw new AssertionError(call.getOperator());
}
}
 else {
throw new AssertionError(rex);
}
}

Fixed version (ground truth):
private static void expr(SqlBuilder buf,RexProgram program,RexNode rex){
  if (rex instanceof RexLocalRef) {
    final int index=((RexLocalRef)rex).getIndex();
    expr(buf,program,program.getExprList().get(index));
  }
 else   if (rex instanceof RexInputRef) {
    buf.identifier(program.getInputRowType().getFieldNames().get(((RexInputRef)rex).getIndex()));
  }
 else   if (rex instanceof RexLiteral) {
    toSql(buf,(RexLiteral)rex);
  }
 else   if (rex instanceof RexCall) {
    final RexCall call=(RexCall)rex;
switch (call.getOperator().getSyntax()) {
case Binary:
      expr(buf,program,call.getOperandList().get(0));
    buf.append(' ').append(call.getOperator().toString()).append(' ');
  expr(buf,program,call.getOperandList().get(1));
break;
default :
throw new AssertionError(call.getOperator());
}
}
 else {
throw new AssertionError(rex);
}
}
Program: 111881
Project: 111881
Buggy source:
private static boolean isStar(RexProgram program){
  int i=0;
  for (  RexLocalRef ref : program.getProjectList()) {
    if (ref.getIndex() != i++) {
      return false;
    }
  }
  if (i != program.getInputRowType().getFieldCount()) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
private static boolean isStar(RexProgram program){
  int i=0;
  for (  RexLocalRef ref : program.getProjectList()) {
    if (ref.getIndex() != i++) {
      return false;
    }
  }
  return i == program.getInputRowType().getFieldCount();
}
Program: 111883
Project: 111883
Buggy source:
public RelNode toRel(RelOptTable.ToRelContext context,RelOptTable relOptTable){
  return expandView(context.getPreparingStmt(),((JavaTypeFactory)context.getCluster().getTypeFactory()).createType(elementType),viewSql);
}

Fixed version (ground truth):
public RelNode toRel(RelOptTable.ToRelContext context,RelOptTable relOptTable){
  return expandView(context.getPreparingStmt(),getRowType(),viewSql);
}
Program: 111885
Project: 111885
Buggy source:
public static <K,V>List<V> rightSlice(final List<Pair<K,V>> pairs){
  return new AbstractList<V>(){
    public V get(    int index){
      return pairs.get(index).right;
    }
    public int size(){
      return pairs.size();
    }
  }
;
}

Fixed version (ground truth):
public static <K,V>List<V> rightSlice(final List<? extends Map.Entry<K,V>> pairs){
  return new AbstractList<V>(){
    public V get(    int index){
      return pairs.get(index).getValue();
    }
    public int size(){
      return pairs.size();
    }
  }
;
}
Program: 111886
Project: 111886
Buggy source:
public static <K,V>List<K> leftSlice(final List<Pair<K,V>> pairs){
  return new AbstractList<K>(){
    public K get(    int index){
      return pairs.get(index).left;
    }
    public int size(){
      return pairs.size();
    }
  }
;
}

Fixed version (ground truth):
public static <K,V>List<K> leftSlice(final List<? extends Map.Entry<K,V>> pairs){
  return new AbstractList<K>(){
    public K get(    int index){
      return pairs.get(index).getKey();
    }
    public int size(){
      return pairs.size();
    }
  }
;
}
Program: 111887
Project: 111887
Buggy source:
public V get(int index){
  return pairs.get(index).right;
}

Fixed version (ground truth):
public V get(int index){
  return pairs.get(index).getValue();
}
Program: 111888
Project: 111888
Buggy source:
/** 
 * Creates a query planner and initializes it with a default set of rules. 
 */
protected RelOptPlanner createPlanner(){
  final VolcanoPlanner planner=new VolcanoPlanner();
  planner.addRelTraitDef(ConventionTraitDef.instance);
  RelOptUtil.registerAbstractRels(planner);
  planner.addRule(JavaRules.ENUMERABLE_JOIN_RULE);
  planner.addRule(JavaRules.ENUMERABLE_CALC_RULE);
  planner.addRule(JavaRules.ENUMERABLE_AGGREGATE_RULE);
  planner.addRule(JavaRules.ENUMERABLE_SORT_RULE);
  planner.addRule(JavaRules.ENUMERABLE_UNION_RULE);
  planner.addRule(JavaRules.ENUMERABLE_INTERSECT_RULE);
  planner.addRule(JavaRules.ENUMERABLE_MINUS_RULE);
  planner.addRule(JavaRules.ENUMERABLE_TABLE_MODIFICATION_RULE);
  planner.addRule(JavaRules.ENUMERABLE_VALUES_RULE);
  planner.addRule(JavaRules.ENUMERABLE_ONE_ROW_RULE);
  planner.addRule(JavaRules.ENUMERABLE_CUSTOM_FROM_ARRAY_RULE);
  planner.addRule(JavaRules.ENUMERABLE_ARRAY_FROM_CUSTOM_RULE);
  planner.addRule(JavaRules.EnumerableCustomCalcRule.INSTANCE);
  planner.addRule(TableAccessRule.instance);
  planner.addRule(PushFilterPastProjectRule.instance);
  planner.addRule(PushFilterPastJoinRule.instance);
  planner.addRule(RemoveDistinctAggregateRule.instance);
  planner.addRule(SwapJoinRule.instance);
  return planner;
}

Fixed version (ground truth):
/** 
 * Creates a query planner and initializes it with a default set of rules. 
 */
protected RelOptPlanner createPlanner(){
  final VolcanoPlanner planner=new VolcanoPlanner();
  planner.addRelTraitDef(ConventionTraitDef.instance);
  RelOptUtil.registerAbstractRels(planner);
  planner.addRule(JavaRules.ENUMERABLE_JOIN_RULE);
  planner.addRule(JavaRules.ENUMERABLE_CALC_RULE);
  planner.addRule(JavaRules.ENUMERABLE_AGGREGATE_RULE);
  planner.addRule(JavaRules.ENUMERABLE_SORT_RULE);
  planner.addRule(JavaRules.ENUMERABLE_UNION_RULE);
  planner.addRule(JavaRules.ENUMERABLE_INTERSECT_RULE);
  planner.addRule(JavaRules.ENUMERABLE_MINUS_RULE);
  planner.addRule(JavaRules.ENUMERABLE_TABLE_MODIFICATION_RULE);
  planner.addRule(JavaRules.ENUMERABLE_VALUES_RULE);
  planner.addRule(JavaRules.ENUMERABLE_ONE_ROW_RULE);
  planner.addRule(JavaRules.ENUMERABLE_CUSTOM_FROM_ARRAY_RULE);
  planner.addRule(JavaRules.ENUMERABLE_ARRAY_FROM_CUSTOM_RULE);
  planner.addRule(JavaRules.EnumerableCustomCalcRule.INSTANCE);
  planner.addRule(TableAccessRule.instance);
  planner.addRule(PushFilterPastProjectRule.instance);
  planner.addRule(PushFilterPastJoinRule.instance);
  planner.addRule(RemoveDistinctAggregateRule.instance);
  planner.addRule(ReduceAggregatesRule.instance);
  planner.addRule(SwapJoinRule.instance);
  return planner;
}
Program: 111890
Project: 111890
Buggy source:
private static Expression implementNullSemantics0(RexToLixTranslator translator,RexCall call,NullAs nullAs,NullPolicy nullPolicy,boolean harmonize,NotNullImplementor implementor){
switch (nullAs) {
case IS_NOT_NULL:
    if (nullPolicy == NullPolicy.STRICT) {
      return JavaRules.EnumUtil.foldAnd(translator.translateList(call.getOperandList(),nullAs));
    }
  break;
case IS_NULL:
if (nullPolicy == NullPolicy.STRICT) {
  return JavaRules.EnumUtil.foldOr(translator.translateList(call.getOperandList(),nullAs));
}
break;
}
final RexCall call2=call2(harmonize,translator,call);
try {
return implementNullSemantics(translator,call2,nullAs,implementor);
}
 catch (RexToLixTranslator.AlwaysNull e) {
if (nullAs == NullAs.NOT_POSSIBLE) {
throw e;
}
return NULL_EXPR;
}
}

Fixed version (ground truth):
private static Expression implementNullSemantics0(RexToLixTranslator translator,RexCall call,NullAs nullAs,NullPolicy nullPolicy,boolean harmonize,NotNullImplementor implementor){
switch (nullAs) {
case IS_NOT_NULL:
    if (nullPolicy == NullPolicy.STRICT) {
      return Expressions.foldAnd(translator.translateList(call.getOperandList(),nullAs));
    }
  break;
case IS_NULL:
if (nullPolicy == NullPolicy.STRICT) {
  return Expressions.foldOr(translator.translateList(call.getOperandList(),nullAs));
}
break;
}
final RexCall call2=call2(harmonize,translator,call);
try {
return implementNullSemantics(translator,call2,nullAs,implementor);
}
 catch (RexToLixTranslator.AlwaysNull e) {
if (nullAs == NullAs.NOT_POSSIBLE) {
throw e;
}
return NULL_EXPR;
}
}
Program: 111891
Project: 111891
Buggy source:
private static Expression implementNullSemantics(RexToLixTranslator translator,RexCall call,NullAs nullAs,NotNullImplementor implementor){
  final List<Expression> list=new ArrayList<Expression>();
switch (nullAs) {
case NULL:
    for (    Ord<RexNode> operand : Ord.zip(call.getOperands())) {
      if (translator.isNullable(operand.e)) {
        list.add(translator.translate(operand.e,NullAs.IS_NULL));
        translator=translator.setNullable(operand.e,false);
      }
    }
  return optimize(Expressions.condition(JavaRules.EnumUtil.foldOr(list),NULL_EXPR,RexToLixTranslator.box(implementCall(translator,call,implementor,nullAs))));
case FALSE:
for (Ord<RexNode> operand : Ord.zip(call.getOperands())) {
  if (translator.isNullable(operand.e)) {
    list.add(translator.translate(operand.e,NullAs.IS_NOT_NULL));
    translator=translator.setNullable(operand.e,false);
  }
}
list.add(implementCall(translator,call,implementor,nullAs));
return JavaRules.EnumUtil.foldAnd(list);
case NOT_POSSIBLE:
translator=translator.setNullable(call,false);
default :
return implementCall(translator,call,implementor,nullAs);
}
}

Fixed version (ground truth):
private static Expression implementNullSemantics(RexToLixTranslator translator,RexCall call,NullAs nullAs,NotNullImplementor implementor){
  final List<Expression> list=new ArrayList<Expression>();
switch (nullAs) {
case NULL:
    for (    Ord<RexNode> operand : Ord.zip(call.getOperands())) {
      if (translator.isNullable(operand.e)) {
        list.add(translator.translate(operand.e,NullAs.IS_NULL));
        translator=translator.setNullable(operand.e,false);
      }
    }
  return optimize(Expressions.condition(Expressions.foldOr(list),NULL_EXPR,Expressions.box(implementCall(translator,call,implementor,nullAs))));
case FALSE:
for (Ord<RexNode> operand : Ord.zip(call.getOperands())) {
  if (translator.isNullable(operand.e)) {
    list.add(translator.translate(operand.e,NullAs.IS_NOT_NULL));
    translator=translator.setNullable(operand.e,false);
  }
}
list.add(implementCall(translator,call,implementor,nullAs));
return Expressions.foldAnd(list);
case NOT_POSSIBLE:
translator=translator.setNullable(call,false);
default :
return implementCall(translator,call,implementor,nullAs);
}
}
Program: 111893
Project: 111893
Buggy source:
private static Expression implementCall(RexToLixTranslator translator,RexCall call,NotNullImplementor implementor,NullAs nullAs){
  final List<Expression> translatedOperands=translator.translateList(call.getOperandList());
switch (nullAs) {
case NOT_POSSIBLE:
    for (    Expression translatedOperand : translatedOperands) {
      if (isConstantNull(translatedOperand)) {
        return NULL_EXPR;
      }
    }
}
return implementor.implement(translator,call,translatedOperands);
}

Fixed version (ground truth):
private static Expression implementCall(RexToLixTranslator translator,RexCall call,NotNullImplementor implementor,NullAs nullAs){
  final List<Expression> translatedOperands=translator.translateList(call.getOperandList());
switch (nullAs) {
case NOT_POSSIBLE:
    for (    Expression translatedOperand : translatedOperands) {
      if (Expressions.isConstantNull(translatedOperand)) {
        return NULL_EXPR;
      }
    }
}
return implementor.implement(translator,call,translatedOperands);
}
Program: 111894
Project: 111894
Buggy source:
public Expression generateAccessor(List<Integer> fields){
  ParameterExpression v1=Expressions.parameter(javaRowClass,"String_Node_Str");
switch (fields.size()) {
case 0:
    return Expressions.lambda(Function1.class,Expressions.field(null,Collections.class,"String_Node_Str"),v1);
case 1:
  int field0=fields.get(0);
Class returnType=fieldClasses.get(field0);
Expression fieldReference=Types.castIfNecessary(returnType,fieldReference(v1,field0));
return Expressions.lambda(Function1.class,fieldReference,v1);
default :
Expressions.FluentList<Expression> list=Expressions.list();
for (int field : fields) {
list.add(fieldReference(v1,field));
}
return Expressions.lambda(Function1.class,Expressions.newArrayInit(Object.class,list),v1);
}
}

Fixed version (ground truth):
public Expression generateAccessor(List<Integer> fields){
  ParameterExpression v1=Expressions.parameter(javaRowClass,"String_Node_Str");
switch (fields.size()) {
case 0:
    return Expressions.lambda(Function1.class,Expressions.field(null,Collections.class,"String_Node_Str"),v1);
case 1:
  int field0=fields.get(0);
Class returnType=fieldClasses.get(field0);
Expression fieldReference=Types.castIfNecessary(returnType,fieldReference(v1,field0));
return Expressions.lambda(Function1.class,fieldReference,v1);
default :
Expressions.FluentList<Expression> list=Expressions.list();
for (int field : fields) {
list.add(fieldReference(v1,field));
}
return Expressions.lambda(Function1.class,Expressions.call(BuiltinMethod.ARRAYS_AS_LIST.method,Expressions.newArrayInit(Object.class,list)),v1);
}
}
Program: 111896
Project: 111896
Buggy source:
/** 
 * Creates a call to the CAST operator, expanding if possible.
 * @param type Type to cast to
 * @param exp Expression being cast
 * @return Call to CAST operator
 */
public RexNode makeCast(RelDataType type,RexNode exp){
  final SqlTypeName sqlType=type.getSqlTypeName();
  if (exp instanceof RexLiteral) {
    RexLiteral literal=(RexLiteral)exp;
    final Comparable value=literal.getValue();
    if (RexLiteral.valueMatchesType(value,sqlType,false) && (!(value instanceof NlsString) || type.getPrecision() >= ((NlsString)value).getValue().length())) {
      return makeLiteral(value,type,literal.getTypeName());
    }
  }
 else   if (SqlTypeUtil.isInterval(type) && SqlTypeUtil.isExactNumeric(exp.getType())) {
    return makeCastExactToInterval(type,exp);
  }
 else   if (SqlTypeUtil.isExactNumeric(type) && SqlTypeUtil.isInterval(exp.getType())) {
    return makeCastIntervalToExact(type,exp);
  }
 else   if (sqlType == SqlTypeName.BOOLEAN && SqlTypeUtil.isExactNumeric(exp.getType())) {
    return makeCastExactToBoolean(type,exp);
  }
 else   if (exp.getType().getSqlTypeName() == SqlTypeName.BOOLEAN && SqlTypeUtil.isExactNumeric(type)) {
    return makeCastBooleanToExact(type,exp);
  }
  return makeAbstractCast(type,exp);
}

Fixed version (ground truth):
/** 
 * Creates a call to the CAST operator, expanding if possible.
 * @param type Type to cast to
 * @param exp Expression being cast
 * @return Call to CAST operator
 */
public RexNode makeCast(RelDataType type,RexNode exp){
  final SqlTypeName sqlType=type.getSqlTypeName();
  if (exp instanceof RexLiteral) {
    RexLiteral literal=(RexLiteral)exp;
    final Comparable value=literal.getValue();
    if (RexLiteral.valueMatchesType(value,sqlType,false) && (!(value instanceof NlsString) || (type instanceof BasicSqlType && type.getPrecision() >= ((NlsString)value).getValue().length()))) {
      return makeLiteral(value,type,literal.getTypeName());
    }
  }
 else   if (SqlTypeUtil.isInterval(type) && SqlTypeUtil.isExactNumeric(exp.getType())) {
    return makeCastExactToInterval(type,exp);
  }
 else   if (SqlTypeUtil.isExactNumeric(type) && SqlTypeUtil.isInterval(exp.getType())) {
    return makeCastIntervalToExact(type,exp);
  }
 else   if (sqlType == SqlTypeName.BOOLEAN && SqlTypeUtil.isExactNumeric(exp.getType())) {
    return makeCastExactToBoolean(type,exp);
  }
 else   if (exp.getType().getSqlTypeName() == SqlTypeName.BOOLEAN && SqlTypeUtil.isExactNumeric(type)) {
    return makeCastBooleanToExact(type,exp);
  }
  return makeAbstractCast(type,exp);
}
Program: 111898
Project: 111898
Buggy source:
/** 
 * Creates a TernaryExpression, given the left and right operands, by calling an appropriate factory method. 
 */
public static TernaryExpression makeTernary(ExpressionType ternaryType,Expression e0,Expression e1,Expression e2){
  final Type type=e1.getType();
  return new TernaryExpression(ternaryType,type,e0,e1,e2);
}

Fixed version (ground truth):
/** 
 * Creates a TernaryExpression, given the left and right operands, by calling an appropriate factory method. 
 */
public static TernaryExpression makeTernary(ExpressionType ternaryType,Expression e0,Expression e1,Expression e2){
  final Type type;
switch (ternaryType) {
case Conditional:
    type=isConstantNull(e1) ? box(e2.getType()) : isConstantNull(e2) ? box(e1.getType()) : Types.gcd(e1.getType(),e2.getType());
  break;
default :
type=e1.getType();
}
return new TernaryExpression(ternaryType,type,e0,e1,e2);
}
Program: 111899
Project: 111899
Buggy source:
/** 
 * Returns the most restrictive type that is assignable from all given types. 
 */
static Type gcd(Type... types){
  if (types.length == 0) {
    return Object.class;
  }
  for (int i=1; i < types.length; i++) {
    if (types[i] != types[0]) {
      return Object.class;
    }
  }
  return types[0];
}

Fixed version (ground truth):
/** 
 * Returns the most restrictive type that is assignable from all given types. 
 */
static Type gcd(Type... types){
  if (types.length == 0) {
    return Object.class;
  }
  Type best=types[0];
  Primitive bestPrimitive=Primitive.of(best);
  if (bestPrimitive != null) {
    for (int i=1; i < types.length; i++) {
      final Primitive primitive=Primitive.of(types[i]);
      if (primitive == null) {
        return Object.class;
      }
      if (primitive.assignableFrom(bestPrimitive)) {
        bestPrimitive=primitive;
      }
 else       if (bestPrimitive.assignableFrom(primitive)) {
      }
 else       if (bestPrimitive == Primitive.CHAR || bestPrimitive == Primitive.BYTE) {
        bestPrimitive=Primitive.INT;
        --i;
      }
 else {
        return Object.class;
      }
    }
    return bestPrimitive.primitiveClass;
  }
 else {
    for (int i=1; i < types.length; i++) {
      if (types[i] != types[0]) {
        return Object.class;
      }
    }
  }
  return types[0];
}
Program: 111900
Project: 111900
Buggy source:
public Float apply(T1 a0){
  return f.apply(a0);
}

Fixed version (ground truth):
/** 
 * Creates a copy of a list, applying a function to each element. 
 */
public static <T1,R>List<R> apply(final List<T1> list,final Function1<T1,R> f){
  final ArrayList<R> list2=new ArrayList<R>(list.size());
  for (  T1 t : list) {
    list2.add(f.apply(t));
  }
  return list2;
}
Program: 111901
Project: 111901
Buggy source:
/** 
 * Adapts a   {@link FloatFunction1} (that returns a {@code float}) to an   {@link Function1} returning a {@link Float}. 
 */
public static <T1>Function1<T1,Float> adapt(final FloatFunction1<T1> f){
  return new Function1<T1,Float>(){
    public Float apply(    T1 a0){
      return f.apply(a0);
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Creates a view of a list that applies a function to each element. 
 */
public static <T1,R>List<R> adapt(final List<T1> list,final Function1<T1,R> f){
  return new AbstractList<R>(){
    public R get(    int index){
      return f.apply(list.get(index));
    }
    public int size(){
      return list.size();
    }
  }
;
}