Program: 86800
Project: 86800
Buggy source:
/** 
 * Recursively traverse the List<Object> phrase to produce a (possibly nested) CompoundCohortDefinition If another List<Object> is found in the list, recursively evaluate it in place If anything in this list is a key into searches, replace it with the relevant filter from searches
 */
@SuppressWarnings("String_Node_Str") public static Cohort evaluate(List<Object> tokens,CompositionCohortDefinition composition,EvaluationContext context){
  log.debug("String_Node_Str" + tokens + "String_Node_Str"+ composition.getSearches());
  List<Object> use=new ArrayList<Object>();
  for (  Object o : tokens) {
    log.debug("String_Node_Str" + o);
    if (o instanceof List) {
      log.debug("String_Node_Str");
      Cohort result=evaluate((List<Object>)o,composition,context);
      log.debug(o + "String_Node_Str" + result.size());
      use.add(result);
    }
 else     if (o instanceof String || o instanceof Integer) {
      log.debug("String_Node_Str");
      Mapped<CohortDefinition> cd=composition.getSearches().get(o.toString());
      log.debug("String_Node_Str" + cd);
      Cohort result=Context.getService(CohortDefinitionService.class).evaluate(cd,context);
      log.debug("String_Node_Str" + result.size());
      use.add(result);
    }
 else {
      log.debug("String_Node_Str" + o);
      use.add(o);
    }
  }
  log.debug("String_Node_Str" + use);
  log.debug("String_Node_Str");
  boolean invertTheNext=false;
  for (ListIterator<Object> i=use.listIterator(); i.hasNext(); ) {
    Object o=i.next();
    log.debug("String_Node_Str" + o);
    if (o instanceof BooleanOperator) {
      if ((BooleanOperator)o == BooleanOperator.NOT) {
        i.remove();
        invertTheNext=!invertTheNext;
        log.debug("String_Node_Str" + invertTheNext);
      }
 else {
        if (invertTheNext) {
          throw new RuntimeException("String_Node_Str");
        }
      }
    }
 else {
      if (invertTheNext) {
        log.debug("String_Node_Str");
        if (o instanceof Cohort) {
          Cohort baseCohort=context.getBaseCohort();
          Cohort currentCohort=(Cohort)o;
          if (baseCohort == null) {
            baseCohort=Context.getPatientSetService().getAllPatients();
          }
          log.debug("String_Node_Str" + currentCohort.size());
          log.debug("String_Node_Str" + baseCohort.size());
          Cohort invertedCohort=Cohort.subtract(baseCohort,currentCohort);
          log.debug("String_Node_Str" + baseCohort.size());
          i.set(invertedCohort);
        }
 else {
          throw new RuntimeException("String_Node_Str" + o.getClass());
        }
        invertTheNext=false;
      }
    }
  }
  log.debug("String_Node_Str" + use);
  log.debug("String_Node_Str");
  Cohort ret=null;
  BooleanOperator operator=BooleanOperator.AND;
  for (  Object o : use) {
    if (o instanceof BooleanOperator) {
      operator=(BooleanOperator)o;
      log.debug("String_Node_Str" + operator);
    }
 else     if (o instanceof Cohort) {
      Cohort c=(Cohort)o;
      log.debug("String_Node_Str" + c.getSize());
      if (ret == null) {
        ret=c;
        log.debug("String_Node_Str");
      }
 else {
        if (operator == BooleanOperator.AND) {
          ret=Cohort.intersect(ret,c);
          log.debug("String_Node_Str" + ret.getSize());
        }
 else         if (operator == BooleanOperator.OR) {
          ret=Cohort.union(ret,c);
          log.debug("String_Node_Str" + ret.getSize());
        }
 else {
          throw new RuntimeException("String_Node_Str" + operator);
        }
      }
    }
 else {
      throw new RuntimeException("String_Node_Str" + o.getClass());
    }
  }
  log.debug("String_Node_Str" + ret.getSize());
  return ret;
}

Fixed version (ground truth):
/** 
 * Recursively traverse the List<Object> phrase to produce a (possibly nested) CompoundCohortDefinition If another List<Object> is found in the list, recursively evaluate it in place If anything in this list is a key into searches, replace it with the relevant filter from searches
 * @throws EvaluationException 
 */
@SuppressWarnings("String_Node_Str") public static Cohort evaluate(List<Object> tokens,CompositionCohortDefinition composition,EvaluationContext context) throws EvaluationException {
  log.debug("String_Node_Str" + tokens + "String_Node_Str"+ composition.getSearches());
  List<Object> use=new ArrayList<Object>();
  for (  Object o : tokens) {
    log.debug("String_Node_Str" + o);
    if (o instanceof List) {
      log.debug("String_Node_Str");
      Cohort result=evaluate((List<Object>)o,composition,context);
      log.debug(o + "String_Node_Str" + result.size());
      use.add(result);
    }
 else     if (o instanceof String || o instanceof Integer) {
      log.debug("String_Node_Str");
      Mapped<CohortDefinition> cd=composition.getSearches().get(o.toString());
      if (cd == null || cd.getParameterizable() == null) {
        throw new MissingDependencyException(o.toString());
      }
      log.debug("String_Node_Str" + cd);
      Cohort result;
      try {
        result=Context.getService(CohortDefinitionService.class).evaluate(cd,context);
      }
 catch (      EvaluationException ex) {
        throw new EvaluationException(o.toString());
      }
      log.debug("String_Node_Str" + result.size());
      use.add(result);
    }
 else {
      log.debug("String_Node_Str" + o);
      use.add(o);
    }
  }
  log.debug("String_Node_Str" + use);
  log.debug("String_Node_Str");
  boolean invertTheNext=false;
  for (ListIterator<Object> i=use.listIterator(); i.hasNext(); ) {
    Object o=i.next();
    log.debug("String_Node_Str" + o);
    if (o instanceof BooleanOperator) {
      if ((BooleanOperator)o == BooleanOperator.NOT) {
        i.remove();
        invertTheNext=!invertTheNext;
        log.debug("String_Node_Str" + invertTheNext);
      }
 else {
        if (invertTheNext) {
          throw new RuntimeException("String_Node_Str");
        }
      }
    }
 else {
      if (invertTheNext) {
        log.debug("String_Node_Str");
        if (o instanceof Cohort) {
          Cohort baseCohort=context.getBaseCohort();
          Cohort currentCohort=(Cohort)o;
          if (baseCohort == null) {
            baseCohort=Context.getPatientSetService().getAllPatients();
          }
          log.debug("String_Node_Str" + currentCohort.size());
          log.debug("String_Node_Str" + baseCohort.size());
          Cohort invertedCohort=Cohort.subtract(baseCohort,currentCohort);
          log.debug("String_Node_Str" + baseCohort.size());
          i.set(invertedCohort);
        }
 else {
          throw new RuntimeException("String_Node_Str" + o.getClass());
        }
        invertTheNext=false;
      }
    }
  }
  log.debug("String_Node_Str" + use);
  log.debug("String_Node_Str");
  Cohort ret=null;
  BooleanOperator operator=BooleanOperator.AND;
  for (  Object o : use) {
    if (o instanceof BooleanOperator) {
      operator=(BooleanOperator)o;
      log.debug("String_Node_Str" + operator);
    }
 else     if (o instanceof Cohort) {
      Cohort c=(Cohort)o;
      log.debug("String_Node_Str" + c.getSize());
      if (ret == null) {
        ret=c;
        log.debug("String_Node_Str");
      }
 else {
        if (operator == BooleanOperator.AND) {
          ret=Cohort.intersect(ret,c);
          log.debug("String_Node_Str" + ret.getSize());
        }
 else         if (operator == BooleanOperator.OR) {
          ret=Cohort.union(ret,c);
          log.debug("String_Node_Str" + ret.getSize());
        }
 else {
          throw new RuntimeException("String_Node_Str" + operator);
        }
      }
    }
 else {
      throw new RuntimeException("String_Node_Str" + o.getClass());
    }
  }
  log.debug("String_Node_Str" + ret.getSize());
  return ret;
}