/**
   * Replace a method body with a new method body wrapping the given method.
   *
   * @param mbody the wrapped method
   * @param constParam the constant parameter given to the wrapped method (maybe <code>null</code>).
   * @see
   *     CtNewMethod#wrapped(CtClass,String,CtClass[],CtClass[],CtMethod,CtMethod.ConstParameter,CtClass)
   */
  public void setWrappedBody(CtMethod mbody, ConstParameter constParam)
      throws CannotCompileException {
    declaringClass.checkModify();

    CtClass clazz = getDeclaringClass();
    CtClass[] params;
    CtClass retType;
    try {
      params = getParameterTypes();
      retType = getReturnType();
    } catch (NotFoundException e) {
      throw new CannotCompileException(e);
    }

    Bytecode code =
        CtNewWrappedMethod.makeBody(
            clazz, clazz.getClassFile2(), mbody, params, retType, constParam);
    CodeAttribute cattr = code.toCodeAttribute();
    methodInfo.setCodeAttribute(cattr);
    methodInfo.setAccessFlags(methodInfo.getAccessFlags() & ~AccessFlag.ABSTRACT);
    // rebuilding a stack map table is not needed.
  }
 int compile(Bytecode code) throws CannotCompileException {
   code.addLdc(param);
   return 1;
 }
 int compile(Bytecode code) throws CannotCompileException {
   code.addLconst(param);
   return 2;
 }