Program: 12194
Project: 12194
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;
    Set<Expression> switchCaseExpressions=new LinkedHashSet<Expression>();
    for (    Statement statement2 : statements) {
      if (statement2 instanceof SwitchCase) {
        SwitchCase switchCase=(SwitchCase)statement2;
        switchCaseExpression=switchCase.getExpression();
        isDefaultCase=switchCase.isDefault();
        if (!isDefaultCase)         switchCaseExpressions.add(switchCaseExpression);
      }
 else {
        if (!(statement2 instanceof BreakStatement)) {
          for (          Expression expression : switchCaseExpressions) {
            typeCheckElimination.addTypeCheck(expression,statement2);
          }
          if (!isDefaultCase) {
            typeCheckElimination.addDefaultCaseStatement(statement2);
          }
        }
        List<Statement> branchingStatements=statementExtractor.getBranchingStatements(statement2);
        if (statement2 instanceof BreakStatement || statement2 instanceof ReturnStatement || branchingStatements.size() > 0) {
          switchCaseExpressions.clear();
        }
      }
    }
    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;
    Set<Expression> switchCaseExpressions=new LinkedHashSet<Expression>();
    for (    Statement statement2 : statements) {
      if (statement2 instanceof SwitchCase) {
        SwitchCase switchCase=(SwitchCase)statement2;
        switchCaseExpression=switchCase.getExpression();
        isDefaultCase=switchCase.isDefault();
        if (!isDefaultCase)         switchCaseExpressions.add(switchCaseExpression);
      }
 else {
        if (!(statement2 instanceof BreakStatement)) {
          for (          Expression expression : switchCaseExpressions) {
            typeCheckElimination.addTypeCheck(expression,statement2);
          }
          if (isDefaultCase) {
            typeCheckElimination.addDefaultCaseStatement(statement2);
          }
        }
        List<Statement> branchingStatements=statementExtractor.getBranchingStatements(statement2);
        if (statement2 instanceof BreakStatement || statement2 instanceof ReturnStatement || branchingStatements.size() > 0) {
          switchCaseExpressions.clear();
        }
      }
    }
    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;
}