Program: 12189
Project: 12189
Buggy source:
public List<TypeCheckElimination> generateTypeCheckEliminations(){
  List<TypeCheckElimination> typeCheckEliminations=new ArrayList<TypeCheckElimination>();
  Map<TypeCheckElimination,List<SimpleName>> staticFieldMap=new LinkedHashMap<TypeCheckElimination,List<SimpleName>>();
  Map<Integer,ArrayList<TypeCheckElimination>> staticFieldRankMap=new TreeMap<Integer,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()) {
        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);
                      typeCheckEliminations.add(elimination);
                    }
                  }
                }
              }
            }
          }
        }
        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();
          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);
            }
          }
        }
        if (elimination.getExistingInheritanceTree() != null)         typeCheckEliminations.add(elimination);
      }
    }
  }
  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);
        }
      }
    }
    for (    TypeCheckElimination elimination : affectedEliminations) {
      if (!elimination.isTypeCheckMethodStateSetter())       typeCheckEliminations.add(elimination);
    }
    sortedEliminations.removeAll(affectedEliminations);
  }
  return typeCheckEliminations;
}

Fixed version (ground truth):
public List<TypeCheckElimination> generateTypeCheckEliminations(){
  List<TypeCheckElimination> typeCheckEliminations=new ArrayList<TypeCheckElimination>();
  Map<TypeCheckElimination,List<SimpleName>> staticFieldMap=new LinkedHashMap<TypeCheckElimination,List<SimpleName>>();
  Map<Integer,ArrayList<TypeCheckElimination>> staticFieldRankMap=new TreeMap<Integer,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()) {
        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);
                      typeCheckEliminations.add(elimination);
                    }
                  }
                }
              }
            }
          }
        }
        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();
          ITypeBinding typeMethodInvocationReturnType=typeMethodInvocationBinding.getReturnType();
          InheritanceTree tree=inheritanceDetection.getTree(typeMethodInvocationReturnType.getQualifiedName());
          elimination.setExistingInheritanceTree(tree);
        }
        if (elimination.getExistingInheritanceTree() != null)         typeCheckEliminations.add(elimination);
      }
    }
  }
  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);
        }
      }
    }
    for (    TypeCheckElimination elimination : affectedEliminations) {
      if (!elimination.isTypeCheckMethodStateSetter())       typeCheckEliminations.add(elimination);
    }
    sortedEliminations.removeAll(affectedEliminations);
  }
  return typeCheckEliminations;
}