Program: 17032
Project: 17032
Buggy source:
/** 
 * creates the method <b>without</b> check of optional, multi-value, overloading etc.
 * @param astMtdDecl
 * @param meta
 * @param ctx
 * @param useJsAnnotForArgs
 * @param methName
 * @return
 */
private static JstMethod createJstMethod(final MethodDeclaration astMtdDecl,final IArgument[] astArgs,IJsCommentMeta meta,final TranslateCtx ctx,boolean useJsAnnotForArgs,final String methName){
  String methodName=methName;
  if (methName == null) {
    methodName=(meta != null) ? meta.getName() : FunctionExpressionTranslator.DUMMY_METHOD_NAME;
  }
  JstMethod jstMethod;
  if (VjoKeywords.CONSTRUCTS.equals(methodName)) {
    jstMethod=new JstConstructor();
  }
 else {
    jstMethod=new JstMethod(methodName);
  }
  if (meta != null) {
    jstMethod.setHasJsAnnotation(true);
    jstMethod.setName(methodName);
    TranslateHelper.setModifiersFromMeta(meta,jstMethod.getModifiers());
    JsDocHelper.addJsDoc(meta,jstMethod);
    for (    ArgType arg : meta.getArgs()) {
      jstMethod.addParam(arg.getName());
    }
    final JsTypingMeta typing=meta.getTyping();
    if (typing != null) {
      final JsTypingMeta returnType=getReturnTyping(meta);
      final IJstType retType=findType(ctx,returnType,meta);
      jstMethod.setRtnType(retType);
      if (typing instanceof JsFuncType) {
        JsFuncType funcType=(JsFuncType)typing;
        if (funcType.isTypeFactoryEnabled()) {
          jstMethod.setTypeFactoryEnabled(true);
        }
        if (funcType.isFuncArgMetaExtensionEnabled()) {
          jstMethod.setFuncArgMetaExtensionEnabled(true);
        }
      }
    }
    TranslateHelper.setReferenceSource(jstMethod,meta);
  }
  if (ctx.getCurrentScope() == ScopeIds.PROPS) {
    jstMethod.getModifiers().merge(JstModifiers.STATIC);
  }
  List<JsTypingMeta> types;
  if (astArgs != null) {
    if (meta != null) {
      int idx=0;
      for (      IArgument astArg : astArgs) {
        types=new ArrayList<JsTypingMeta>();
        if (meta != null) {
          List<JsParam> params=getParams(meta);
          if (params != null && params.size() > idx) {
            types=params.get(idx).getTypes();
          }
        }
        if (!types.isEmpty() || !useJsAnnotForArgs) {
          ArgumentTranslator atrans=(ArgumentTranslator)TranslatorFactory.getTranslator(astArg,ctx);
          atrans.setCommentMetaAndIndex(meta,idx);
          JstArg jstArg=atrans.doTranslate(jstMethod,astArg);
          jstMethod.addArg(jstArg);
        }
        idx++;
      }
      int astArgsCount=idx;
      List<JsParam> params=getParams(meta);
      int annArgsCount=(params == null) ? 0 : params.size();
      if (astArgsCount < annArgsCount) {
        for (int i=astArgsCount; i < annArgsCount; i++) {
          JstArg jstArg=createJstArg(jstMethod,params.get(i).getName(),null,meta,i,ctx);
          if (jstArg != null) {
            jstMethod.addArg(jstArg);
          }
        }
      }
    }
 else {
      for (      IArgument astArg : astArgs) {
        ArgumentTranslator atrans=(ArgumentTranslator)TranslatorFactory.getTranslator(astArg,ctx);
        JstArg jstArg=atrans.doTranslate(jstMethod,astArg);
        jstMethod.addArg(jstArg);
      }
    }
  }
 else {
    if (meta != null && useJsAnnotForArgs) {
      List<JsParam> params=getParams(meta);
      if (params != null && params.size() > 0) {
        int idx=0;
        types=new ArrayList<JsTypingMeta>();
        for (        JsParam param : params) {
          String argName=param.getName() != null ? param.getName() : DEFAULT_ARG_PREFIX + idx;
          JstArg jstArg=createJstArg(jstMethod,argName,null,meta,idx,ctx);
          if (params.size() > idx) {
            types=params.get(idx).getTypes();
          }
          if (!types.isEmpty()) {
            jstMethod.addArg(jstArg);
            idx++;
          }
        }
      }
    }
  }
  if (astMtdDecl != null && jstMethod != null) {
    jstMethod.getName().setSource(TranslateHelper.getSourceFunc(astMtdDecl,ctx.getSourceUtil()));
  }
  return jstMethod;
}

Fixed version (ground truth):
public static JstMethod createJstMethod(final MethodDeclaration astMtdDecl,final IArgument[] astArgs,IJsCommentMeta meta,final TranslateCtx ctx,boolean useJsAnnotForArgs,final String methName){
  String methodName=methName;
  if (methName == null) {
    methodName=(meta != null) ? meta.getName() : FunctionExpressionTranslator.DUMMY_METHOD_NAME;
  }
  JstMethod jstMethod;
  if (VjoKeywords.CONSTRUCTS.equals(methodName)) {
    jstMethod=new JstConstructor();
  }
 else {
    jstMethod=new JstMethod(methodName);
  }
  if (meta != null) {
    jstMethod.setHasJsAnnotation(true);
    jstMethod.setName(methodName);
    TranslateHelper.setModifiersFromMeta(meta,jstMethod.getModifiers());
    JsDocHelper.addJsDoc(meta,jstMethod);
    for (    ArgType arg : meta.getArgs()) {
      jstMethod.addParam(arg.getName());
    }
    final JsTypingMeta typing=meta.getTyping();
    if (typing != null) {
      final JsTypingMeta returnType=getReturnTyping(meta);
      final IJstType retType=findType(ctx,returnType,meta);
      jstMethod.setRtnType(retType);
      if (typing instanceof JsFuncType) {
        JsFuncType funcType=(JsFuncType)typing;
        if (funcType.isTypeFactoryEnabled()) {
          jstMethod.setTypeFactoryEnabled(true);
        }
        if (funcType.isFuncArgMetaExtensionEnabled()) {
          jstMethod.setFuncArgMetaExtensionEnabled(true);
        }
      }
    }
    TranslateHelper.setReferenceSource(jstMethod,meta);
  }
  if (ctx.getCurrentScope() == ScopeIds.PROPS) {
    jstMethod.getModifiers().merge(JstModifiers.STATIC);
  }
  List<JsTypingMeta> types;
  if (astArgs != null) {
    if (meta != null) {
      int idx=0;
      for (      IArgument astArg : astArgs) {
        types=new ArrayList<JsTypingMeta>();
        if (meta != null) {
          List<JsParam> params=getParams(meta);
          if (params != null && params.size() > idx) {
            types=params.get(idx).getTypes();
          }
        }
        if (!types.isEmpty() || !useJsAnnotForArgs) {
          ArgumentTranslator atrans=(ArgumentTranslator)TranslatorFactory.getTranslator(astArg,ctx);
          atrans.setCommentMetaAndIndex(meta,idx);
          JstArg jstArg=atrans.doTranslate(jstMethod,astArg);
          jstMethod.addArg(jstArg);
        }
        idx++;
      }
      int astArgsCount=idx;
      List<JsParam> params=getParams(meta);
      int annArgsCount=(params == null) ? 0 : params.size();
      if (astArgsCount < annArgsCount) {
        for (int i=astArgsCount; i < annArgsCount; i++) {
          JstArg jstArg=createJstArg(jstMethod,params.get(i).getName(),null,meta,i,ctx);
          if (jstArg != null) {
            jstMethod.addArg(jstArg);
          }
        }
      }
    }
 else {
      for (      IArgument astArg : astArgs) {
        ArgumentTranslator atrans=(ArgumentTranslator)TranslatorFactory.getTranslator(astArg,ctx);
        JstArg jstArg=atrans.doTranslate(jstMethod,astArg);
        jstMethod.addArg(jstArg);
      }
    }
  }
 else {
    if (meta != null && useJsAnnotForArgs) {
      List<JsParam> params=getParams(meta);
      if (params != null && params.size() > 0) {
        int idx=0;
        types=new ArrayList<JsTypingMeta>();
        for (        JsParam param : params) {
          String argName=param.getName() != null ? param.getName() : DEFAULT_ARG_PREFIX + idx;
          JstArg jstArg=createJstArg(jstMethod,argName,null,meta,idx,ctx);
          if (params.size() > idx) {
            types=params.get(idx).getTypes();
          }
          if (!types.isEmpty()) {
            jstMethod.addArg(jstArg);
            idx++;
          }
        }
      }
    }
  }
  if (astMtdDecl != null && jstMethod != null) {
    jstMethod.getName().setSource(TranslateHelper.getSourceFunc(astMtdDecl,ctx.getSourceUtil()));
  }
  return jstMethod;
}