void (PsiClass builderClass, PsiField field, PsiMethod method) { if (PsiUtil.resolveClassInType(method.getReturnType()) != builderClass) { final PsiCodeBlock body = method.getBody(); final PsiCodeBlock generatedBody = PropertyUtilBase.generateSetterPrototype(field, builderClass, true).getBody(); assert body != null; assert generatedBody != null; body.replace(generatedBody); final PsiTypeElement typeElement = method.getReturnTypeElement(); assert typeElement != null; typeElement.replace(myElementFactory.createTypeElement(myElementFactory.createType(builderClass))); } }