Program: 63324
Project: 63324
Buggy source:
/** 
 * INTERNAL: For CR#2456 if this is part of an objExp.equal(objExp), do not need to add additional expressions to normalizer both times, and the foreign key join replaces the equal expression.
 */
public Expression normalize(ExpressionNormalizer normalizer,Expression base,List<Expression> foreignKeyJoinPointer){
  if (this.hasBeenNormalized) {
    return this;
  }
  Expression clonedExpression=checkJoinForSubSelectWithParent(normalizer,base,foreignKeyJoinPointer);
  if (clonedExpression != null) {
    return clonedExpression;
  }
  super.normalize(normalizer);
  DatabaseMapping mapping=getMapping();
  SQLSelectStatement statement=normalizer.getStatement();
  if ((mapping != null) && mapping.isDirectToXMLTypeMapping()) {
    statement.setRequiresAliases(true);
  }
  if (isAttribute()) {
    return this;
  }
  ReadQuery query=normalizer.getStatement().getQuery();
  if ((query != null) && query.shouldCacheQueryResults()) {
    if ((mapping != null) && (mapping.getReferenceDescriptor().getJavaClass() != null)) {
      query.getQueryResultsCachePolicy().getInvalidationClasses().add(mapping.getReferenceDescriptor().getJavaClass());
    }
 else {
      QueryKey queryKey=getQueryKeyOrNull();
      if ((queryKey != null) && queryKey.isForeignReferenceQueryKey()) {
        query.getQueryResultsCachePolicy().getInvalidationClasses().add(((ForeignReferenceQueryKey)queryKey).getReferenceClass());
      }
    }
  }
  if ((mapping != null) && (mapping.isReferenceMapping() || mapping.isStructureMapping())) {
    statement.setRequiresAliases(true);
    return this;
  }
  if (shouldQueryToManyRelationship() && (!statement.isDistinctComputed()) && (!statement.isAggregateSelect())) {
    statement.useDistinct();
  }
  if ((mapping != null) && mapping.isNestedTableMapping()) {
    if (!shouldQueryToManyRelationship()) {
      return this;
    }
    statement.dontUseDistinct();
  }
  if (this.onClause != null) {
    this.onClause=this.onClause.normalize(normalizer);
  }
  Expression mappingExpression=mappingCriteria(base);
  if (mappingExpression != null) {
    mappingExpression=mappingExpression.normalize(normalizer);
  }
  if (mappingExpression != null) {
    if (shouldUseOuterJoin() && (getSession().getPlatform().isInformixOuterJoin())) {
      setOuterJoinExpIndex(statement.addOuterJoinExpressionsHolders(this,mappingExpression,null,null));
      normalizer.addAdditionalExpression(mappingExpression.and(additionalExpressionCriteria()));
      return this;
    }
 else     if ((shouldUseOuterJoin() && (!getSession().getPlatform().shouldPrintOuterJoinInWhereClause())) || (!getSession().getPlatform().shouldPrintInnerJoinInWhereClause())) {
      setOuterJoinExpIndex(statement.addOuterJoinExpressionsHolders(this,mappingExpression,additionalExpressionCriteriaMap(),null));
      if ((getDescriptor() != null) && (getDescriptor().getHistoryPolicy() != null)) {
        Expression historyOnClause=getDescriptor().getHistoryPolicy().additionalHistoryExpression(this,this,0);
        if (getOnClause() != null) {
          setOnClause(getOnClause().and(historyOnClause));
        }
 else {
          setOnClause(historyOnClause);
        }
      }
      return this;
    }
 else     if (isUsingOuterJoinForMultitableInheritance() && (!getSession().getPlatform().shouldPrintOuterJoinInWhereClause())) {
      setOuterJoinExpIndex(statement.addOuterJoinExpressionsHolders(null,null,additionalExpressionCriteriaMap(),mapping.getReferenceDescriptor()));
    }
    if (foreignKeyJoinPointer != null) {
      foreignKeyJoinPointer.add(mappingExpression.and(this.onClause));
    }
 else {
      normalizer.addAdditionalExpression(mappingExpression.and(additionalExpressionCriteria()).and(this.onClause));
    }
  }
  return this;
}

Fixed version (ground truth):
/** 
 * INTERNAL: For CR#2456 if this is part of an objExp.equal(objExp), do not need to add additional expressions to normalizer both times, and the foreign key join replaces the equal expression.
 */
public Expression normalize(ExpressionNormalizer normalizer,Expression base,List<Expression> foreignKeyJoinPointer){
  if (this.hasBeenNormalized) {
    return this;
  }
  Expression clonedExpression=checkJoinForSubSelectWithParent(normalizer,base,foreignKeyJoinPointer);
  if (clonedExpression != null) {
    return clonedExpression;
  }
  super.normalize(normalizer);
  DatabaseMapping mapping=getMapping();
  SQLSelectStatement statement=normalizer.getStatement();
  if ((mapping != null) && mapping.isDirectToXMLTypeMapping()) {
    statement.setRequiresAliases(true);
  }
  if (isAttribute()) {
    return this;
  }
  ReadQuery query=normalizer.getStatement().getQuery();
  if ((query != null) && query.shouldCacheQueryResults()) {
    if ((mapping != null) && (mapping.getReferenceDescriptor() != null) && (mapping.getReferenceDescriptor().getJavaClass() != null)) {
      query.getQueryResultsCachePolicy().getInvalidationClasses().add(mapping.getReferenceDescriptor().getJavaClass());
    }
 else {
      QueryKey queryKey=getQueryKeyOrNull();
      if ((queryKey != null) && queryKey.isForeignReferenceQueryKey()) {
        query.getQueryResultsCachePolicy().getInvalidationClasses().add(((ForeignReferenceQueryKey)queryKey).getReferenceClass());
      }
    }
  }
  if ((mapping != null) && (mapping.isReferenceMapping() || mapping.isStructureMapping())) {
    statement.setRequiresAliases(true);
    return this;
  }
  if (shouldQueryToManyRelationship() && (!statement.isDistinctComputed()) && (!statement.isAggregateSelect())) {
    statement.useDistinct();
  }
  if ((mapping != null) && mapping.isNestedTableMapping()) {
    if (!shouldQueryToManyRelationship()) {
      return this;
    }
    statement.dontUseDistinct();
  }
  if (this.onClause != null) {
    this.onClause=this.onClause.normalize(normalizer);
  }
  Expression mappingExpression=mappingCriteria(base);
  if (mappingExpression != null) {
    mappingExpression=mappingExpression.normalize(normalizer);
  }
  if (mappingExpression != null) {
    if (shouldUseOuterJoin() && (getSession().getPlatform().isInformixOuterJoin())) {
      setOuterJoinExpIndex(statement.addOuterJoinExpressionsHolders(this,mappingExpression,null,null));
      normalizer.addAdditionalExpression(mappingExpression.and(additionalExpressionCriteria()));
      return this;
    }
 else     if ((shouldUseOuterJoin() && (!getSession().getPlatform().shouldPrintOuterJoinInWhereClause())) || (!getSession().getPlatform().shouldPrintInnerJoinInWhereClause())) {
      setOuterJoinExpIndex(statement.addOuterJoinExpressionsHolders(this,mappingExpression,additionalExpressionCriteriaMap(),null));
      if ((getDescriptor() != null) && (getDescriptor().getHistoryPolicy() != null)) {
        Expression historyOnClause=getDescriptor().getHistoryPolicy().additionalHistoryExpression(this,this,0);
        if (getOnClause() != null) {
          setOnClause(getOnClause().and(historyOnClause));
        }
 else {
          setOnClause(historyOnClause);
        }
      }
      return this;
    }
 else     if (isUsingOuterJoinForMultitableInheritance() && (!getSession().getPlatform().shouldPrintOuterJoinInWhereClause())) {
      setOuterJoinExpIndex(statement.addOuterJoinExpressionsHolders(null,null,additionalExpressionCriteriaMap(),mapping.getReferenceDescriptor()));
    }
    if (foreignKeyJoinPointer != null) {
      foreignKeyJoinPointer.add(mappingExpression.and(this.onClause));
    }
 else {
      normalizer.addAdditionalExpression(mappingExpression.and(additionalExpressionCriteria()).and(this.onClause));
    }
  }
  return this;
}