GrMethod (GrTypeDefinition aClass, PsiMethod method, PsiSubstitutor substitutor) { final Project project = aClass.getProject(); final boolean isAbstract = method.hasModifierProperty(PsiModifier.ABSTRACT); String templName = isAbstract ? JavaTemplateUtil.TEMPLATE_IMPLEMENTED_METHOD_BODY : JavaTemplateUtil.TEMPLATE_OVERRIDDEN_METHOD_BODY; final FileTemplate template = FileTemplateManager.getInstance(method.getProject()).getCodeTemplate(templName); final GrMethod result = (GrMethod)GenerateMembersUtil.substituteGenericMethod(method, substitutor, aClass); setupModifierList(result); setupOverridingMethodBody(project, method, result, template, substitutor); setupReturnType(result, method); setupAnnotations(aClass, method, result); GroovyChangeContextUtil.encodeContextInfo(result); return result; }