public static @NotNull GrMethod createMethod(ExtractMethodInfoHelper helper) {
    StringBuilder buffer = new StringBuilder();

    //Add signature
    PsiType type = helper.getOutputType();
    final PsiPrimitiveType outUnboxed = PsiPrimitiveType.getUnboxedType(type);
    if (outUnboxed != null) type = outUnboxed;
    String modifier = getModifierString(helper);
    String typeText = getTypeString(helper, false, modifier);
    buffer.append(modifier);
    buffer.append(typeText);

    appendName(buffer, helper.getName());

    buffer.append("(");
    for (String param : getParameterString(helper, true)) {
      buffer.append(param);
    }
    buffer.append(") { \n");

    GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(helper.getProject());
    generateBody(helper, PsiTypes.voidType().equals(type), buffer, helper.isForceReturn());

    buffer.append("\n}");

    String methodText = buffer.toString();
    return factory.createMethodFromText(methodText, helper.getContext());
  }
public static @NotNull GrMethod createMethod(ExtractMethodInfoHelper helper)