PsiMethod (MultiMap<PsiElement, @DialogMessage String> conflicts) { String newMethodName = myChangeInfo.getNewName(); try { final PsiMethod method = myChangeInfo.getMethod(); if (!JavaLanguage.INSTANCE.equals(method.getLanguage())) return null; PsiManager manager = method.getManager(); PsiElementFactory factory = JavaPsiFacade.getElementFactory(manager.getProject()); final CanonicalTypes.Type returnType = myChangeInfo.getNewReturnType(); PsiMethod prototype; if (returnType != null) { prototype = factory.createMethod(newMethodName, returnType.getType(method, manager)); } else { prototype = factory.createConstructor(); prototype.setName(newMethodName); } JavaParameterInfo[] parameters = myChangeInfo.getNewParameters(); for (JavaParameterInfo info : parameters) { PsiType parameterType = info.createType(method, manager); if (parameterType == null) { parameterType = JavaPsiFacade.getElementFactory(method.getProject()).createTypeFromText(CommonClassNames.JAVA_LANG_OBJECT, method); } PsiParameter param = factory.createParameter(info.getName(), parameterType, method); if (JavaCodeStyleSettings.getInstance(method.getContainingFile()).GENERATE_FINAL_PARAMETERS) { PsiUtil.setModifierProperty(param, PsiModifier.FINAL, true); } prototype.getParameterList().add(param); } ConflictsUtil.checkMethodConflicts(method.getContainingClass(), myChangeInfo.isGenerateDelegate() ? null : method, prototype, conflicts); return prototype; } catch (IncorrectOperationException e) { LOG.error(e); } return null; }