Program: 12221
Project: 12221
Buggy source:
public List<TypeCheckElimination> generateTypeCheckEliminations(){
  List<TypeCheckElimination> typeCheckEliminations=new ArrayList<TypeCheckElimination>();
  StatementExtractor statementExtractor=new StatementExtractor();
  List<Statement> switchStatements=statementExtractor.getSwitchStatements(compositeStatement.getStatement());
  for (  Statement statement : switchStatements) {
    SwitchStatement switchStatement=(SwitchStatement)statement;
    TypeCheckElimination typeCheckElimination=new TypeCheckElimination();
    typeCheckElimination.setTypeCheckCodeFragment(switchStatement);
    List<Statement> statements=switchStatement.statements();
    Expression switchCaseExpression=null;
    boolean isDefaultCase=false;
    for (    Statement statement2 : statements) {
      if (statement2 instanceof SwitchCase) {
        SwitchCase switchCase=(SwitchCase)statement2;
        switchCaseExpression=switchCase.getExpression();
        isDefaultCase=switchCase.isDefault();
      }
 else {
        if (!isDefaultCase) {
          if (!(statement2 instanceof BreakStatement))           typeCheckElimination.addTypeCheck(switchCaseExpression,statement2);
        }
 else {
          if (!(statement2 instanceof BreakStatement))           typeCheckElimination.addDefaultCaseStatement(statement2);
        }
      }
    }
    typeCheckEliminations.add(typeCheckElimination);
  }
  List<Statement> ifStatements=statementExtractor.getIfStatements(compositeStatement.getStatement());
  TypeCheckElimination typeCheckElimination=new TypeCheckElimination();
  int i=0;
  for (  Statement statement : ifStatements) {
    IfStatement ifStatement=(IfStatement)statement;
    Expression ifExpression=ifStatement.getExpression();
    Statement thenStatement=ifStatement.getThenStatement();
    if (thenStatement instanceof Block) {
      Block block=(Block)thenStatement;
      List<Statement> statements=block.statements();
      for (      Statement statement2 : statements) {
        typeCheckElimination.addTypeCheck(ifExpression,statement2);
      }
    }
 else {
      typeCheckElimination.addTypeCheck(ifExpression,thenStatement);
    }
    Statement elseStatement=ifStatement.getElseStatement();
    if (elseStatement != null) {
      if (elseStatement instanceof Block) {
        Block block=(Block)elseStatement;
        List<Statement> statements=block.statements();
        for (        Statement statement2 : statements) {
          typeCheckElimination.addDefaultCaseStatement(statement2);
        }
      }
 else       if (!(elseStatement instanceof IfStatement)) {
        typeCheckElimination.addDefaultCaseStatement(elseStatement);
      }
    }
    if (ifStatements.size() - 1 > i) {
      IfStatement nextIfStatement=(IfStatement)ifStatements.get(i + 1);
      if (!ifStatement.getParent().equals(nextIfStatement)) {
        typeCheckElimination.setTypeCheckCodeFragment(ifStatement);
        typeCheckEliminations.add(typeCheckElimination);
        typeCheckElimination=new TypeCheckElimination();
      }
    }
 else {
      typeCheckElimination.setTypeCheckCodeFragment(ifStatement);
      typeCheckEliminations.add(typeCheckElimination);
    }
    i++;
  }
  return typeCheckEliminations;
}

Fixed version (ground truth):
public List<TypeCheckElimination> generateTypeCheckEliminations(){
  List<TypeCheckElimination> typeCheckEliminations=new ArrayList<TypeCheckElimination>();
  StatementExtractor statementExtractor=new StatementExtractor();
  List<Statement> switchStatements=statementExtractor.getSwitchStatements(compositeStatement.getStatement());
  for (  Statement statement : switchStatements) {
    SwitchStatement switchStatement=(SwitchStatement)statement;
    TypeCheckElimination typeCheckElimination=new TypeCheckElimination();
    typeCheckElimination.setTypeCheckCodeFragment(switchStatement);
    List<Statement> statements=switchStatement.statements();
    Expression switchCaseExpression=null;
    boolean isDefaultCase=false;
    Map<Expression,Integer> switchCaseExpressionStatementCounterMap=new LinkedHashMap<Expression,Integer>();
    for (    Statement statement2 : statements) {
      if (statement2 instanceof SwitchCase) {
        SwitchCase switchCase=(SwitchCase)statement2;
        switchCaseExpression=switchCase.getExpression();
        isDefaultCase=switchCase.isDefault();
        if (!isDefaultCase)         switchCaseExpressionStatementCounterMap.put(switchCaseExpression,0);
      }
 else {
        if (!isDefaultCase) {
          if (!(statement2 instanceof BreakStatement)) {
            switchCaseExpressionStatementCounterMap.put(switchCaseExpression,switchCaseExpressionStatementCounterMap.get(switchCaseExpression) + 1);
            typeCheckElimination.addTypeCheck(switchCaseExpression,statement2);
          }
 else {
            switchCaseExpressionStatementCounterMap.clear();
          }
        }
 else {
          if (!(statement2 instanceof BreakStatement)) {
            for (            Expression expression : switchCaseExpressionStatementCounterMap.keySet()) {
              if (switchCaseExpressionStatementCounterMap.get(expression) == 0) {
                typeCheckElimination.addTypeCheck(expression,statement2);
              }
            }
            typeCheckElimination.addDefaultCaseStatement(statement2);
          }
        }
      }
    }
    typeCheckEliminations.add(typeCheckElimination);
  }
  List<Statement> ifStatements=statementExtractor.getIfStatements(compositeStatement.getStatement());
  TypeCheckElimination typeCheckElimination=new TypeCheckElimination();
  int i=0;
  for (  Statement statement : ifStatements) {
    IfStatement ifStatement=(IfStatement)statement;
    Expression ifExpression=ifStatement.getExpression();
    Statement thenStatement=ifStatement.getThenStatement();
    if (thenStatement instanceof Block) {
      Block block=(Block)thenStatement;
      List<Statement> statements=block.statements();
      for (      Statement statement2 : statements) {
        typeCheckElimination.addTypeCheck(ifExpression,statement2);
      }
    }
 else {
      typeCheckElimination.addTypeCheck(ifExpression,thenStatement);
    }
    Statement elseStatement=ifStatement.getElseStatement();
    if (elseStatement != null) {
      if (elseStatement instanceof Block) {
        Block block=(Block)elseStatement;
        List<Statement> statements=block.statements();
        for (        Statement statement2 : statements) {
          typeCheckElimination.addDefaultCaseStatement(statement2);
        }
      }
 else       if (!(elseStatement instanceof IfStatement)) {
        typeCheckElimination.addDefaultCaseStatement(elseStatement);
      }
    }
    if (ifStatements.size() - 1 > i) {
      IfStatement nextIfStatement=(IfStatement)ifStatements.get(i + 1);
      if (!ifStatement.getParent().equals(nextIfStatement)) {
        typeCheckElimination.setTypeCheckCodeFragment(ifStatement);
        typeCheckEliminations.add(typeCheckElimination);
        typeCheckElimination=new TypeCheckElimination();
      }
    }
 else {
      typeCheckElimination.setTypeCheckCodeFragment(ifStatement);
      typeCheckEliminations.add(typeCheckElimination);
    }
    i++;
  }
  return typeCheckEliminations;
}