Program: 17012
Project: 17012
Buggy source:
/** 
 * validate the semantics of a method
 * @param ctx
 * @param jstMethod
 */
private void validateMethod(final VjoValidationCtx ctx,final JstMethod jstMethod){
  final List<JstArg> parameters=jstMethod.getArgs();
  if (parameters != null && parameters.size() > 0) {
    for (int it=0, len=parameters.size(); it < len; it++) {
      final JstArg argument=parameters.get(it);
      if (it < len - 1 && argument.isVariable()) {
      }
      for (      IJstType argType : argument.getTypes()) {
        if (TypeCheckUtil.isVoid(argType)) {
          final BaseVjoSemanticRuleCtx ruleCtx=new BaseVjoSemanticRuleCtx(argument,ctx.getGroupId(),new String[]{argument.getName(),jstMethod.getName().getName()});
          satisfyRule(ctx,VjoSemanticRuleRepo.getInstance().METHOD_ARGS_TYPE_SHOULD_NOT_BE_VOID,ruleCtx);
        }
        if (getKnownType(ctx,jstMethod.getOwnerType(),argType) == null) {
          if (!ctx.getMissingImportTypes().contains(argType)) {
            ctx.addMissingImportType(argType);
          }
          final BaseVjoSemanticRuleCtx ruleCtx=new BaseVjoSemanticRuleCtx(argument,ctx.getGroupId(),new String[]{argType.getName()});
          satisfyRule(ctx,VjoSemanticRuleRepo.getInstance().UNKNOWN_TYPE_MISSING_IMPORT,ruleCtx);
        }
 else         if (argType != null && argType instanceof JstTypeWithArgs) {
          validateJstWithArgs(jstMethod.getOwnerType(),argument,argument.getName(),ctx,(JstTypeWithArgs)argType);
        }
      }
      final List<IJstNode> scopedVars=ctx.getMethodControlFlowTable().lookUpScopedVars(jstMethod);
      final String lhsName=argument.getName();
      if (lhsName != null) {
        boolean addScopedVar=true;
        for (        IJstNode scopedVar : scopedVars) {
          if (scopedVar != null) {
            String scopedVarName=null;
            if (scopedVar instanceof JstIdentifier) {
              scopedVarName=((JstIdentifier)scopedVar).getName();
            }
 else             if (scopedVar instanceof JstVar) {
              scopedVarName=((JstVar)scopedVar).getName();
            }
 else             if (scopedVar instanceof JstArg) {
              scopedVarName=((JstArg)scopedVar).getName();
            }
 else             if (scopedVar instanceof JstName) {
              scopedVarName=((JstName)scopedVar).getName();
            }
            if (lhsName.equals(scopedVarName)) {
              final BaseVjoSemanticRuleCtx ruleCtx=new BaseVjoSemanticRuleCtx(argument,ctx.getGroupId(),new String[]{argument.getName()});
              satisfyRule(ctx,VjoSemanticRuleRepo.getInstance().VARIABLE_ALREADY_DEFINED,ruleCtx);
              addScopedVar=false;
              break;
            }
          }
        }
        if (addScopedVar) {
          ctx.getMethodControlFlowTable().addScopedVar(jstMethod,argument);
        }
      }
    }
  }
  final IJstType rtnType=jstMethod.getRtnType();
  if (rtnType instanceof JstVariantType) {
    validateReturnType(ctx,jstMethod,(JstVariantType)rtnType);
  }
 else   if (rtnType instanceof JstMixedType) {
    validateReturnType(ctx,jstMethod,(JstMixedType)rtnType);
  }
 else {
    validateReturnType(ctx,jstMethod,rtnType);
  }
}

Fixed version (ground truth):
/** 
 * validate the semantics of a method
 * @param ctx
 * @param jstMethod
 */
private void validateMethod(final VjoValidationCtx ctx,final JstMethod jstMethod){
  final List<JstArg> parameters=jstMethod.getArgs();
  if (parameters != null && parameters.size() > 0) {
    for (int it=0, len=parameters.size(); it < len; it++) {
      final JstArg argument=parameters.get(it);
      if (it < len - 1 && argument.isVariable()) {
      }
      for (      IJstType argType : argument.getTypes()) {
        if (TypeCheckUtil.isVoid(argType)) {
          final BaseVjoSemanticRuleCtx ruleCtx=new BaseVjoSemanticRuleCtx(argument,ctx.getGroupId(),new String[]{argument.getName(),jstMethod.getName().getName()});
          satisfyRule(ctx,VjoSemanticRuleRepo.getInstance().METHOD_ARGS_TYPE_SHOULD_NOT_BE_VOID,ruleCtx);
        }
        if (argType instanceof JstMixedType) {
          JstMixedType mixedType=(JstMixedType)argType;
          for (          IJstType type : mixedType.getMixedTypes()) {
            if (getKnownType(ctx,jstMethod.getOwnerType(),type) == null) {
              if (!ctx.getMissingImportTypes().contains(type)) {
                ctx.addMissingImportType(type);
              }
              final BaseVjoSemanticRuleCtx ruleCtx=new BaseVjoSemanticRuleCtx(argument,ctx.getGroupId(),new String[]{type.getName()});
              satisfyRule(ctx,VjoSemanticRuleRepo.getInstance().UNKNOWN_TYPE_MISSING_IMPORT,ruleCtx);
            }
          }
        }
 else         if (getKnownType(ctx,jstMethod.getOwnerType(),argType) == null) {
          if (!ctx.getMissingImportTypes().contains(argType)) {
            ctx.addMissingImportType(argType);
          }
          final BaseVjoSemanticRuleCtx ruleCtx=new BaseVjoSemanticRuleCtx(argument,ctx.getGroupId(),new String[]{argType.getName()});
          satisfyRule(ctx,VjoSemanticRuleRepo.getInstance().UNKNOWN_TYPE_MISSING_IMPORT,ruleCtx);
        }
 else         if (argType != null && argType instanceof JstTypeWithArgs) {
          validateJstWithArgs(jstMethod.getOwnerType(),argument,argument.getName(),ctx,(JstTypeWithArgs)argType);
        }
      }
      final List<IJstNode> scopedVars=ctx.getMethodControlFlowTable().lookUpScopedVars(jstMethod);
      final String lhsName=argument.getName();
      if (lhsName != null) {
        boolean addScopedVar=true;
        for (        IJstNode scopedVar : scopedVars) {
          if (scopedVar != null) {
            String scopedVarName=null;
            if (scopedVar instanceof JstIdentifier) {
              scopedVarName=((JstIdentifier)scopedVar).getName();
            }
 else             if (scopedVar instanceof JstVar) {
              scopedVarName=((JstVar)scopedVar).getName();
            }
 else             if (scopedVar instanceof JstArg) {
              scopedVarName=((JstArg)scopedVar).getName();
            }
 else             if (scopedVar instanceof JstName) {
              scopedVarName=((JstName)scopedVar).getName();
            }
            if (lhsName.equals(scopedVarName)) {
              final BaseVjoSemanticRuleCtx ruleCtx=new BaseVjoSemanticRuleCtx(argument,ctx.getGroupId(),new String[]{argument.getName()});
              satisfyRule(ctx,VjoSemanticRuleRepo.getInstance().VARIABLE_ALREADY_DEFINED,ruleCtx);
              addScopedVar=false;
              break;
            }
          }
        }
        if (addScopedVar) {
          ctx.getMethodControlFlowTable().addScopedVar(jstMethod,argument);
        }
      }
    }
  }
  final IJstType rtnType=jstMethod.getRtnType();
  if (rtnType instanceof JstVariantType) {
    validateReturnType(ctx,jstMethod,(JstVariantType)rtnType);
  }
 else   if (rtnType instanceof JstMixedType) {
    validateReturnType(ctx,jstMethod,(JstMixedType)rtnType);
  }
 else {
    validateReturnType(ctx,jstMethod,rtnType);
  }
}