Program: 12222
Project: 12222
Buggy source:
public void identifyTypeLocalVariableAccessesInTypeCheckMethod(){
  List<String> staticFieldNames=typeCheckElimination.getStaticFieldNames();
  Block methodBody=typeCheckElimination.getTypeCheckMethod().getBody();
  if (methodBody != null) {
    List<Statement> statements=methodBody.statements();
    ExpressionExtractor expressionExtractor=new ExpressionExtractor();
    for (    Statement statement : statements) {
      List<Expression> infixExpressions=expressionExtractor.getInfixExpressions(statement);
      for (      Expression expression : infixExpressions) {
        InfixExpression infixExpression=(InfixExpression)expression;
        Expression leftOperand=infixExpression.getLeftOperand();
        Expression rightOperand=infixExpression.getRightOperand();
        SimpleName accessedVariable=null;
        SimpleName comparedVariable=null;
        boolean typeLocalVariableIsFound=false;
        if (leftOperand instanceof SimpleName) {
          accessedVariable=(SimpleName)leftOperand;
        }
 else         if (leftOperand instanceof FieldAccess) {
          FieldAccess fieldAccess=(FieldAccess)leftOperand;
          accessedVariable=fieldAccess.getName();
        }
        if (rightOperand instanceof SimpleName) {
          comparedVariable=(SimpleName)rightOperand;
        }
 else         if (rightOperand instanceof QualifiedName) {
          QualifiedName qualifiedName=(QualifiedName)rightOperand;
          comparedVariable=qualifiedName.getName();
        }
 else         if (rightOperand instanceof FieldAccess) {
          FieldAccess fieldAccess=(FieldAccess)rightOperand;
          comparedVariable=fieldAccess.getName();
        }
        if (accessedVariable != null) {
          IBinding leftOperandBinding=accessedVariable.resolveBinding();
          if (leftOperandBinding.getKind() == IBinding.VARIABLE) {
            IVariableBinding accessedVariableBinding=(IVariableBinding)leftOperandBinding;
            if (typeCheckElimination.getTypeLocalVariable().resolveBinding().isEqualTo(accessedVariable.resolveBinding())) {
              typeLocalVariableIsFound=true;
              if (comparedVariable != null) {
                IBinding rightOperandBinding=comparedVariable.resolveBinding();
                if (rightOperandBinding.getKind() == IBinding.VARIABLE) {
                  IVariableBinding comparedVariableBinding=(IVariableBinding)rightOperandBinding;
                  if (comparedVariableBinding.isField() && (comparedVariableBinding.getModifiers() & Modifier.STATIC) != 0 && !staticFieldNames.contains(comparedVariable.getIdentifier())) {
                    String subclassName="String_Node_Str";
                    StringTokenizer tokenizer=new StringTokenizer(comparedVariable.getIdentifier(),"String_Node_Str");
                    while (tokenizer.hasMoreTokens()) {
                      String tempName=tokenizer.nextToken().toLowerCase().toString();
                      subclassName+=tempName.subSequence(0,1).toString().toUpperCase() + tempName.subSequence(1,tempName.length()).toString();
                    }
                    if (!containsStaticFieldKey(comparedVariable))                     additionalStaticFields.put(comparedVariable,subclassName);
                  }
                }
              }
            }
          }
        }
        if (!typeLocalVariableIsFound) {
          if (rightOperand instanceof SimpleName) {
            accessedVariable=(SimpleName)rightOperand;
          }
 else           if (rightOperand instanceof FieldAccess) {
            FieldAccess fieldAccess=(FieldAccess)rightOperand;
            accessedVariable=fieldAccess.getName();
          }
          if (leftOperand instanceof SimpleName) {
            comparedVariable=(SimpleName)leftOperand;
          }
 else           if (leftOperand instanceof QualifiedName) {
            QualifiedName qualifiedName=(QualifiedName)leftOperand;
            comparedVariable=qualifiedName.getName();
          }
 else           if (leftOperand instanceof FieldAccess) {
            FieldAccess fieldAccess=(FieldAccess)leftOperand;
            comparedVariable=fieldAccess.getName();
          }
          if (accessedVariable != null) {
            IBinding rightOperandBinding=accessedVariable.resolveBinding();
            if (rightOperandBinding.getKind() == IBinding.VARIABLE) {
              IVariableBinding accessedVariableBinding=(IVariableBinding)rightOperandBinding;
              if (typeCheckElimination.getTypeLocalVariable().resolveBinding().isEqualTo(accessedVariable.resolveBinding())) {
                if (comparedVariable != null) {
                  IBinding leftOperandBinding=comparedVariable.resolveBinding();
                  if (leftOperandBinding.getKind() == IBinding.VARIABLE) {
                    IVariableBinding comparedVariableBinding=(IVariableBinding)leftOperandBinding;
                    if (comparedVariableBinding.isField() && (comparedVariableBinding.getModifiers() & Modifier.STATIC) != 0 && !staticFieldNames.contains(comparedVariable.getIdentifier())) {
                      String subclassName="String_Node_Str";
                      StringTokenizer tokenizer=new StringTokenizer(comparedVariable.getIdentifier(),"String_Node_Str");
                      while (tokenizer.hasMoreTokens()) {
                        String tempName=tokenizer.nextToken().toLowerCase().toString();
                        subclassName+=tempName.subSequence(0,1).toString().toUpperCase() + tempName.subSequence(1,tempName.length()).toString();
                      }
                      if (!containsStaticFieldKey(comparedVariable))                       additionalStaticFields.put(comparedVariable,subclassName);
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private void identifyTypeLocalVariableAccessesInTypeCheckMethod(){
  List<String> staticFieldNames=typeCheckElimination.getStaticFieldNames();
  Block methodBody=typeCheckElimination.getTypeCheckMethod().getBody();
  if (methodBody != null) {
    List<Statement> statements=methodBody.statements();
    ExpressionExtractor expressionExtractor=new ExpressionExtractor();
    for (    Statement statement : statements) {
      List<Expression> infixExpressions=expressionExtractor.getInfixExpressions(statement);
      for (      Expression expression : infixExpressions) {
        InfixExpression infixExpression=(InfixExpression)expression;
        Expression leftOperand=infixExpression.getLeftOperand();
        Expression rightOperand=infixExpression.getRightOperand();
        SimpleName accessedVariable=null;
        SimpleName comparedVariable=null;
        boolean typeLocalVariableIsFound=false;
        if (leftOperand instanceof SimpleName) {
          accessedVariable=(SimpleName)leftOperand;
        }
 else         if (leftOperand instanceof FieldAccess) {
          FieldAccess fieldAccess=(FieldAccess)leftOperand;
          accessedVariable=fieldAccess.getName();
        }
        if (rightOperand instanceof SimpleName) {
          comparedVariable=(SimpleName)rightOperand;
        }
 else         if (rightOperand instanceof QualifiedName) {
          QualifiedName qualifiedName=(QualifiedName)rightOperand;
          comparedVariable=qualifiedName.getName();
        }
 else         if (rightOperand instanceof FieldAccess) {
          FieldAccess fieldAccess=(FieldAccess)rightOperand;
          comparedVariable=fieldAccess.getName();
        }
        if (accessedVariable != null) {
          IBinding leftOperandBinding=accessedVariable.resolveBinding();
          if (leftOperandBinding.getKind() == IBinding.VARIABLE) {
            IVariableBinding accessedVariableBinding=(IVariableBinding)leftOperandBinding;
            if (typeCheckElimination.getTypeLocalVariable().resolveBinding().isEqualTo(accessedVariable.resolveBinding())) {
              typeLocalVariableIsFound=true;
              if (comparedVariable != null) {
                IBinding rightOperandBinding=comparedVariable.resolveBinding();
                if (rightOperandBinding.getKind() == IBinding.VARIABLE) {
                  IVariableBinding comparedVariableBinding=(IVariableBinding)rightOperandBinding;
                  if (comparedVariableBinding.isField() && (comparedVariableBinding.getModifiers() & Modifier.STATIC) != 0 && !staticFieldNames.contains(comparedVariable.getIdentifier())) {
                    String subclassName="String_Node_Str";
                    StringTokenizer tokenizer=new StringTokenizer(comparedVariable.getIdentifier(),"String_Node_Str");
                    while (tokenizer.hasMoreTokens()) {
                      String tempName=tokenizer.nextToken().toLowerCase().toString();
                      subclassName+=tempName.subSequence(0,1).toString().toUpperCase() + tempName.subSequence(1,tempName.length()).toString();
                    }
                    if (!containsStaticFieldKey(comparedVariable))                     additionalStaticFields.put(comparedVariable,subclassName);
                  }
                }
              }
            }
          }
        }
        if (!typeLocalVariableIsFound) {
          if (rightOperand instanceof SimpleName) {
            accessedVariable=(SimpleName)rightOperand;
          }
 else           if (rightOperand instanceof FieldAccess) {
            FieldAccess fieldAccess=(FieldAccess)rightOperand;
            accessedVariable=fieldAccess.getName();
          }
          if (leftOperand instanceof SimpleName) {
            comparedVariable=(SimpleName)leftOperand;
          }
 else           if (leftOperand instanceof QualifiedName) {
            QualifiedName qualifiedName=(QualifiedName)leftOperand;
            comparedVariable=qualifiedName.getName();
          }
 else           if (leftOperand instanceof FieldAccess) {
            FieldAccess fieldAccess=(FieldAccess)leftOperand;
            comparedVariable=fieldAccess.getName();
          }
          if (accessedVariable != null) {
            IBinding rightOperandBinding=accessedVariable.resolveBinding();
            if (rightOperandBinding.getKind() == IBinding.VARIABLE) {
              IVariableBinding accessedVariableBinding=(IVariableBinding)rightOperandBinding;
              if (typeCheckElimination.getTypeLocalVariable().resolveBinding().isEqualTo(accessedVariable.resolveBinding())) {
                if (comparedVariable != null) {
                  IBinding leftOperandBinding=comparedVariable.resolveBinding();
                  if (leftOperandBinding.getKind() == IBinding.VARIABLE) {
                    IVariableBinding comparedVariableBinding=(IVariableBinding)leftOperandBinding;
                    if (comparedVariableBinding.isField() && (comparedVariableBinding.getModifiers() & Modifier.STATIC) != 0 && !staticFieldNames.contains(comparedVariable.getIdentifier())) {
                      String subclassName="String_Node_Str";
                      StringTokenizer tokenizer=new StringTokenizer(comparedVariable.getIdentifier(),"String_Node_Str");
                      while (tokenizer.hasMoreTokens()) {
                        String tempName=tokenizer.nextToken().toLowerCase().toString();
                        subclassName+=tempName.subSequence(0,1).toString().toUpperCase() + tempName.subSequence(1,tempName.length()).toString();
                      }
                      if (!containsStaticFieldKey(comparedVariable))                       additionalStaticFields.put(comparedVariable,subclassName);
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}