Program: 12176
Project: 12176
Buggy source:
public TypeCheckEliminationResults generateTypeCheckEliminations(){
  TypeCheckEliminationResults typeCheckEliminationResults=new TypeCheckEliminationResults();
  Map<TypeCheckElimination,List<SimpleName>> staticFieldMap=new LinkedHashMap<TypeCheckElimination,List<SimpleName>>();
  Map<Integer,ArrayList<TypeCheckElimination>> staticFieldRankMap=new TreeMap<Integer,ArrayList<TypeCheckElimination>>();
  Map<String,ArrayList<TypeCheckElimination>> inheritanceTreeMap=new LinkedHashMap<String,ArrayList<TypeCheckElimination>>();
  CompleteInheritanceDetection inheritanceDetection=new CompleteInheritanceDetection(this);
  for (  ClassObject classObject : classList) {
    List<TypeCheckElimination> eliminations=classObject.generateTypeCheckEliminations();
    for (    TypeCheckElimination elimination : eliminations) {
      List<SimpleName> staticFields=elimination.getStaticFields();
      if (!staticFields.isEmpty()) {
        if (allStaticFieldsWithinSystemBoundary(staticFields)) {
          inheritanceHierarchyMatchingWithStaticTypes(elimination,inheritanceDetection);
          boolean isValid=false;
          if (elimination.getTypeField() != null) {
            IVariableBinding typeFieldBinding=elimination.getTypeField().resolveBinding();
            ITypeBinding typeFieldTypeBinding=typeFieldBinding.getType();
            if ((typeFieldTypeBinding.isPrimitive() && typeFieldTypeBinding.getQualifiedName().equals("String_Node_Str")) || typeFieldTypeBinding.isEnum()) {
              isValid=true;
            }
          }
 else           if (elimination.getTypeLocalVariable() != null) {
            IVariableBinding typeLocalVariableBinding=elimination.getTypeLocalVariable().resolveBinding();
            ITypeBinding typeLocalVariableTypeBinding=typeLocalVariableBinding.getType();
            if ((typeLocalVariableTypeBinding.isPrimitive() && typeLocalVariableTypeBinding.getQualifiedName().equals("String_Node_Str")) || typeLocalVariableTypeBinding.isEnum()) {
              isValid=true;
            }
          }
 else           if (elimination.getTypeMethodInvocation() != null) {
            MethodInvocation typeMethodInvocation=elimination.getTypeMethodInvocation();
            IMethodBinding typeMethodInvocationBinding=typeMethodInvocation.resolveMethodBinding();
            ITypeBinding typeMethodInvocationDeclaringClass=typeMethodInvocationBinding.getDeclaringClass();
            ITypeBinding typeMethodInvocationReturnType=typeMethodInvocationBinding.getReturnType();
            ClassObject declaringClassObject=getClassObject(typeMethodInvocationDeclaringClass.getQualifiedName());
            if (((typeMethodInvocationReturnType.isPrimitive() && typeMethodInvocationReturnType.getQualifiedName().equals("String_Node_Str")) || typeMethodInvocationReturnType.isEnum()) && declaringClassObject != null) {
              MethodDeclaration invokedMethodDeclaration=null;
              ListIterator<MethodObject> methodIterator=declaringClassObject.getMethodIterator();
              while (methodIterator.hasNext()) {
                MethodObject methodObject=methodIterator.next();
                MethodDeclaration methodDeclaration=methodObject.getMethodDeclaration();
                if (typeMethodInvocationBinding.isEqualTo(methodDeclaration.resolveBinding())) {
                  invokedMethodDeclaration=methodDeclaration;
                  break;
                }
              }
              SimpleName fieldInstruction=MethodDeclarationUtility.isGetter(invokedMethodDeclaration);
              if (fieldInstruction != null) {
                ListIterator<FieldObject> fieldIterator=declaringClassObject.getFieldIterator();
                while (fieldIterator.hasNext()) {
                  FieldObject fieldObject=fieldIterator.next();
                  VariableDeclarationFragment fragment=fieldObject.getVariableDeclarationFragment();
                  if (fieldInstruction.resolveBinding().isEqualTo(fragment.resolveBinding())) {
                    elimination.setForeignTypeField(fragment);
                    break;
                  }
                }
                isValid=true;
              }
 else               if (invokedMethodDeclaration.getBody() == null) {
                InheritanceTree tree=elimination.getInheritanceTreeMatchingWithStaticTypes();
                if (tree != null) {
                  Expression typeMethodInvocationExpression=typeMethodInvocation.getExpression();
                  ITypeBinding typeCheckClassBinding=elimination.getTypeCheckClass().resolveBinding();
                  ClassObject typeCheckClassObject=getClassObject(typeCheckClassBinding.getQualifiedName());
                  SimpleName invoker=null;
                  if (typeMethodInvocationExpression instanceof SimpleName) {
                    invoker=(SimpleName)typeMethodInvocationExpression;
                  }
 else                   if (typeMethodInvocationExpression instanceof FieldAccess) {
                    FieldAccess fieldAccess=(FieldAccess)typeMethodInvocationExpression;
                    invoker=fieldAccess.getName();
                  }
                  if (invoker != null) {
                    IBinding binding=invoker.resolveBinding();
                    if (binding.getKind() == IBinding.VARIABLE) {
                      IVariableBinding variableBinding=(IVariableBinding)binding;
                      if (variableBinding.isField()) {
                        ListIterator<FieldObject> fieldIterator=typeCheckClassObject.getFieldIterator();
                        while (fieldIterator.hasNext()) {
                          FieldObject fieldObject=fieldIterator.next();
                          VariableDeclarationFragment fragment=fieldObject.getVariableDeclarationFragment();
                          if (variableBinding.isEqualTo(fragment.resolveBinding())) {
                            elimination.setTypeField(fragment);
                            break;
                          }
                        }
                      }
 else                       if (variableBinding.isParameter()) {
                        List<SingleVariableDeclaration> parameters=elimination.getTypeCheckMethodParameters();
                        for (                        SingleVariableDeclaration parameter : parameters) {
                          IVariableBinding parameterVariableBinding=parameter.resolveBinding();
                          if (parameterVariableBinding.isEqualTo(variableBinding)) {
                            elimination.setTypeLocalVariable(parameter);
                            break;
                          }
                        }
                      }
 else {
                        StatementExtractor statementExtractor=new StatementExtractor();
                        Block typeCheckMethodBody=elimination.getTypeCheckMethod().getBody();
                        List<Statement> variableDeclarationStatements=statementExtractor.getVariableDeclarations(typeCheckMethodBody);
                        for (                        Statement vDStatement : variableDeclarationStatements) {
                          VariableDeclarationStatement variableDeclarationStatement=(VariableDeclarationStatement)vDStatement;
                          List<VariableDeclarationFragment> fragments=variableDeclarationStatement.fragments();
                          for (                          VariableDeclarationFragment fragment : fragments) {
                            IVariableBinding fragmentVariableBinding=fragment.resolveBinding();
                            if (fragmentVariableBinding.isEqualTo(variableBinding)) {
                              elimination.setTypeLocalVariable(fragment);
                              break;
                            }
                          }
                        }
                        List<Statement> enhancedForStatements=statementExtractor.getEnhancedForStatements(typeCheckMethodBody);
                        for (                        Statement eFStatement : enhancedForStatements) {
                          EnhancedForStatement enhancedForStatement=(EnhancedForStatement)eFStatement;
                          SingleVariableDeclaration formalParameter=enhancedForStatement.getParameter();
                          IVariableBinding parameterVariableBinding=formalParameter.resolveBinding();
                          if (parameterVariableBinding.isEqualTo(variableBinding)) {
                            elimination.setTypeLocalVariable(formalParameter);
                            break;
                          }
                        }
                      }
                      ITypeBinding invokerType=variableBinding.getType();
                      if (invokerType.getQualifiedName().equals(tree.getRootNode().getUserObject())) {
                        elimination.setExistingInheritanceTree(tree);
                        if (inheritanceTreeMap.containsKey(tree.getRootNode().getUserObject())) {
                          ArrayList<TypeCheckElimination> typeCheckEliminations=inheritanceTreeMap.get(tree.getRootNode().getUserObject());
                          typeCheckEliminations.add(elimination);
                        }
 else {
                          ArrayList<TypeCheckElimination> typeCheckEliminations=new ArrayList<TypeCheckElimination>();
                          typeCheckEliminations.add(elimination);
                          inheritanceTreeMap.put((String)tree.getRootNode().getUserObject(),typeCheckEliminations);
                        }
                      }
                    }
                  }
                }
              }
            }
          }
          if (isValid) {
            staticFieldMap.put(elimination,staticFields);
            int size=staticFields.size();
            if (staticFieldRankMap.containsKey(size)) {
              ArrayList<TypeCheckElimination> rank=staticFieldRankMap.get(size);
              rank.add(elimination);
            }
 else {
              ArrayList<TypeCheckElimination> rank=new ArrayList<TypeCheckElimination>();
              rank.add(elimination);
              staticFieldRankMap.put(size,rank);
            }
          }
        }
      }
 else {
        if (elimination.getTypeField() != null) {
          IVariableBinding typeFieldBinding=elimination.getTypeField().resolveBinding();
          ITypeBinding typeFieldTypeBinding=typeFieldBinding.getType();
          InheritanceTree tree=inheritanceDetection.getTree(typeFieldTypeBinding.getQualifiedName());
          elimination.setExistingInheritanceTree(tree);
        }
 else         if (elimination.getTypeLocalVariable() != null) {
          IVariableBinding typeLocalVariableBinding=elimination.getTypeLocalVariable().resolveBinding();
          ITypeBinding typeLocalVariableTypeBinding=typeLocalVariableBinding.getType();
          InheritanceTree tree=inheritanceDetection.getTree(typeLocalVariableTypeBinding.getQualifiedName());
          elimination.setExistingInheritanceTree(tree);
        }
 else         if (elimination.getTypeMethodInvocation() != null) {
          MethodInvocation typeMethodInvocation=elimination.getTypeMethodInvocation();
          IMethodBinding typeMethodInvocationBinding=typeMethodInvocation.resolveMethodBinding();
          if (typeMethodInvocationBinding.getDeclaringClass().getQualifiedName().equals("String_Node_Str") && typeMethodInvocationBinding.getName().equals("String_Node_Str")) {
            Expression typeMethodInvocationExpression=typeMethodInvocation.getExpression();
            ITypeBinding typeCheckClassBinding=elimination.getTypeCheckClass().resolveBinding();
            ClassObject typeCheckClassObject=getClassObject(typeCheckClassBinding.getQualifiedName());
            SimpleName invoker=null;
            if (typeMethodInvocationExpression instanceof SimpleName) {
              invoker=(SimpleName)typeMethodInvocationExpression;
            }
 else             if (typeMethodInvocationExpression instanceof FieldAccess) {
              FieldAccess fieldAccess=(FieldAccess)typeMethodInvocationExpression;
              invoker=fieldAccess.getName();
            }
            if (invoker != null) {
              IBinding binding=invoker.resolveBinding();
              if (binding.getKind() == IBinding.VARIABLE) {
                IVariableBinding variableBinding=(IVariableBinding)binding;
                if (variableBinding.isField()) {
                  ListIterator<FieldObject> fieldIterator=typeCheckClassObject.getFieldIterator();
                  while (fieldIterator.hasNext()) {
                    FieldObject fieldObject=fieldIterator.next();
                    VariableDeclarationFragment fragment=fieldObject.getVariableDeclarationFragment();
                    if (variableBinding.isEqualTo(fragment.resolveBinding())) {
                      elimination.setTypeField(fragment);
                      break;
                    }
                  }
                }
 else                 if (variableBinding.isParameter()) {
                  List<SingleVariableDeclaration> parameters=elimination.getTypeCheckMethodParameters();
                  for (                  SingleVariableDeclaration parameter : parameters) {
                    IVariableBinding parameterVariableBinding=parameter.resolveBinding();
                    if (parameterVariableBinding.isEqualTo(variableBinding)) {
                      elimination.setTypeLocalVariable(parameter);
                      break;
                    }
                  }
                }
 else {
                  StatementExtractor statementExtractor=new StatementExtractor();
                  Block typeCheckMethodBody=elimination.getTypeCheckMethod().getBody();
                  List<Statement> variableDeclarationStatements=statementExtractor.getVariableDeclarations(typeCheckMethodBody);
                  for (                  Statement vDStatement : variableDeclarationStatements) {
                    VariableDeclarationStatement variableDeclarationStatement=(VariableDeclarationStatement)vDStatement;
                    List<VariableDeclarationFragment> fragments=variableDeclarationStatement.fragments();
                    for (                    VariableDeclarationFragment fragment : fragments) {
                      IVariableBinding fragmentVariableBinding=fragment.resolveBinding();
                      if (fragmentVariableBinding.isEqualTo(variableBinding)) {
                        elimination.setTypeLocalVariable(fragment);
                        break;
                      }
                    }
                  }
                  List<Statement> enhancedForStatements=statementExtractor.getEnhancedForStatements(typeCheckMethodBody);
                  for (                  Statement eFStatement : enhancedForStatements) {
                    EnhancedForStatement enhancedForStatement=(EnhancedForStatement)eFStatement;
                    SingleVariableDeclaration formalParameter=enhancedForStatement.getParameter();
                    IVariableBinding parameterVariableBinding=formalParameter.resolveBinding();
                    if (parameterVariableBinding.isEqualTo(variableBinding)) {
                      elimination.setTypeLocalVariable(formalParameter);
                      break;
                    }
                  }
                }
                ITypeBinding invokerType=variableBinding.getType();
                InheritanceTree tree=inheritanceDetection.getTree(invokerType.getQualifiedName());
                elimination.setExistingInheritanceTree(tree);
              }
            }
          }
 else {
            ITypeBinding typeMethodInvocationReturnType=typeMethodInvocationBinding.getReturnType();
            InheritanceTree tree=inheritanceDetection.getTree(typeMethodInvocationReturnType.getQualifiedName());
            elimination.setExistingInheritanceTree(tree);
          }
        }
        if (elimination.getExistingInheritanceTree() != null) {
          InheritanceTree tree=elimination.getExistingInheritanceTree();
          if (inheritanceTreeMap.containsKey(tree.getRootNode().getUserObject())) {
            ArrayList<TypeCheckElimination> typeCheckEliminations=inheritanceTreeMap.get(tree.getRootNode().getUserObject());
            typeCheckEliminations.add(elimination);
          }
 else {
            ArrayList<TypeCheckElimination> typeCheckEliminations=new ArrayList<TypeCheckElimination>();
            typeCheckEliminations.add(elimination);
            inheritanceTreeMap.put((String)tree.getRootNode().getUserObject(),typeCheckEliminations);
          }
        }
      }
    }
  }
  for (  String rootNode : inheritanceTreeMap.keySet()) {
    ArrayList<TypeCheckElimination> typeCheckEliminations=inheritanceTreeMap.get(rootNode);
    typeCheckEliminationResults.addGroup(typeCheckEliminations);
  }
  List<TypeCheckElimination> sortedEliminations=new ArrayList<TypeCheckElimination>();
  List<Integer> keyList=new ArrayList<Integer>(staticFieldRankMap.keySet());
  ListIterator<Integer> keyListIterator=keyList.listIterator(keyList.size());
  while (keyListIterator.hasPrevious()) {
    Integer states=keyListIterator.previous();
    sortedEliminations.addAll(staticFieldRankMap.get(states));
  }
  while (!sortedEliminations.isEmpty()) {
    TypeCheckElimination selectedElimination=sortedEliminations.get(0);
    List<TypeCheckElimination> affectedEliminations=new ArrayList<TypeCheckElimination>();
    affectedEliminations.add(selectedElimination);
    List<SimpleName> staticFieldUnion=staticFieldMap.get(selectedElimination);
    for (    TypeCheckElimination elimination : sortedEliminations) {
      List<SimpleName> staticFields=staticFieldMap.get(elimination);
      if (!selectedElimination.equals(elimination) && nonEmptyIntersection(staticFieldUnion,staticFields)) {
        staticFieldUnion=constructUnion(staticFieldUnion,staticFields);
        affectedEliminations.add(elimination);
      }
    }
    if (affectedEliminations.size() > 1) {
      for (      TypeCheckElimination elimination : affectedEliminations) {
        List<SimpleName> staticFields=staticFieldMap.get(elimination);
        for (        SimpleName simpleName1 : staticFieldUnion) {
          boolean isContained=false;
          for (          SimpleName simpleName2 : staticFields) {
            if (simpleName1.resolveBinding().isEqualTo(simpleName2.resolveBinding())) {
              isContained=true;
              break;
            }
          }
          if (!isContained)           elimination.addAdditionalStaticField(simpleName1);
        }
      }
    }
    ArrayList<TypeCheckElimination> typeCheckEliminations=new ArrayList<TypeCheckElimination>();
    for (    TypeCheckElimination elimination : affectedEliminations) {
      if (!elimination.isTypeCheckMethodStateSetter())       typeCheckEliminations.add(elimination);
    }
    typeCheckEliminationResults.addGroup(typeCheckEliminations);
    sortedEliminations.removeAll(affectedEliminations);
  }
  identifySuperFieldAccessorMethods(typeCheckEliminationResults.getTypeCheckEliminations());
  return typeCheckEliminationResults;
}

Fixed version (ground truth):
public TypeCheckEliminationResults generateTypeCheckEliminations(){
  TypeCheckEliminationResults typeCheckEliminationResults=new TypeCheckEliminationResults();
  Map<TypeCheckElimination,List<SimpleName>> staticFieldMap=new LinkedHashMap<TypeCheckElimination,List<SimpleName>>();
  Map<Integer,ArrayList<TypeCheckElimination>> staticFieldRankMap=new TreeMap<Integer,ArrayList<TypeCheckElimination>>();
  Map<String,ArrayList<TypeCheckElimination>> inheritanceTreeMap=new LinkedHashMap<String,ArrayList<TypeCheckElimination>>();
  CompleteInheritanceDetection inheritanceDetection=new CompleteInheritanceDetection(this);
  for (  ClassObject classObject : classList) {
    List<TypeCheckElimination> eliminations=classObject.generateTypeCheckEliminations();
    for (    TypeCheckElimination elimination : eliminations) {
      List<SimpleName> staticFields=elimination.getStaticFields();
      if (!staticFields.isEmpty()) {
        if (allStaticFieldsWithinSystemBoundary(staticFields)) {
          inheritanceHierarchyMatchingWithStaticTypes(elimination,inheritanceDetection);
          boolean isValid=false;
          if (elimination.getTypeField() != null) {
            IVariableBinding typeFieldBinding=elimination.getTypeField().resolveBinding();
            ITypeBinding typeFieldTypeBinding=typeFieldBinding.getType();
            if ((typeFieldTypeBinding.isPrimitive() && typeFieldTypeBinding.getQualifiedName().equals("String_Node_Str")) || typeFieldTypeBinding.isEnum()) {
              isValid=true;
            }
          }
 else           if (elimination.getTypeLocalVariable() != null) {
            IVariableBinding typeLocalVariableBinding=elimination.getTypeLocalVariable().resolveBinding();
            ITypeBinding typeLocalVariableTypeBinding=typeLocalVariableBinding.getType();
            if ((typeLocalVariableTypeBinding.isPrimitive() && typeLocalVariableTypeBinding.getQualifiedName().equals("String_Node_Str")) || typeLocalVariableTypeBinding.isEnum()) {
              isValid=true;
            }
          }
 else           if (elimination.getTypeMethodInvocation() != null) {
            MethodInvocation typeMethodInvocation=elimination.getTypeMethodInvocation();
            IMethodBinding typeMethodInvocationBinding=typeMethodInvocation.resolveMethodBinding();
            ITypeBinding typeMethodInvocationDeclaringClass=typeMethodInvocationBinding.getDeclaringClass();
            ITypeBinding typeMethodInvocationReturnType=typeMethodInvocationBinding.getReturnType();
            ClassObject declaringClassObject=getClassObject(typeMethodInvocationDeclaringClass.getQualifiedName());
            if (((typeMethodInvocationReturnType.isPrimitive() && typeMethodInvocationReturnType.getQualifiedName().equals("String_Node_Str")) || typeMethodInvocationReturnType.isEnum()) && declaringClassObject != null) {
              MethodDeclaration invokedMethodDeclaration=null;
              ListIterator<MethodObject> methodIterator=declaringClassObject.getMethodIterator();
              while (methodIterator.hasNext()) {
                MethodObject methodObject=methodIterator.next();
                MethodDeclaration methodDeclaration=methodObject.getMethodDeclaration();
                if (typeMethodInvocationBinding.isEqualTo(methodDeclaration.resolveBinding())) {
                  invokedMethodDeclaration=methodDeclaration;
                  break;
                }
              }
              SimpleName fieldInstruction=MethodDeclarationUtility.isGetter(invokedMethodDeclaration);
              if (fieldInstruction != null) {
                ListIterator<FieldObject> fieldIterator=declaringClassObject.getFieldIterator();
                while (fieldIterator.hasNext()) {
                  FieldObject fieldObject=fieldIterator.next();
                  VariableDeclarationFragment fragment=fieldObject.getVariableDeclarationFragment();
                  if (fieldInstruction.resolveBinding().isEqualTo(fragment.resolveBinding())) {
                    elimination.setForeignTypeField(fragment);
                    break;
                  }
                }
                isValid=true;
              }
 else               if (invokedMethodDeclaration.getBody() == null) {
                InheritanceTree tree=elimination.getInheritanceTreeMatchingWithStaticTypes();
                if (tree != null) {
                  Expression typeMethodInvocationExpression=typeMethodInvocation.getExpression();
                  ITypeBinding typeCheckClassBinding=elimination.getTypeCheckClass().resolveBinding();
                  ClassObject typeCheckClassObject=getClassObject(typeCheckClassBinding.getQualifiedName());
                  SimpleName invoker=null;
                  if (typeMethodInvocationExpression instanceof SimpleName) {
                    invoker=(SimpleName)typeMethodInvocationExpression;
                  }
 else                   if (typeMethodInvocationExpression instanceof FieldAccess) {
                    FieldAccess fieldAccess=(FieldAccess)typeMethodInvocationExpression;
                    invoker=fieldAccess.getName();
                  }
                  if (invoker != null) {
                    IBinding binding=invoker.resolveBinding();
                    if (binding.getKind() == IBinding.VARIABLE) {
                      IVariableBinding variableBinding=(IVariableBinding)binding;
                      if (variableBinding.isField()) {
                        ListIterator<FieldObject> fieldIterator=typeCheckClassObject.getFieldIterator();
                        while (fieldIterator.hasNext()) {
                          FieldObject fieldObject=fieldIterator.next();
                          VariableDeclarationFragment fragment=fieldObject.getVariableDeclarationFragment();
                          if (variableBinding.isEqualTo(fragment.resolveBinding())) {
                            elimination.setTypeField(fragment);
                            break;
                          }
                        }
                      }
 else                       if (variableBinding.isParameter()) {
                        List<SingleVariableDeclaration> parameters=elimination.getTypeCheckMethodParameters();
                        for (                        SingleVariableDeclaration parameter : parameters) {
                          IVariableBinding parameterVariableBinding=parameter.resolveBinding();
                          if (parameterVariableBinding.isEqualTo(variableBinding)) {
                            elimination.setTypeLocalVariable(parameter);
                            break;
                          }
                        }
                      }
 else {
                        StatementExtractor statementExtractor=new StatementExtractor();
                        Block typeCheckMethodBody=elimination.getTypeCheckMethod().getBody();
                        List<Statement> variableDeclarationStatements=statementExtractor.getVariableDeclarations(typeCheckMethodBody);
                        for (                        Statement vDStatement : variableDeclarationStatements) {
                          VariableDeclarationStatement variableDeclarationStatement=(VariableDeclarationStatement)vDStatement;
                          List<VariableDeclarationFragment> fragments=variableDeclarationStatement.fragments();
                          for (                          VariableDeclarationFragment fragment : fragments) {
                            IVariableBinding fragmentVariableBinding=fragment.resolveBinding();
                            if (fragmentVariableBinding.isEqualTo(variableBinding)) {
                              elimination.setTypeLocalVariable(fragment);
                              break;
                            }
                          }
                        }
                        List<Statement> enhancedForStatements=statementExtractor.getEnhancedForStatements(typeCheckMethodBody);
                        for (                        Statement eFStatement : enhancedForStatements) {
                          EnhancedForStatement enhancedForStatement=(EnhancedForStatement)eFStatement;
                          SingleVariableDeclaration formalParameter=enhancedForStatement.getParameter();
                          IVariableBinding parameterVariableBinding=formalParameter.resolveBinding();
                          if (parameterVariableBinding.isEqualTo(variableBinding)) {
                            elimination.setTypeLocalVariable(formalParameter);
                            break;
                          }
                        }
                      }
                      ITypeBinding invokerType=variableBinding.getType();
                      if (invokerType.getQualifiedName().equals(tree.getRootNode().getUserObject())) {
                        elimination.setExistingInheritanceTree(tree);
                        if (inheritanceTreeMap.containsKey(tree.getRootNode().getUserObject())) {
                          ArrayList<TypeCheckElimination> typeCheckEliminations=inheritanceTreeMap.get(tree.getRootNode().getUserObject());
                          typeCheckEliminations.add(elimination);
                        }
 else {
                          ArrayList<TypeCheckElimination> typeCheckEliminations=new ArrayList<TypeCheckElimination>();
                          typeCheckEliminations.add(elimination);
                          inheritanceTreeMap.put((String)tree.getRootNode().getUserObject(),typeCheckEliminations);
                        }
                      }
                    }
                  }
                }
              }
            }
          }
          if (isValid) {
            staticFieldMap.put(elimination,staticFields);
            int size=staticFields.size();
            if (staticFieldRankMap.containsKey(size)) {
              ArrayList<TypeCheckElimination> rank=staticFieldRankMap.get(size);
              rank.add(elimination);
            }
 else {
              ArrayList<TypeCheckElimination> rank=new ArrayList<TypeCheckElimination>();
              rank.add(elimination);
              staticFieldRankMap.put(size,rank);
            }
          }
        }
      }
 else {
        if (elimination.getTypeField() != null) {
          IVariableBinding typeFieldBinding=elimination.getTypeField().resolveBinding();
          ITypeBinding typeFieldTypeBinding=typeFieldBinding.getType();
          InheritanceTree tree=inheritanceDetection.getTree(typeFieldTypeBinding.getQualifiedName());
          elimination.setExistingInheritanceTree(tree);
        }
 else         if (elimination.getTypeLocalVariable() != null) {
          IVariableBinding typeLocalVariableBinding=elimination.getTypeLocalVariable().resolveBinding();
          ITypeBinding typeLocalVariableTypeBinding=typeLocalVariableBinding.getType();
          InheritanceTree tree=inheritanceDetection.getTree(typeLocalVariableTypeBinding.getQualifiedName());
          elimination.setExistingInheritanceTree(tree);
        }
 else         if (elimination.getTypeMethodInvocation() != null) {
          MethodInvocation typeMethodInvocation=elimination.getTypeMethodInvocation();
          IMethodBinding typeMethodInvocationBinding=typeMethodInvocation.resolveMethodBinding();
          if (typeMethodInvocationBinding.getDeclaringClass().getQualifiedName().equals("String_Node_Str") && typeMethodInvocationBinding.getName().equals("String_Node_Str")) {
            Expression typeMethodInvocationExpression=typeMethodInvocation.getExpression();
            ITypeBinding typeCheckClassBinding=elimination.getTypeCheckClass().resolveBinding();
            ClassObject typeCheckClassObject=getClassObject(typeCheckClassBinding.getQualifiedName());
            SimpleName invoker=null;
            if (typeMethodInvocationExpression instanceof SimpleName) {
              invoker=(SimpleName)typeMethodInvocationExpression;
            }
 else             if (typeMethodInvocationExpression instanceof FieldAccess) {
              FieldAccess fieldAccess=(FieldAccess)typeMethodInvocationExpression;
              invoker=fieldAccess.getName();
            }
            if (invoker != null) {
              IBinding binding=invoker.resolveBinding();
              if (binding.getKind() == IBinding.VARIABLE) {
                IVariableBinding variableBinding=(IVariableBinding)binding;
                if (variableBinding.isField()) {
                  ListIterator<FieldObject> fieldIterator=typeCheckClassObject.getFieldIterator();
                  while (fieldIterator.hasNext()) {
                    FieldObject fieldObject=fieldIterator.next();
                    VariableDeclarationFragment fragment=fieldObject.getVariableDeclarationFragment();
                    if (variableBinding.isEqualTo(fragment.resolveBinding())) {
                      elimination.setTypeField(fragment);
                      break;
                    }
                  }
                }
 else                 if (variableBinding.isParameter()) {
                  List<SingleVariableDeclaration> parameters=elimination.getTypeCheckMethodParameters();
                  for (                  SingleVariableDeclaration parameter : parameters) {
                    IVariableBinding parameterVariableBinding=parameter.resolveBinding();
                    if (parameterVariableBinding.isEqualTo(variableBinding)) {
                      elimination.setTypeLocalVariable(parameter);
                      break;
                    }
                  }
                }
 else {
                  StatementExtractor statementExtractor=new StatementExtractor();
                  Block typeCheckMethodBody=elimination.getTypeCheckMethod().getBody();
                  List<Statement> variableDeclarationStatements=statementExtractor.getVariableDeclarations(typeCheckMethodBody);
                  for (                  Statement vDStatement : variableDeclarationStatements) {
                    VariableDeclarationStatement variableDeclarationStatement=(VariableDeclarationStatement)vDStatement;
                    List<VariableDeclarationFragment> fragments=variableDeclarationStatement.fragments();
                    for (                    VariableDeclarationFragment fragment : fragments) {
                      IVariableBinding fragmentVariableBinding=fragment.resolveBinding();
                      if (fragmentVariableBinding.isEqualTo(variableBinding)) {
                        elimination.setTypeLocalVariable(fragment);
                        break;
                      }
                    }
                  }
                  List<Statement> enhancedForStatements=statementExtractor.getEnhancedForStatements(typeCheckMethodBody);
                  for (                  Statement eFStatement : enhancedForStatements) {
                    EnhancedForStatement enhancedForStatement=(EnhancedForStatement)eFStatement;
                    SingleVariableDeclaration formalParameter=enhancedForStatement.getParameter();
                    IVariableBinding parameterVariableBinding=formalParameter.resolveBinding();
                    if (parameterVariableBinding.isEqualTo(variableBinding)) {
                      elimination.setTypeLocalVariable(formalParameter);
                      break;
                    }
                  }
                }
                ITypeBinding invokerType=variableBinding.getType();
                InheritanceTree tree=inheritanceDetection.getTree(invokerType.getQualifiedName());
                elimination.setExistingInheritanceTree(tree);
              }
            }
          }
 else {
            ITypeBinding typeMethodInvocationReturnType=typeMethodInvocationBinding.getReturnType();
            InheritanceTree tree=inheritanceDetection.getTree(typeMethodInvocationReturnType.getQualifiedName());
            elimination.setExistingInheritanceTree(tree);
          }
        }
        if (elimination.getExistingInheritanceTree() != null) {
          InheritanceTree tree=elimination.getExistingInheritanceTree();
          if (inheritanceTreeMap.containsKey(tree.getRootNode().getUserObject())) {
            ArrayList<TypeCheckElimination> typeCheckEliminations=inheritanceTreeMap.get(tree.getRootNode().getUserObject());
            typeCheckEliminations.add(elimination);
          }
 else {
            ArrayList<TypeCheckElimination> typeCheckEliminations=new ArrayList<TypeCheckElimination>();
            typeCheckEliminations.add(elimination);
            inheritanceTreeMap.put((String)tree.getRootNode().getUserObject(),typeCheckEliminations);
          }
        }
      }
    }
  }
  for (  String rootNode : inheritanceTreeMap.keySet()) {
    ArrayList<TypeCheckElimination> typeCheckEliminations=inheritanceTreeMap.get(rootNode);
    typeCheckEliminationResults.addGroup(typeCheckEliminations);
  }
  List<TypeCheckElimination> sortedEliminations=new ArrayList<TypeCheckElimination>();
  List<Integer> keyList=new ArrayList<Integer>(staticFieldRankMap.keySet());
  ListIterator<Integer> keyListIterator=keyList.listIterator(keyList.size());
  while (keyListIterator.hasPrevious()) {
    Integer states=keyListIterator.previous();
    sortedEliminations.addAll(staticFieldRankMap.get(states));
  }
  while (!sortedEliminations.isEmpty()) {
    TypeCheckElimination selectedElimination=sortedEliminations.get(0);
    List<TypeCheckElimination> affectedEliminations=new ArrayList<TypeCheckElimination>();
    affectedEliminations.add(selectedElimination);
    List<SimpleName> staticFieldUnion=staticFieldMap.get(selectedElimination);
    boolean staticFieldUnionIncreased=true;
    while (staticFieldUnionIncreased) {
      staticFieldUnionIncreased=false;
      for (      TypeCheckElimination elimination : sortedEliminations) {
        List<SimpleName> staticFields=staticFieldMap.get(elimination);
        if (!affectedEliminations.contains(elimination) && nonEmptyIntersection(staticFieldUnion,staticFields)) {
          staticFieldUnion=constructUnion(staticFieldUnion,staticFields);
          affectedEliminations.add(elimination);
          staticFieldUnionIncreased=true;
        }
      }
    }
    if (affectedEliminations.size() > 1) {
      for (      TypeCheckElimination elimination : affectedEliminations) {
        List<SimpleName> staticFields=staticFieldMap.get(elimination);
        for (        SimpleName simpleName1 : staticFieldUnion) {
          boolean isContained=false;
          for (          SimpleName simpleName2 : staticFields) {
            if (simpleName1.resolveBinding().isEqualTo(simpleName2.resolveBinding())) {
              isContained=true;
              break;
            }
          }
          if (!isContained)           elimination.addAdditionalStaticField(simpleName1);
        }
      }
    }
    ArrayList<TypeCheckElimination> typeCheckEliminations=new ArrayList<TypeCheckElimination>();
    for (    TypeCheckElimination elimination : affectedEliminations) {
      if (!elimination.isTypeCheckMethodStateSetter())       typeCheckEliminations.add(elimination);
    }
    typeCheckEliminationResults.addGroup(typeCheckEliminations);
    sortedEliminations.removeAll(affectedEliminations);
  }
  identifySuperFieldAccessorMethods(typeCheckEliminationResults.getTypeCheckEliminations());
  return typeCheckEliminationResults;
}