Program: 50088
Project: 50088
Buggy source:
MExpression eval1Init(IASTInitializer initializer,IType typeRequired,IASTName name) throws DOMException {
  if (initializer == null) {
    if (TypeManager.isBasicType(typeRequired) && (name == null || !ctx.bitfieldMngr.isBitfield(name))) {
      return ctx.exprEvaluator.makeSimpleCreationExpression(typeRequired);
    }
 else     if (TypeManager.isOneOf(typeRequired,TypeEnum.BASIC_ARRAY,TypeEnum.BASIC_POINTER,TypeEnum.OBJECT_POINTER)) {
      return ctx.exprEvaluator.makeSimpleCreationExpression(typeRequired);
    }
 else     if (TypeManager.isOneOf(typeRequired,TypeEnum.OBJECT)) {
      MNewExpressionObject expr=new MNewExpressionObject();
      expr.type=ctx.typeMngr.cppToJavaType(typeRequired,TypeType.IMPLEMENTATION);
      if (!(name.resolveBinding() instanceof IField)) {
        return ctx.stackMngr.createAddItemCall(expr);
      }
 else {
        return expr;
      }
    }
 else     if (TypeManager.isOneOf(typeRequired,TypeEnum.OBJECT_ARRAY)) {
      return null;
    }
 else {
      return null;
    }
  }
 else   if (initializer instanceof IASTEqualsInitializer) {
    if (ctx.bitfieldMngr.isBitfield(name)) {
      return ctx.exprEvaluator.eval1Expr((IASTExpression)((IASTEqualsInitializer)initializer).getInitializerClause());
    }
 else     if (TypeManager.isOneOf(typeRequired,TypeEnum.BASIC_POINTER,TypeEnum.OBJECT_POINTER)) {
      MExpression expr=ctx.exprEvaluator.eval1Expr((IASTExpression)((IASTEqualsInitializer)initializer).getInitializerClause());
      ctx.exprEvaluator.modifyLiteralToPtr(expr);
      return expr;
    }
 else     if (TypeManager.isOneOf(typeRequired,TypeEnum.OBJECT)) {
      MExpression expr=ctx.exprEvaluator.eval1Expr((IASTExpression)((IASTEqualsInitializer)initializer).getInitializerClause());
      return ctx.stackMngr.createAddItemCall(expr);
    }
 else {
      return ctx.exprEvaluator.wrapIfNeeded((IASTExpression)((IASTEqualsInitializer)initializer).getInitializerClause(),typeRequired);
    }
  }
 else   if (initializer instanceof ICPPASTConstructorInitializer) {
    ICPPASTConstructorInitializer inti=(ICPPASTConstructorInitializer)initializer;
    MMultiExpression multi=new MMultiExpression();
    for (    IASTInitializerClause cls : inti.getArguments()) {
      IASTExpression expr=(IASTExpression)cls;
      MExpression create;
      if (name != null && ctx.bitfieldMngr.isBitfield(name)) {
        create=ctx.exprEvaluator.eval1Expr(expr);
      }
 else       if (TypeManager.isOneOf(typeRequired,TypeEnum.BASIC_POINTER,TypeEnum.OBJECT_POINTER)) {
        create=ctx.exprEvaluator.eval1Expr(expr);
        ctx.exprEvaluator.modifyLiteralToPtr(create);
      }
 else {
        create=ctx.exprEvaluator.wrapIfNeeded(expr,typeRequired);
      }
      multi.exprs.add(create);
    }
    return multi;
  }
  return null;
}

Fixed version (ground truth):
MExpression eval1Init(IASTInitializer initializer,IType typeRequired,IASTName name,InitType initType) throws DOMException {
  if (initializer == null) {
    if (TypeManager.isBasicType(typeRequired) && (name == null || !ctx.bitfieldMngr.isBitfield(name))) {
      return ctx.exprEvaluator.makeSimpleCreationExpression(typeRequired);
    }
 else     if (TypeManager.isOneOf(typeRequired,TypeEnum.BASIC_ARRAY,TypeEnum.BASIC_POINTER,TypeEnum.OBJECT_POINTER)) {
      return ctx.exprEvaluator.makeSimpleCreationExpression(typeRequired);
    }
 else     if (TypeManager.isOneOf(typeRequired,TypeEnum.OBJECT)) {
      MNewExpressionObject expr=new MNewExpressionObject();
      expr.type=ctx.typeMngr.cppToJavaType(typeRequired,TypeType.IMPLEMENTATION);
      if (!(name.resolveBinding() instanceof IField)) {
        return ctx.stackMngr.createAddItemCall(expr);
      }
 else {
        return expr;
      }
    }
 else     if (TypeManager.isOneOf(typeRequired,TypeEnum.OBJECT_ARRAY)) {
      return null;
    }
 else {
      return null;
    }
  }
 else   if (initializer instanceof IASTEqualsInitializer) {
    if (ctx.bitfieldMngr.isBitfield(name)) {
      return ctx.exprEvaluator.eval1Expr((IASTExpression)((IASTEqualsInitializer)initializer).getInitializerClause());
    }
 else     if (TypeManager.isOneOf(typeRequired,TypeEnum.BASIC_POINTER,TypeEnum.OBJECT_POINTER)) {
      MExpression expr=ctx.exprEvaluator.eval1Expr((IASTExpression)((IASTEqualsInitializer)initializer).getInitializerClause());
      ctx.exprEvaluator.modifyLiteralToPtr(expr);
      return expr;
    }
 else     if (TypeManager.isOneOf(typeRequired,TypeEnum.OBJECT)) {
      MExpression expr=ctx.exprEvaluator.eval1Expr((IASTExpression)((IASTEqualsInitializer)initializer).getInitializerClause());
      return ctx.stackMngr.createAddItemCall(expr);
    }
 else {
      if (initType == InitType.WRAPPED)       return ctx.exprEvaluator.wrapIfNeeded((IASTExpression)((IASTEqualsInitializer)initializer).getInitializerClause(),typeRequired);
 else       return ctx.exprEvaluator.eval1Expr((IASTExpression)((IASTEqualsInitializer)initializer).getInitializerClause());
    }
  }
 else   if (initializer instanceof ICPPASTConstructorInitializer) {
    ICPPASTConstructorInitializer inti=(ICPPASTConstructorInitializer)initializer;
    MMultiExpression multi=new MMultiExpression();
    for (    IASTInitializerClause cls : inti.getArguments()) {
      IASTExpression expr=(IASTExpression)cls;
      MExpression create;
      if (name != null && ctx.bitfieldMngr.isBitfield(name)) {
        create=ctx.exprEvaluator.eval1Expr(expr);
      }
 else       if (TypeManager.isOneOf(typeRequired,TypeEnum.BASIC_POINTER,TypeEnum.OBJECT_POINTER)) {
        create=ctx.exprEvaluator.eval1Expr(expr);
        ctx.exprEvaluator.modifyLiteralToPtr(create);
      }
 else {
        create=ctx.exprEvaluator.wrapIfNeeded(expr,typeRequired);
      }
      multi.exprs.add(create);
    }
    return multi;
  }
  return null;
}