PsiMethod (@NotNull PsiClass psiClass) { PsiMethod methodPrototype = myMethodPrototype.getElement(); if (methodPrototype == null) return null; PsiCodeBlock body; if (psiClass.isInterface() && (body = methodPrototype.getBody()) != null) body.delete(); for (String exception : myExceptions) { PsiUtil.addException(methodPrototype, exception); } PsiMethod method = (PsiMethod)psiClass.add(methodPrototype); return (PsiMethod)method.replace(reformat(psiClass.getProject(), method)); }