private Data generateMethod(@NotNull PsiClass targetClass, boolean readOnly) {
    final JVMElementFactory factory = JVMElementFactories.getFactory(targetClass.getLanguage(), targetClass.getProject());
    assert factory != null;
    PsiMethod method = factory.createMethod(getMethodName(), PsiTypes.voidType());

    final GrReferenceExpression ref = getRefExpr();
    if (GrStaticChecker.isInStaticContext(ref, targetClass)) {
      method.getModifierList().setModifierProperty(PsiModifier.STATIC, true);
    }

    PsiType[] argTypes = getArgumentTypes();
    assert argTypes != null;

    ChooseTypeExpression[] paramTypesExpressions = setupParams(method, argTypes, factory);

    TypeConstraint[] constraints = getReturnTypeConstraints();

    final PsiGenerationInfo<PsiMethod> info = OverrideImplementUtil.createGenerationInfo(method);
    if (!readOnly) {
      info.insert(targetClass, findInsertionAnchor(info, targetClass), false);
    }
    method = info.getPsiMember();

    if (shouldBeAbstract(targetClass)) {
      method.getBody().delete();
      if (!targetClass.isInterface()) {
        method.getModifierList().setModifierProperty(PsiModifier.ABSTRACT, true);
      }
    }
    return new Data(paramTypesExpressions, method, constraints);
  }
private Data generateMethod(@NotNull PsiClass targetClass, boolean readOnly)