PsiMethod (PsiMethod method, PsiParameter... params) { final PsiMethod prototype = JavaPsiRecordUtil.isCompactConstructor(method) ? new RecordConstructorMember(method.getContainingClass(), false).generateRecordConstructor() : (PsiMethod)method.copy(); final PsiCodeBlock body = prototype.getBody(); final PsiCodeBlock emptyBody = JavaPsiFacade.getElementFactory(method.getProject()).createCodeBlock(); if (body != null) { body.replace(emptyBody); } else { prototype.getModifierList().setModifierProperty(PsiModifier.ABSTRACT, false); prototype.addBefore(emptyBody, null); } final PsiClass aClass = method.getContainingClass(); if (aClass != null && aClass.isInterface() && !method.hasModifierProperty(PsiModifier.STATIC)) { prototype.getModifierList().setModifierProperty(PsiModifier.DEFAULT, true); } final PsiParameterList parameterList = method.getParameterList(); Arrays.sort(params, Comparator.comparingInt(parameterList::getParameterIndex).reversed()); for (PsiParameter param : params) { final int parameterIndex = parameterList.getParameterIndex(param); Objects.requireNonNull(prototype.getParameterList().getParameter(parameterIndex)).delete(); } return prototype; }