Program: 10999
Project: 10999
Buggy source:
@Override public Retrieve visitRetrieve(@NotNull cqlParser.RetrieveContext ctx){
  String model=parseString(ctx.namedTypeSpecifier().modelIdentifier());
  String label=parseString(ctx.namedTypeSpecifier().identifier());
  DataType dataType=libraryBuilder.resolveTypeName(model,label);
  if (dataType == null) {
    throw new IllegalArgumentException(String.format("String_Node_Str",label));
  }
  if (!(dataType instanceof ClassType) || !((ClassType)dataType).isRetrievable()) {
    throw new IllegalArgumentException(String.format("String_Node_Str",label));
  }
  ClassType classType=(ClassType)dataType;
  NamedType namedType=classType;
  ModelInfo modelInfo=libraryBuilder.getModel(namedType.getNamespace()).getModelInfo();
  boolean useStrictRetrieveTyping=modelInfo.isStrictRetrieveTyping() != null && modelInfo.isStrictRetrieveTyping();
  Retrieve retrieve=of.createRetrieve().withDataType(libraryBuilder.dataTypeToQName((DataType)namedType)).withTemplateId(classType.getIdentifier());
  if (ctx.terminology() != null) {
    if (ctx.codePath() != null) {
      retrieve.setCodeProperty(parseString(ctx.codePath()));
    }
 else     if (classType.getPrimaryCodePath() != null) {
      retrieve.setCodeProperty(classType.getPrimaryCodePath());
    }
    Property property=null;
    if (retrieve.getCodeProperty() == null) {
      libraryBuilder.recordParsingException(new CqlSemanticException("String_Node_Str",useStrictRetrieveTyping ? CqlTranslatorException.ErrorSeverity.Error : CqlTranslatorException.ErrorSeverity.Warning,getTrackBack(ctx)));
    }
 else {
      try {
        DataType codeType=libraryBuilder.resolvePath((DataType)namedType,retrieve.getCodeProperty());
        property=of.createProperty().withPath(retrieve.getCodeProperty());
        property.setResultType(codeType);
      }
 catch (      Exception e) {
        libraryBuilder.recordParsingException(new CqlSemanticException(String.format("String_Node_Str",retrieve.getCodeProperty(),namedType.getName()),useStrictRetrieveTyping ? CqlTranslatorException.ErrorSeverity.Error : CqlTranslatorException.ErrorSeverity.Warning,getTrackBack(ctx),e));
      }
    }
    Expression terminology=null;
    if (ctx.terminology().qualifiedIdentifier() != null) {
      List<String> identifiers=(List<String>)visit(ctx.terminology());
      terminology=resolveQualifiedIdentifier(identifiers);
    }
 else {
      terminology=parseExpression(ctx.terminology().expression());
    }
    try {
      Expression in=libraryBuilder.resolveIn(property,terminology);
      if (in instanceof In) {
        retrieve.setCodes(((In)in).getOperand().get(1));
      }
 else       if (in instanceof InValueSet) {
        retrieve.setCodes(((InValueSet)in).getValueset());
      }
 else       if (in instanceof InCodeSystem) {
        retrieve.setCodes(((InCodeSystem)in).getCodesystem());
      }
 else {
        libraryBuilder.recordParsingException(new CqlSemanticException(String.format("String_Node_Str",in.getClass().getSimpleName()),useStrictRetrieveTyping ? CqlTranslatorException.ErrorSeverity.Error : CqlTranslatorException.ErrorSeverity.Warning,getTrackBack(ctx)));
      }
    }
 catch (    Exception e) {
      retrieve.setCodes(terminology);
      libraryBuilder.recordParsingException(new CqlSemanticException("String_Node_Str",useStrictRetrieveTyping ? CqlTranslatorException.ErrorSeverity.Error : CqlTranslatorException.ErrorSeverity.Warning,getTrackBack(ctx),e));
    }
  }
  retrieves.add(retrieve);
  retrieve.setResultType(new ListType((DataType)namedType));
  return retrieve;
}

Fixed version (ground truth):
@Override public Retrieve visitRetrieve(@NotNull cqlParser.RetrieveContext ctx){
  String model=parseString(ctx.namedTypeSpecifier().modelIdentifier());
  String label=parseString(ctx.namedTypeSpecifier().identifier());
  DataType dataType=libraryBuilder.resolveTypeName(model,label);
  if (dataType == null) {
    throw new IllegalArgumentException(String.format("String_Node_Str",label));
  }
  if (!(dataType instanceof ClassType) || !((ClassType)dataType).isRetrievable()) {
    throw new IllegalArgumentException(String.format("String_Node_Str",label));
  }
  ClassType classType=(ClassType)dataType;
  NamedType namedType=classType;
  ModelInfo modelInfo=libraryBuilder.getModel(namedType.getNamespace()).getModelInfo();
  boolean useStrictRetrieveTyping=modelInfo.isStrictRetrieveTyping() != null && modelInfo.isStrictRetrieveTyping();
  Retrieve retrieve=of.createRetrieve().withDataType(libraryBuilder.dataTypeToQName((DataType)namedType)).withTemplateId(classType.getIdentifier());
  if (ctx.terminology() != null) {
    if (ctx.codePath() != null) {
      retrieve.setCodeProperty(parseString(ctx.codePath()));
    }
 else     if (classType.getPrimaryCodePath() != null) {
      retrieve.setCodeProperty(classType.getPrimaryCodePath());
    }
    Property property=null;
    if (retrieve.getCodeProperty() == null) {
      libraryBuilder.recordParsingException(new CqlSemanticException("String_Node_Str",useStrictRetrieveTyping ? CqlTranslatorException.ErrorSeverity.Error : CqlTranslatorException.ErrorSeverity.Warning,getTrackBack(ctx)));
    }
 else {
      try {
        DataType codeType=libraryBuilder.resolvePath((DataType)namedType,retrieve.getCodeProperty());
        property=of.createProperty().withPath(retrieve.getCodeProperty());
        property.setResultType(codeType);
      }
 catch (      Exception e) {
        libraryBuilder.recordParsingException(new CqlSemanticException(String.format("String_Node_Str",retrieve.getCodeProperty(),namedType.getName()),useStrictRetrieveTyping ? CqlTranslatorException.ErrorSeverity.Error : CqlTranslatorException.ErrorSeverity.Warning,getTrackBack(ctx),e));
      }
    }
    Expression terminology=null;
    if (ctx.terminology().qualifiedIdentifier() != null) {
      List<String> identifiers=(List<String>)visit(ctx.terminology());
      terminology=resolveQualifiedIdentifier(identifiers);
    }
 else {
      terminology=parseExpression(ctx.terminology().expression());
    }
    try {
      if (terminology.getResultType() instanceof ListType) {
        Expression in=libraryBuilder.resolveIn(property,terminology);
        if (in instanceof In) {
          retrieve.setCodes(((In)in).getOperand().get(1));
        }
 else         if (in instanceof InValueSet) {
          retrieve.setCodes(((InValueSet)in).getValueset());
        }
 else         if (in instanceof InCodeSystem) {
          retrieve.setCodes(((InCodeSystem)in).getCodesystem());
        }
 else {
          libraryBuilder.recordParsingException(new CqlSemanticException(String.format("String_Node_Str",in.getClass().getSimpleName()),useStrictRetrieveTyping ? CqlTranslatorException.ErrorSeverity.Error : CqlTranslatorException.ErrorSeverity.Warning,getTrackBack(ctx)));
        }
      }
 else {
        BinaryExpression equal=of.createEqual().withOperand(property,terminology);
        libraryBuilder.resolveBinaryCall("String_Node_Str","String_Node_Str",equal);
        retrieve.setCodes(libraryBuilder.resolveToList(equal.getOperand().get(1)));
      }
    }
 catch (    Exception e) {
      retrieve.setCodes(terminology);
      libraryBuilder.recordParsingException(new CqlSemanticException("String_Node_Str",useStrictRetrieveTyping ? CqlTranslatorException.ErrorSeverity.Error : CqlTranslatorException.ErrorSeverity.Warning,getTrackBack(ctx),e));
    }
  }
  retrieves.add(retrieve);
  retrieve.setResultType(new ListType((DataType)namedType));
  return retrieve;
}